From 586e67b36967dddecf408fece9ca9d40281a3727 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Fri, 28 Nov 2025 13:30:12 +0200 Subject: [PATCH] QOL: MIH Mine Sweeper Package performance improvements pt2 --- .../build_minesweeper_leaderboard_list.dart | 2 - .../builders/build_my_scoreboard_list.dart | 2 - .../mih_mine_sweeper_leader_board.dart | 185 ++++++++------- .../package_tools/my_score_board.dart | 213 +++++++++--------- 4 files changed, 194 insertions(+), 208 deletions(-) diff --git a/Frontend/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart b/Frontend/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart index 9feb86c2..5c18eaca 100644 --- a/Frontend/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart +++ b/Frontend/lib/mih_packages/mine_sweeper/builders/build_minesweeper_leaderboard_list.dart @@ -40,8 +40,6 @@ class _BuildMinesweeperLeaderboardListState builder: (BuildContext context, MzansiProfileProvider profileProvider, MihMineSweeperProvider mineSweeperProvider, Widget? child) { return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), separatorBuilder: (BuildContext context, index) { return Divider( color: MihColors.getSecondaryColor( diff --git a/Frontend/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart b/Frontend/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart index 44d64644..59f7f3a4 100644 --- a/Frontend/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart +++ b/Frontend/lib/mih_packages/mine_sweeper/builders/build_my_scoreboard_list.dart @@ -39,8 +39,6 @@ class _BuildMinesweeperLeaderboardListState builder: (BuildContext context, MzansiProfileProvider profileProvider, MihMineSweeperProvider mineSweeperProvider, Widget? child) { return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), separatorBuilder: (BuildContext context, index) { return Divider( color: MihColors.getSecondaryColor( diff --git a/Frontend/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart b/Frontend/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart index 0293fd0a..93f398af 100644 --- a/Frontend/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart +++ b/Frontend/lib/mih_packages/mine_sweeper/package_tools/mih_mine_sweeper_leader_board.dart @@ -91,111 +91,106 @@ class _MihMineSweeperLeaderBoardState extends State { child: Mihloadingcircle(), ); } else { - return SingleChildScrollView( - physics: const AlwaysScrollableScrollPhysics(), - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihDropdownField( - controller: filterController, - hintText: "Leaderboards", - dropdownOptions: const [ - "Very Easy", - "Easy", - "Intermediate", - "Hard", - ], - requiredText: true, - editable: true, - enableSearch: false, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - onSelected: (selection) { - refreshLeaderBoard(mineSweeperProvider, selection!); - }, - ), + return Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: width / 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: MihDropdownField( + controller: filterController, + hintText: "Leaderboards", + dropdownOptions: const [ + "Very Easy", + "Easy", + "Intermediate", + "Hard", + ], + requiredText: true, + editable: true, + enableSearch: false, + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + onSelected: (selection) { + refreshLeaderBoard(mineSweeperProvider, selection!); + }, ), - ], - ), + ), + ], ), - const SizedBox(height: 10), - !isLoading && mineSweeperProvider.leaderboard!.isEmpty - ? Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mineSweeper, - size: 165, + ), + const SizedBox(height: 10), + !isLoading && mineSweeperProvider.leaderboard!.isEmpty + ? Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.mineSweeper, + size: 165, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + ), + const SizedBox(height: 10), + Text( + "Be the first on the leaderboard.", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, color: MihColors.getSecondaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), ), - const SizedBox(height: 10), - Text( - "Be the first on the leaderboard.", + ), + const SizedBox(height: 25), + Center( + child: RichText( textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - FontAwesomeIcons.bomb, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - TextSpan(text: " and start a new game"), - ], + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)! + .theme + .mode == + "Dark"), ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + FontAwesomeIcons.bomb, + size: 20, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)! + .theme + .mode == + "Dark"), + ), + ), + TextSpan(text: " and start a new game"), + ], ), ), - ], - ), - ) - : BuildMinesweeperLeaderboardList(), - ], - ), + ), + ], + ), + ) + : Expanded(child: BuildMinesweeperLeaderboardList()), + ], ); } }, diff --git a/Frontend/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart b/Frontend/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart index 68bdefaa..31e18824 100644 --- a/Frontend/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart +++ b/Frontend/lib/mih_packages/mine_sweeper/package_tools/my_score_board.dart @@ -81,126 +81,121 @@ class _MihMineSweeperLeaderBoardState extends State { child: Mihloadingcircle(), ); } else { - return SingleChildScrollView( - physics: const AlwaysScrollableScrollPhysics(), - child: Column( - children: [ - Center( - child: MihCircleAvatar( - imageFile: profileProvider.userProfilePicture, - width: 150, - editable: false, - fileNameController: null, - userSelectedfile: null, - frameColor: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - backgroundColor: MihColors.getPrimaryColor( - MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - onChange: (selectedImage) {}, - key: ValueKey(profileProvider.userProfilePicUrl), - ), + return Column( + children: [ + Center( + child: MihCircleAvatar( + imageFile: profileProvider.userProfilePicture, + width: 150, + editable: false, + fileNameController: null, + userSelectedfile: null, + frameColor: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + backgroundColor: MihColors.getPrimaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + onChange: (selectedImage) {}, + key: ValueKey(profileProvider.userProfilePicUrl), ), - Padding( - padding: EdgeInsets.symmetric(horizontal: width / 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - Flexible( - child: MihDropdownField( - controller: filterController, - hintText: "Scoreboards", - dropdownOptions: const [ - "Very Easy", - "Easy", - "Intermediate", - "Hard", - ], - requiredText: true, - editable: true, - enableSearch: false, - validator: (value) { - return MihValidationServices().isEmpty(value); - }, - onSelected: (selection) { - refreshLeaderBoard(mineSweeperProvider, selection!); - }, - ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: width / 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: MihDropdownField( + controller: filterController, + hintText: "Scoreboards", + dropdownOptions: const [ + "Very Easy", + "Easy", + "Intermediate", + "Hard", + ], + requiredText: true, + editable: true, + enableSearch: false, + validator: (value) { + return MihValidationServices().isEmpty(value); + }, + onSelected: (selection) { + refreshLeaderBoard(mineSweeperProvider, selection!); + }, ), - ], - ), + ), + ], ), - const SizedBox(height: 10), - mineSweeperProvider.myScoreboard!.isEmpty - ? Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Icon( - MihIcons.mineSweeper, - size: 165, + ), + const SizedBox(height: 10), + mineSweeperProvider.myScoreboard!.isEmpty + ? Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + Icon( + MihIcons.mineSweeper, + size: 165, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + ), + const SizedBox(height: 10), + Text( + "You have played and ${mineSweeperProvider.difficulty} yet.", + textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, color: MihColors.getSecondaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), ), - const SizedBox(height: 10), - Text( - "You have played and ${mineSweeperProvider.difficulty} yet.", + ), + const SizedBox(height: 25), + Center( + child: RichText( textAlign: TextAlign.center, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - const SizedBox(height: 25), - Center( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.normal, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - children: [ - TextSpan(text: "Press "), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - FontAwesomeIcons.bomb, - size: 20, - color: MihColors.getSecondaryColor( - MzansiInnovationHub.of(context)! - .theme - .mode == - "Dark"), - ), - ), - TextSpan(text: " and start a new game"), - ], + text: TextSpan( + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.normal, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)! + .theme + .mode == + "Dark"), ), + children: [ + TextSpan(text: "Press "), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + FontAwesomeIcons.bomb, + size: 20, + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)! + .theme + .mode == + "Dark"), + ), + ), + TextSpan(text: " and start a new game"), + ], ), ), - ], - ), - ) - : BuildMyScoreBoardList(), - ], - ), + ), + ], + ), + ) + : Expanded(child: BuildMyScoreBoardList()), + ], ); } },