implement changes
This commit is contained in:
@@ -21,6 +21,7 @@ class ChooseGameView extends StatefulWidget {
|
||||
|
||||
class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
late int selectedGameIndex;
|
||||
|
||||
final TextEditingController searchBarController = TextEditingController();
|
||||
|
||||
@override
|
||||
@@ -31,6 +32,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
@@ -43,7 +45,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).choose_game,
|
||||
loc.choose_game,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
@@ -64,7 +66,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: CustomSearchBar(
|
||||
controller: searchBarController,
|
||||
hintText: AppLocalizations.of(context).game_name,
|
||||
hintText: loc.game_name,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
@@ -76,9 +78,9 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
title: widget.games[index].$1,
|
||||
description: widget.games[index].$2,
|
||||
badgeText: translateRulesetToString(
|
||||
widget.games[index].$3,
|
||||
context,
|
||||
),
|
||||
widget.games[index].$3,
|
||||
context,
|
||||
),
|
||||
isHighlighted: selectedGameIndex == index,
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
|
||||
@@ -34,6 +34,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
@@ -52,7 +53,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).choose_group,
|
||||
loc.choose_group,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
@@ -79,7 +80,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: CustomSearchBar(
|
||||
controller: controller,
|
||||
hintText: AppLocalizations.of(context).search_for_groups,
|
||||
hintText: loc.search_for_groups,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
filterGroups(value);
|
||||
@@ -94,15 +95,15 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||
visible: widget.groups.isNotEmpty,
|
||||
replacement: TopCenteredMessage(
|
||||
icon: Icons.info,
|
||||
title: AppLocalizations.of(context).info,
|
||||
message: AppLocalizations.of(context).no_groups_created_yet,
|
||||
title: loc.info,
|
||||
message: loc.no_groups_created_yet,
|
||||
),
|
||||
child: TopCenteredMessage(
|
||||
icon: Icons.info,
|
||||
title: AppLocalizations.of(context).info,
|
||||
title: loc.info,
|
||||
message: AppLocalizations.of(
|
||||
context,
|
||||
).there_is_no_group_matching_your_search,
|
||||
context,
|
||||
).there_is_no_group_matching_your_search,
|
||||
),
|
||||
),
|
||||
child: ListView.builder(
|
||||
|
||||
@@ -29,6 +29,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return DefaultTabController(
|
||||
length: 2,
|
||||
initialIndex: 0,
|
||||
@@ -48,7 +49,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).choose_ruleset,
|
||||
loc.choose_ruleset,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
@@ -82,9 +83,9 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
||||
});
|
||||
},
|
||||
title: translateRulesetToString(
|
||||
widget.rulesets[index].$1,
|
||||
context,
|
||||
),
|
||||
widget.rulesets[index].$1,
|
||||
context,
|
||||
),
|
||||
description: widget.rulesets[index].$2,
|
||||
isHighlighted: selectedRulesetIndex == index,
|
||||
);
|
||||
|
||||
@@ -90,23 +90,12 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
}
|
||||
|
||||
List<(Ruleset, String)> _getRulesets(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return [
|
||||
(
|
||||
Ruleset.singleWinner,
|
||||
AppLocalizations.of(context).ruleset_single_winner_desc,
|
||||
),
|
||||
(
|
||||
Ruleset.singleLoser,
|
||||
AppLocalizations.of(context).ruleset_single_loser_desc,
|
||||
),
|
||||
(
|
||||
Ruleset.mostPoints,
|
||||
AppLocalizations.of(context).ruleset_most_points_desc,
|
||||
),
|
||||
(
|
||||
Ruleset.leastPoints,
|
||||
AppLocalizations.of(context).ruleset_least_points_desc,
|
||||
),
|
||||
(Ruleset.singleWinner, loc.ruleset_single_winner),
|
||||
(Ruleset.singleLoser, loc.ruleset_single_loser),
|
||||
(Ruleset.mostPoints, loc.ruleset_most_points),
|
||||
(Ruleset.leastPoints, loc.ruleset_least_points),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -118,13 +107,14 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
scrolledUnderElevation: 0,
|
||||
title: Text(
|
||||
AppLocalizations.of(context).create_new_match,
|
||||
loc.create_new_match,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
@@ -141,9 +131,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
),
|
||||
),
|
||||
ChooseTile(
|
||||
title: AppLocalizations.of(context).game,
|
||||
title: loc.game,
|
||||
trailingText: selectedGameIndex == -1
|
||||
? AppLocalizations.of(context).none
|
||||
? loc.none
|
||||
: games[selectedGameIndex].$1,
|
||||
onPressed: () async {
|
||||
selectedGameIndex = await Navigator.of(context).push(
|
||||
@@ -169,9 +159,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
},
|
||||
),
|
||||
ChooseTile(
|
||||
title: AppLocalizations.of(context).ruleset,
|
||||
title: loc.ruleset,
|
||||
trailingText: selectedRuleset == null
|
||||
? AppLocalizations.of(context).none
|
||||
? loc.none
|
||||
: translateRulesetToString(selectedRuleset!, context),
|
||||
onPressed: () async {
|
||||
final rulesets = _getRulesets(context);
|
||||
@@ -192,9 +182,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
},
|
||||
),
|
||||
ChooseTile(
|
||||
title: AppLocalizations.of(context).group,
|
||||
title: loc.group,
|
||||
trailingText: selectedGroup == null
|
||||
? AppLocalizations.of(context).none_group
|
||||
? loc.none_group
|
||||
: selectedGroup!.name,
|
||||
onPressed: () async {
|
||||
selectedGroup = await Navigator.of(context).push(
|
||||
@@ -231,7 +221,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
),
|
||||
),
|
||||
CustomWidthButton(
|
||||
text: AppLocalizations.of(context).create_match,
|
||||
text: loc.create_match,
|
||||
sizeRelativeToWidth: 0.95,
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed: _enableCreateGameButton()
|
||||
|
||||
@@ -36,6 +36,7 @@ class _MatchResultViewState extends State<MatchResultView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
@@ -81,7 +82,7 @@ class _MatchResultViewState extends State<MatchResultView> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).select_winner,
|
||||
loc.select_winner,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -44,12 +44,14 @@ class _MatchViewState extends State<MatchView> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
db = Provider.of<AppDatabase>(context, listen: false);
|
||||
loadGames();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
body: Stack(
|
||||
@@ -62,8 +64,8 @@ class _MatchViewState extends State<MatchView> {
|
||||
replacement: Center(
|
||||
child: TopCenteredMessage(
|
||||
icon: Icons.report,
|
||||
title: AppLocalizations.of(context).info,
|
||||
message: AppLocalizations.of(context).no_matches_created_yet,
|
||||
title: loc.info,
|
||||
message: loc.no_matches_created_yet,
|
||||
),
|
||||
),
|
||||
child: ListView.builder(
|
||||
@@ -97,7 +99,7 @@ class _MatchViewState extends State<MatchView> {
|
||||
Positioned(
|
||||
bottom: MediaQuery.paddingOf(context).bottom,
|
||||
child: CustomWidthButton(
|
||||
text: AppLocalizations.of(context).create_match,
|
||||
text: loc.create_match,
|
||||
sizeRelativeToWidth: 0.90,
|
||||
onPressed: () async {
|
||||
Navigator.push(
|
||||
|
||||
Reference in New Issue
Block a user