From 9609418b8d5ff7c28ce013d9b98180b936bf7dfa Mon Sep 17 00:00:00 2001 From: JayAgola <155939211+JayAgola@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:01:22 +0530 Subject: [PATCH] issue #29 Fix Pixel Overflow Error in Upcoming Match Card (#41) * #36,#34,#32 - Run code - Update dependencies - Compatible version up to Flutter 3.24 * - Solved issue - #36,#34,#32 - Run code - Update dependencies - Compatible version up to Flutter 3.24 * - issue resolve * - Pixel Overflow Error in "Upcoming Match Card" issue resolve * - Pixel Overflow Error in "Upcoming Match Card" issue resolve * - issue resolve --- .github/workflows/flutter_ci.yml | 1 + lib/main.dart | 2 +- lib/screens/player/schedule_screen.dart | 85 +++++++++++++++---------- lib/widgets/upcoming_match_card.dart | 36 +++++++---- 4 files changed, 75 insertions(+), 49 deletions(-) diff --git a/.github/workflows/flutter_ci.yml b/.github/workflows/flutter_ci.yml index 1e10be4..dd2166b 100644 --- a/.github/workflows/flutter_ci.yml +++ b/.github/workflows/flutter_ci.yml @@ -19,6 +19,7 @@ jobs: - name: Check out code uses: actions/checkout@v4 + - name: Set up Flutter uses: subosito/flutter-action@v4 with: diff --git a/lib/main.dart b/lib/main.dart index b62c153..b57b8eb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -81,7 +81,7 @@ class MyApp extends StatelessWidget { routes: { AdminMainPage.routeName: (ctx) => AdminMainPage(), AuctionHome.routeName: (ctx) => AuctionHome(), - // AuctionPlayer.routeName: (ctx) => AuctionPlayer(), + //AuctionPlayer.routeName: (ctx) => AuctionPlayer(), AuctionPlayerResell.routeName: (ctx) => AuctionPlayerResell(), AuctionDetails.routeName: (ctx) => AuctionDetails(), TeamDetails.routeName: (ctx) => TeamDetails(), diff --git a/lib/screens/player/schedule_screen.dart b/lib/screens/player/schedule_screen.dart index 0bd5425..b292961 100644 --- a/lib/screens/player/schedule_screen.dart +++ b/lib/screens/player/schedule_screen.dart @@ -128,6 +128,7 @@ class UpcomingMatchCard extends StatelessWidget { ); }, child: Container( + width: MediaQuery.sizeOf(context).width*0.8, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), border: Border.all( @@ -211,12 +212,14 @@ class UpcomingMatchCard extends StatelessWidget { ), title: Center( child: Column(children: [ - Text( - "Match " + match.matchId, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - color: Colors.white60), + Container( + child: Text( + "Match " + match.matchId, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white60), + textScaler: TextScaler.linear(1.5), + ), ), SizedBox( height: 12, @@ -224,37 +227,51 @@ class UpcomingMatchCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Text( - teams - .firstWhere((e) => e.teamUid == match.teamId1) - .teamAbbreviation, - // teams.firstWhere((e) => e.teamUid==match.teamId1).teamAbbreviation[1] + - // teams.firstWhere((e) => e.teamUid==match.teamId1).teamAbbreviation[2], + Container( + width: MediaQuery.sizeOf(context).width*0.175, + alignment: Alignment.center, + child: Text( + teams + .firstWhere((e) => e.teamUid == match.teamId1) + .teamAbbreviation, + // teams.firstWhere((e) => e.teamUid==match.teamId1).teamAbbreviation[1] + + // teams.firstWhere((e) => e.teamUid==match.teamId1).teamAbbreviation[2], - // overflow: TextOverflow.visible, - style: TextStyle( - color: Colors.white60, - fontWeight: FontWeight.bold, - fontSize: 18), + // overflow: TextOverflow.visible, + style: TextStyle( + color: Colors.white60, + fontWeight: FontWeight.bold, + ), + textScaler: TextScaler.linear(1), + ), ), - Text( - " Vs ", - style: TextStyle( - color: Colors.white60, - fontWeight: FontWeight.bold, - fontSize: 18), + Container( + width: MediaQuery.sizeOf(context).width*0.075, + alignment: Alignment.center, + child: Text( + " Vs ", + style: TextStyle( + color: Colors.white60, + fontWeight: FontWeight.bold, + ), + textScaler: TextScaler.linear(1), + ), ), - Text( - teams - .firstWhere((e) => e.teamUid == match.teamId2) - .teamAbbreviation, - // teams.firstWhere((e) => e.teamUid==match.teamId2).teamAbbreviation[1] + - // teams.firstWhere((e) => e.teamUid==match.teamId2).teamAbbreviation[2], - overflow: TextOverflow.visible, - style: TextStyle( - color: Colors.white60, - fontWeight: FontWeight.bold, - fontSize: 18), + Container( + alignment: Alignment.center, + width: MediaQuery.sizeOf(context).width*0.175, + child: Text( + teams + .firstWhere((e) => e.teamUid == match.teamId2) + .teamAbbreviation, + // teams.firstWhere((e) => e.teamUid==match.teamId2).teamAbbreviation[1] + + // teams.firstWhere((e) => e.teamUid==match.teamId2).teamAbbreviation[2], + // overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white60, + fontWeight: FontWeight.bold, + ),textScaler: TextScaler.linear(1), + ), ), ], ), diff --git a/lib/widgets/upcoming_match_card.dart b/lib/widgets/upcoming_match_card.dart index 203aae4..412a729 100644 --- a/lib/widgets/upcoming_match_card.dart +++ b/lib/widgets/upcoming_match_card.dart @@ -67,9 +67,11 @@ class _UpcomingMatchCardState extends State { snapshot.data.toString(), ), ); - } else if (snapshot.hasError) { + } + else if (snapshot.hasError) { return Icon(Icons.image_not_supported_sharp); - } else { + } + else { return CircleAvatar( radius: 20, backgroundColor: CustomColors.primaryColor, @@ -80,12 +82,15 @@ class _UpcomingMatchCardState extends State { }, ), ), - Text( - team1.teamAbbreviation, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 15, - color: Colors.white60, + Container( + width: MediaQuery.sizeOf(context).width*0.175, + child: Text( + team1.teamAbbreviation, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15, + color: Colors.white60, + ), ), ), ], @@ -168,12 +173,15 @@ class _UpcomingMatchCardState extends State { }, ), ), - Text( - team2.teamAbbreviation, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 15, - color: Colors.white60, + Container( + width: MediaQuery.sizeOf(context).width*0.175, + child: Text( + team2.teamAbbreviation, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15, + color: Colors.white60, + ), ), ), ],