QOL: MIH Mine Sweeper Package performance improvements pt2
This commit is contained in:
@@ -40,8 +40,6 @@ class _BuildMinesweeperLeaderboardListState
|
|||||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
separatorBuilder: (BuildContext context, index) {
|
separatorBuilder: (BuildContext context, index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class _BuildMinesweeperLeaderboardListState
|
|||||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
separatorBuilder: (BuildContext context, index) {
|
separatorBuilder: (BuildContext context, index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
|
|||||||
@@ -91,111 +91,106 @@ class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
|||||||
child: Mihloadingcircle(),
|
child: Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return SingleChildScrollView(
|
return Column(
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
children: [
|
||||||
child: Column(
|
Padding(
|
||||||
children: [
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
Padding(
|
child: Row(
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
children: [
|
||||||
mainAxisSize: MainAxisSize.max,
|
Flexible(
|
||||||
children: [
|
child: MihDropdownField(
|
||||||
Flexible(
|
controller: filterController,
|
||||||
child: MihDropdownField(
|
hintText: "Leaderboards",
|
||||||
controller: filterController,
|
dropdownOptions: const [
|
||||||
hintText: "Leaderboards",
|
"Very Easy",
|
||||||
dropdownOptions: const [
|
"Easy",
|
||||||
"Very Easy",
|
"Intermediate",
|
||||||
"Easy",
|
"Hard",
|
||||||
"Intermediate",
|
],
|
||||||
"Hard",
|
requiredText: true,
|
||||||
],
|
editable: true,
|
||||||
requiredText: true,
|
enableSearch: false,
|
||||||
editable: true,
|
validator: (value) {
|
||||||
enableSearch: false,
|
return MihValidationServices().isEmpty(value);
|
||||||
validator: (value) {
|
},
|
||||||
return MihValidationServices().isEmpty(value);
|
onSelected: (selection) {
|
||||||
},
|
refreshLeaderBoard(mineSweeperProvider, selection!);
|
||||||
onSelected: (selection) {
|
},
|
||||||
refreshLeaderBoard(mineSweeperProvider, selection!);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
!isLoading && mineSweeperProvider.leaderboard!.isEmpty
|
const SizedBox(height: 10),
|
||||||
? Padding(
|
!isLoading && mineSweeperProvider.leaderboard!.isEmpty
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
? Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
const SizedBox(height: 50),
|
children: [
|
||||||
Icon(
|
const SizedBox(height: 50),
|
||||||
MihIcons.mineSweeper,
|
Icon(
|
||||||
size: 165,
|
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(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
Text(
|
const SizedBox(height: 25),
|
||||||
"Be the first on the leaderboard.",
|
Center(
|
||||||
|
child: RichText(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.visible,
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.normal,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!
|
MzansiInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.mode ==
|
.mode ==
|
||||||
"Dark"),
|
"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"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
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()),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -81,126 +81,121 @@ class _MihMineSweeperLeaderBoardState extends State<MyScoreBoard> {
|
|||||||
child: Mihloadingcircle(),
|
child: Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return SingleChildScrollView(
|
return Column(
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
children: [
|
||||||
child: Column(
|
Center(
|
||||||
children: [
|
child: MihCircleAvatar(
|
||||||
Center(
|
imageFile: profileProvider.userProfilePicture,
|
||||||
child: MihCircleAvatar(
|
width: 150,
|
||||||
imageFile: profileProvider.userProfilePicture,
|
editable: false,
|
||||||
width: 150,
|
fileNameController: null,
|
||||||
editable: false,
|
userSelectedfile: null,
|
||||||
fileNameController: null,
|
frameColor: MihColors.getSecondaryColor(
|
||||||
userSelectedfile: null,
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
frameColor: MihColors.getSecondaryColor(
|
backgroundColor: MihColors.getPrimaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
backgroundColor: MihColors.getPrimaryColor(
|
onChange: (selectedImage) {},
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
key: ValueKey(profileProvider.userProfilePicUrl),
|
||||||
onChange: (selectedImage) {},
|
|
||||||
key: ValueKey(profileProvider.userProfilePicUrl),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Padding(
|
),
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
Padding(
|
||||||
child: Row(
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.max,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
mainAxisSize: MainAxisSize.max,
|
||||||
Flexible(
|
children: [
|
||||||
child: MihDropdownField(
|
Flexible(
|
||||||
controller: filterController,
|
child: MihDropdownField(
|
||||||
hintText: "Scoreboards",
|
controller: filterController,
|
||||||
dropdownOptions: const [
|
hintText: "Scoreboards",
|
||||||
"Very Easy",
|
dropdownOptions: const [
|
||||||
"Easy",
|
"Very Easy",
|
||||||
"Intermediate",
|
"Easy",
|
||||||
"Hard",
|
"Intermediate",
|
||||||
],
|
"Hard",
|
||||||
requiredText: true,
|
],
|
||||||
editable: true,
|
requiredText: true,
|
||||||
enableSearch: false,
|
editable: true,
|
||||||
validator: (value) {
|
enableSearch: false,
|
||||||
return MihValidationServices().isEmpty(value);
|
validator: (value) {
|
||||||
},
|
return MihValidationServices().isEmpty(value);
|
||||||
onSelected: (selection) {
|
},
|
||||||
refreshLeaderBoard(mineSweeperProvider, selection!);
|
onSelected: (selection) {
|
||||||
},
|
refreshLeaderBoard(mineSweeperProvider, selection!);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
mineSweeperProvider.myScoreboard!.isEmpty
|
const SizedBox(height: 10),
|
||||||
? Padding(
|
mineSweeperProvider.myScoreboard!.isEmpty
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
? Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
const SizedBox(height: 50),
|
children: [
|
||||||
Icon(
|
const SizedBox(height: 50),
|
||||||
MihIcons.mineSweeper,
|
Icon(
|
||||||
size: 165,
|
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(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
"Dark"),
|
"Dark"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
Text(
|
const SizedBox(height: 25),
|
||||||
"You have played and ${mineSweeperProvider.difficulty} yet.",
|
Center(
|
||||||
|
child: RichText(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.visible,
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.normal,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!
|
MzansiInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.mode ==
|
.mode ==
|
||||||
"Dark"),
|
"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"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
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()),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user