made getters non nullable and removed all null assertion operators
This commit is contained in:
@@ -2,3 +2,4 @@ arb-dir: lib/l10n/arb
|
|||||||
template-arb-file: app_en.arb
|
template-arb-file: app_en.arb
|
||||||
output-localization-file: app_localizations.dart
|
output-localization-file: app_localizations.dart
|
||||||
output-dir: lib/l10n/generated
|
output-dir: lib/l10n/generated
|
||||||
|
nullable-getter: false
|
||||||
@@ -37,12 +37,12 @@ enum Ruleset { singleWinner, singleLoser, mostPoints, leastPoints }
|
|||||||
String translateRulesetToString(Ruleset ruleset, BuildContext context) {
|
String translateRulesetToString(Ruleset ruleset, BuildContext context) {
|
||||||
switch (ruleset) {
|
switch (ruleset) {
|
||||||
case Ruleset.singleWinner:
|
case Ruleset.singleWinner:
|
||||||
return AppLocalizations.of(context)!.single_winner;
|
return AppLocalizations.of(context).single_winner;
|
||||||
case Ruleset.singleLoser:
|
case Ruleset.singleLoser:
|
||||||
return AppLocalizations.of(context)!.single_loser;
|
return AppLocalizations.of(context).single_loser;
|
||||||
case Ruleset.mostPoints:
|
case Ruleset.mostPoints:
|
||||||
return AppLocalizations.of(context)!.most_points;
|
return AppLocalizations.of(context).most_points;
|
||||||
case Ruleset.leastPoints:
|
case Ruleset.leastPoints:
|
||||||
return AppLocalizations.of(context)!.least_points;
|
return AppLocalizations.of(context).least_points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ abstract class AppLocalizations {
|
|||||||
|
|
||||||
final String localeName;
|
final String localeName;
|
||||||
|
|
||||||
static AppLocalizations? of(BuildContext context) {
|
static AppLocalizations of(BuildContext context) {
|
||||||
return Localizations.of<AppLocalizations>(context, AppLocalizations);
|
return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const LocalizationsDelegate<AppLocalizations> delegate =
|
static const LocalizationsDelegate<AppLocalizations> delegate =
|
||||||
|
|||||||
@@ -90,28 +90,28 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
index: 0,
|
index: 0,
|
||||||
isSelected: currentIndex == 0,
|
isSelected: currentIndex == 0,
|
||||||
icon: Icons.home_rounded,
|
icon: Icons.home_rounded,
|
||||||
label: AppLocalizations.of(context)!.home,
|
label: AppLocalizations.of(context).home,
|
||||||
onTabTapped: onTabTapped,
|
onTabTapped: onTabTapped,
|
||||||
),
|
),
|
||||||
NavbarItem(
|
NavbarItem(
|
||||||
index: 1,
|
index: 1,
|
||||||
isSelected: currentIndex == 1,
|
isSelected: currentIndex == 1,
|
||||||
icon: Icons.gamepad_rounded,
|
icon: Icons.gamepad_rounded,
|
||||||
label: AppLocalizations.of(context)!.matches,
|
label: AppLocalizations.of(context).matches,
|
||||||
onTabTapped: onTabTapped,
|
onTabTapped: onTabTapped,
|
||||||
),
|
),
|
||||||
NavbarItem(
|
NavbarItem(
|
||||||
index: 2,
|
index: 2,
|
||||||
isSelected: currentIndex == 2,
|
isSelected: currentIndex == 2,
|
||||||
icon: Icons.group_rounded,
|
icon: Icons.group_rounded,
|
||||||
label: AppLocalizations.of(context)!.groups,
|
label: AppLocalizations.of(context).groups,
|
||||||
onTabTapped: onTabTapped,
|
onTabTapped: onTabTapped,
|
||||||
),
|
),
|
||||||
NavbarItem(
|
NavbarItem(
|
||||||
index: 3,
|
index: 3,
|
||||||
isSelected: currentIndex == 3,
|
isSelected: currentIndex == 3,
|
||||||
icon: Icons.bar_chart_rounded,
|
icon: Icons.bar_chart_rounded,
|
||||||
label: AppLocalizations.of(context)!.statistics,
|
label: AppLocalizations.of(context).statistics,
|
||||||
onTabTapped: onTabTapped,
|
onTabTapped: onTabTapped,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -132,13 +132,13 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
String _currentTabTitle() {
|
String _currentTabTitle() {
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return AppLocalizations.of(context)!.home;
|
return AppLocalizations.of(context).home;
|
||||||
case 1:
|
case 1:
|
||||||
return AppLocalizations.of(context)!.matches;
|
return AppLocalizations.of(context).matches;
|
||||||
case 2:
|
case 2:
|
||||||
return AppLocalizations.of(context)!.groups;
|
return AppLocalizations.of(context).groups;
|
||||||
case 3:
|
case 3:
|
||||||
return AppLocalizations.of(context)!.statistics;
|
return AppLocalizations.of(context).statistics;
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.create_new_group,
|
AppLocalizations.of(context).create_new_group,
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -58,7 +58,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||||
child: TextInputField(
|
child: TextInputField(
|
||||||
controller: _groupNameController,
|
controller: _groupNameController,
|
||||||
hintText: AppLocalizations.of(context)!.group_name,
|
hintText: AppLocalizations.of(context).group_name,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
@@ -74,7 +74,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
CustomWidthButton(
|
CustomWidthButton(
|
||||||
text: AppLocalizations.of(context)!.create_group,
|
text: AppLocalizations.of(context).create_group,
|
||||||
sizeRelativeToWidth: 0.95,
|
sizeRelativeToWidth: 0.95,
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
onPressed:
|
onPressed:
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
replacement: Center(
|
replacement: Center(
|
||||||
child: TopCenteredMessage(
|
child: TopCenteredMessage(
|
||||||
icon: Icons.info,
|
icon: Icons.info,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: AppLocalizations.of(context)!.no_groups_created_yet,
|
message: AppLocalizations.of(context).no_groups_created_yet,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@@ -74,7 +74,7 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
bottom: MediaQuery.paddingOf(context).bottom,
|
bottom: MediaQuery.paddingOf(context).bottom,
|
||||||
child: CustomWidthButton(
|
child: CustomWidthButton(
|
||||||
text: AppLocalizations.of(context)!.create_group,
|
text: AppLocalizations.of(context).create_group,
|
||||||
sizeRelativeToWidth: 0.90,
|
sizeRelativeToWidth: 0.90,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
QuickInfoTile(
|
QuickInfoTile(
|
||||||
width: constraints.maxWidth * 0.45,
|
width: constraints.maxWidth * 0.45,
|
||||||
height: constraints.maxHeight * 0.15,
|
height: constraints.maxHeight * 0.15,
|
||||||
title: AppLocalizations.of(context)!.matches,
|
title: AppLocalizations.of(context).matches,
|
||||||
icon: Icons.groups_rounded,
|
icon: Icons.groups_rounded,
|
||||||
value: matchCount,
|
value: matchCount,
|
||||||
),
|
),
|
||||||
@@ -95,7 +95,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
QuickInfoTile(
|
QuickInfoTile(
|
||||||
width: constraints.maxWidth * 0.45,
|
width: constraints.maxWidth * 0.45,
|
||||||
height: constraints.maxHeight * 0.15,
|
height: constraints.maxHeight * 0.15,
|
||||||
title: AppLocalizations.of(context)!.groups,
|
title: AppLocalizations.of(context).groups,
|
||||||
icon: Icons.groups_rounded,
|
icon: Icons.groups_rounded,
|
||||||
value: groupCount,
|
value: groupCount,
|
||||||
),
|
),
|
||||||
@@ -105,7 +105,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
child: InfoTile(
|
child: InfoTile(
|
||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
title: AppLocalizations.of(context)!.recent_matches,
|
title: AppLocalizations.of(context).recent_matches,
|
||||||
icon: Icons.timer,
|
icon: Icons.timer,
|
||||||
content: Padding(
|
content: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
||||||
@@ -125,7 +125,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
children: [
|
children: [
|
||||||
MatchSummaryTile(
|
MatchSummaryTile(
|
||||||
matchTitle: recentMatches[0].name,
|
matchTitle: recentMatches[0].name,
|
||||||
game: AppLocalizations.of(context)!.winner_label,
|
game: AppLocalizations.of(context).winner_label,
|
||||||
ruleset: AppLocalizations.of(
|
ruleset: AppLocalizations.of(
|
||||||
context,
|
context,
|
||||||
)!.ruleset_label,
|
)!.ruleset_label,
|
||||||
@@ -175,7 +175,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
),
|
),
|
||||||
InfoTile(
|
InfoTile(
|
||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
title: AppLocalizations.of(context)!.quick_create,
|
title: AppLocalizations.of(context).quick_create,
|
||||||
icon: Icons.add_box_rounded,
|
icon: Icons.add_box_rounded,
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -232,7 +232,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
String _getPlayerText(Match game) {
|
String _getPlayerText(Match game) {
|
||||||
if (game.group == null) {
|
if (game.group == null) {
|
||||||
final playerCount = game.players?.length ?? 0;
|
final playerCount = game.players?.length ?? 0;
|
||||||
return AppLocalizations.of(context)!.players_count(playerCount);
|
return AppLocalizations.of(context).players_count(playerCount);
|
||||||
}
|
}
|
||||||
if (game.players == null || game.players!.isEmpty) {
|
if (game.players == null || game.players!.isEmpty) {
|
||||||
return game.group!.name;
|
return game.group!.name;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.choose_game,
|
AppLocalizations.of(context).choose_game,
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -54,7 +54,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: CustomSearchBar(
|
child: CustomSearchBar(
|
||||||
controller: searchBarController,
|
controller: searchBarController,
|
||||||
hintText: AppLocalizations.of(context)!.game_name,
|
hintText: AppLocalizations.of(context).game_name,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.choose_group,
|
AppLocalizations.of(context).choose_group,
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -63,7 +63,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: CustomSearchBar(
|
child: CustomSearchBar(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
hintText: AppLocalizations.of(context)!.search_for_groups,
|
hintText: AppLocalizations.of(context).search_for_groups,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
filterGroups(value);
|
filterGroups(value);
|
||||||
@@ -78,12 +78,12 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
visible: widget.groups.isNotEmpty,
|
visible: widget.groups.isNotEmpty,
|
||||||
replacement: TopCenteredMessage(
|
replacement: TopCenteredMessage(
|
||||||
icon: Icons.info,
|
icon: Icons.info,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: AppLocalizations.of(context)!.no_groups_created_yet,
|
message: AppLocalizations.of(context).no_groups_created_yet,
|
||||||
),
|
),
|
||||||
child: TopCenteredMessage(
|
child: TopCenteredMessage(
|
||||||
icon: Icons.info,
|
icon: Icons.info,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: AppLocalizations.of(
|
message: AppLocalizations.of(
|
||||||
context,
|
context,
|
||||||
)!.there_is_no_group_matching_your_search,
|
)!.there_is_no_group_matching_your_search,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.choose_ruleset,
|
AppLocalizations.of(context).choose_ruleset,
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
|||||||
@@ -91,19 +91,19 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
return [
|
return [
|
||||||
(
|
(
|
||||||
Ruleset.singleWinner,
|
Ruleset.singleWinner,
|
||||||
AppLocalizations.of(context)!.ruleset_single_winner_desc,
|
AppLocalizations.of(context).ruleset_single_winner_desc,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Ruleset.singleLoser,
|
Ruleset.singleLoser,
|
||||||
AppLocalizations.of(context)!.ruleset_single_loser_desc,
|
AppLocalizations.of(context).ruleset_single_loser_desc,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Ruleset.mostPoints,
|
Ruleset.mostPoints,
|
||||||
AppLocalizations.of(context)!.ruleset_most_points_desc,
|
AppLocalizations.of(context).ruleset_most_points_desc,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Ruleset.leastPoints,
|
Ruleset.leastPoints,
|
||||||
AppLocalizations.of(context)!.ruleset_least_points_desc,
|
AppLocalizations.of(context).ruleset_least_points_desc,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.create_new_match,
|
AppLocalizations.of(context).create_new_match,
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -139,9 +139,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ChooseTile(
|
ChooseTile(
|
||||||
title: AppLocalizations.of(context)!.game,
|
title: AppLocalizations.of(context).game,
|
||||||
trailingText: selectedGameIndex == -1
|
trailingText: selectedGameIndex == -1
|
||||||
? AppLocalizations.of(context)!.none
|
? AppLocalizations.of(context).none
|
||||||
: games[selectedGameIndex].$1,
|
: games[selectedGameIndex].$1,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGameIndex = await Navigator.of(context).push(
|
selectedGameIndex = await Navigator.of(context).push(
|
||||||
@@ -167,9 +167,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ChooseTile(
|
ChooseTile(
|
||||||
title: AppLocalizations.of(context)!.ruleset,
|
title: AppLocalizations.of(context).ruleset,
|
||||||
trailingText: selectedRuleset == null
|
trailingText: selectedRuleset == null
|
||||||
? AppLocalizations.of(context)!.none
|
? AppLocalizations.of(context).none
|
||||||
: translateRulesetToString(selectedRuleset!, context),
|
: translateRulesetToString(selectedRuleset!, context),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final rulesets = _getRulesets(context);
|
final rulesets = _getRulesets(context);
|
||||||
@@ -190,9 +190,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ChooseTile(
|
ChooseTile(
|
||||||
title: AppLocalizations.of(context)!.group,
|
title: AppLocalizations.of(context).group,
|
||||||
trailingText: selectedGroup == null
|
trailingText: selectedGroup == null
|
||||||
? AppLocalizations.of(context)!.none_group
|
? AppLocalizations.of(context).none_group
|
||||||
: selectedGroup!.name,
|
: selectedGroup!.name,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGroup = await Navigator.of(context).push(
|
selectedGroup = await Navigator.of(context).push(
|
||||||
@@ -229,7 +229,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
CustomWidthButton(
|
CustomWidthButton(
|
||||||
text: AppLocalizations.of(context)!.create_match,
|
text: AppLocalizations.of(context).create_match,
|
||||||
sizeRelativeToWidth: 0.95,
|
sizeRelativeToWidth: 0.95,
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
onPressed: _enableCreateGameButton()
|
onPressed: _enableCreateGameButton()
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context)!.select_winner,
|
AppLocalizations.of(context).select_winner,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
replacement: Center(
|
replacement: Center(
|
||||||
child: TopCenteredMessage(
|
child: TopCenteredMessage(
|
||||||
icon: Icons.report,
|
icon: Icons.report,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: AppLocalizations.of(context)!.no_matches_created_yet,
|
message: AppLocalizations.of(context).no_matches_created_yet,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@@ -97,7 +97,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
bottom: MediaQuery.paddingOf(context).bottom,
|
bottom: MediaQuery.paddingOf(context).bottom,
|
||||||
child: CustomWidthButton(
|
child: CustomWidthButton(
|
||||||
text: AppLocalizations.of(context)!.create_match,
|
text: AppLocalizations.of(context).create_match,
|
||||||
sizeRelativeToWidth: 0.90,
|
sizeRelativeToWidth: 0.90,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 10),
|
padding: const EdgeInsets.fromLTRB(24, 0, 24, 10),
|
||||||
child: Text(
|
child: Text(
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
AppLocalizations.of(context)!.menu,
|
AppLocalizations.of(context).menu,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 28,
|
fontSize: 28,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -43,7 +43,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
AppLocalizations.of(context)!.settings,
|
AppLocalizations.of(context).settings,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -51,7 +51,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
title: AppLocalizations.of(context)!.export_data,
|
title: AppLocalizations.of(context).export_data,
|
||||||
icon: Icons.upload_outlined,
|
icon: Icons.upload_outlined,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
@@ -66,7 +66,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
title: AppLocalizations.of(context)!.import_data,
|
title: AppLocalizations.of(context).import_data,
|
||||||
icon: Icons.download_outlined,
|
icon: Icons.download_outlined,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
@@ -78,7 +78,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
title: AppLocalizations.of(context)!.delete_all_data,
|
title: AppLocalizations.of(context).delete_all_data,
|
||||||
icon: Icons.download_outlined,
|
icon: Icons.download_outlined,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -86,19 +86,19 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)!.delete_all_data,
|
AppLocalizations.of(context).delete_all_data,
|
||||||
),
|
),
|
||||||
content: Text(
|
content: Text(
|
||||||
AppLocalizations.of(context)!.this_cannot_be_undone,
|
AppLocalizations.of(context).this_cannot_be_undone,
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
child: Text(AppLocalizations.of(context)!.cancel),
|
child: Text(AppLocalizations.of(context).cancel),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
child: Text(AppLocalizations.of(context)!.delete),
|
child: Text(AppLocalizations.of(context).delete),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -134,32 +134,32 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
case ImportResult.success:
|
case ImportResult.success:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.data_successfully_imported,
|
message: AppLocalizations.of(context).data_successfully_imported,
|
||||||
);
|
);
|
||||||
case ImportResult.invalidSchema:
|
case ImportResult.invalidSchema:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.invalid_schema,
|
message: AppLocalizations.of(context).invalid_schema,
|
||||||
);
|
);
|
||||||
case ImportResult.fileReadError:
|
case ImportResult.fileReadError:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.error_reading_file,
|
message: AppLocalizations.of(context).error_reading_file,
|
||||||
);
|
);
|
||||||
case ImportResult.canceled:
|
case ImportResult.canceled:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.import_canceled,
|
message: AppLocalizations.of(context).import_canceled,
|
||||||
);
|
);
|
||||||
case ImportResult.formatException:
|
case ImportResult.formatException:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.format_exception,
|
message: AppLocalizations.of(context).format_exception,
|
||||||
);
|
);
|
||||||
case ImportResult.unknownException:
|
case ImportResult.unknownException:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.unknown_exception,
|
message: AppLocalizations.of(context).unknown_exception,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,17 +176,17 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
case ExportResult.success:
|
case ExportResult.success:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.data_successfully_exported,
|
message: AppLocalizations.of(context).data_successfully_exported,
|
||||||
);
|
);
|
||||||
case ExportResult.canceled:
|
case ExportResult.canceled:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.export_canceled,
|
message: AppLocalizations.of(context).export_canceled,
|
||||||
);
|
);
|
||||||
case ExportResult.unknownException:
|
case ExportResult.unknownException:
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context: context,
|
context: context,
|
||||||
message: AppLocalizations.of(context)!.unknown_exception,
|
message: AppLocalizations.of(context).unknown_exception,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
duration: duration,
|
duration: duration,
|
||||||
action: action != null
|
action: action != null
|
||||||
? SnackBarAction(
|
? SnackBarAction(
|
||||||
label: AppLocalizations.of(context)!.undo,
|
label: AppLocalizations.of(context).undo,
|
||||||
onPressed: action,
|
onPressed: action,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
children: [
|
children: [
|
||||||
StatisticsTile(
|
StatisticsTile(
|
||||||
icon: Icons.sports_score,
|
icon: Icons.sports_score,
|
||||||
title: AppLocalizations.of(context)!.wins,
|
title: AppLocalizations.of(context).wins,
|
||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: winCounts,
|
values: winCounts,
|
||||||
itemCount: 3,
|
itemCount: 3,
|
||||||
@@ -78,7 +78,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
SizedBox(height: constraints.maxHeight * 0.02),
|
SizedBox(height: constraints.maxHeight * 0.02),
|
||||||
StatisticsTile(
|
StatisticsTile(
|
||||||
icon: Icons.percent,
|
icon: Icons.percent,
|
||||||
title: AppLocalizations.of(context)!.winrate,
|
title: AppLocalizations.of(context).winrate,
|
||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: winRates,
|
values: winRates,
|
||||||
itemCount: 5,
|
itemCount: 5,
|
||||||
@@ -99,7 +99,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
),
|
),
|
||||||
child: TopCenteredMessage(
|
child: TopCenteredMessage(
|
||||||
icon: Icons.info,
|
icon: Icons.info,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: AppLocalizations.of(
|
message: AppLocalizations.of(
|
||||||
context,
|
context,
|
||||||
)!.no_statistics_available,
|
)!.no_statistics_available,
|
||||||
@@ -154,7 +154,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
(p) => p.id == playerId,
|
(p) => p.id == playerId,
|
||||||
orElse: () => Player(
|
orElse: () => Player(
|
||||||
id: playerId,
|
id: playerId,
|
||||||
name: AppLocalizations.of(context)!.not_available,
|
name: AppLocalizations.of(context).not_available,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
winCounts[i] = (player.name, winCounts[i].$2);
|
winCounts[i] = (player.name, winCounts[i].$2);
|
||||||
@@ -219,7 +219,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
(p) => p.id == playerId,
|
(p) => p.id == playerId,
|
||||||
orElse: () => Player(
|
orElse: () => Player(
|
||||||
id: playerId,
|
id: playerId,
|
||||||
name: AppLocalizations.of(context)!.not_available,
|
name: AppLocalizations.of(context).not_available,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
matchCounts[i] = (player.name, matchCounts[i].$2);
|
matchCounts[i] = (player.name, matchCounts[i].$2);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
CustomSearchBar(
|
CustomSearchBar(
|
||||||
controller: _searchBarController,
|
controller: _searchBarController,
|
||||||
constraints: const BoxConstraints(maxHeight: 45, minHeight: 45),
|
constraints: const BoxConstraints(maxHeight: 45, minHeight: 45),
|
||||||
hintText: AppLocalizations.of(context)!.search_for_players,
|
hintText: AppLocalizations.of(context).search_for_players,
|
||||||
trailingButtonShown: true,
|
trailingButtonShown: true,
|
||||||
trailingButtonicon: Icons.add_circle,
|
trailingButtonicon: Icons.add_circle,
|
||||||
trailingButtonEnabled: _searchBarController.text.trim().isNotEmpty,
|
trailingButtonEnabled: _searchBarController.text.trim().isNotEmpty,
|
||||||
@@ -141,7 +141,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
child: selectedPlayers.isEmpty
|
child: selectedPlayers.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context)!.no_players_selected,
|
AppLocalizations.of(context).no_players_selected,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: SingleChildScrollView(
|
: SingleChildScrollView(
|
||||||
@@ -185,7 +185,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context)!.all_players,
|
AppLocalizations.of(context).all_players,
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
@@ -199,11 +199,11 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
visible: suggestedPlayers.isNotEmpty,
|
visible: suggestedPlayers.isNotEmpty,
|
||||||
replacement: TopCenteredMessage(
|
replacement: TopCenteredMessage(
|
||||||
icon: Icons.info,
|
icon: Icons.info,
|
||||||
title: AppLocalizations.of(context)!.info,
|
title: AppLocalizations.of(context).info,
|
||||||
message: allPlayers.isEmpty
|
message: allPlayers.isEmpty
|
||||||
? AppLocalizations.of(context)!.no_players_created_yet
|
? AppLocalizations.of(context).no_players_created_yet
|
||||||
: (selectedPlayers.length == allPlayers.length)
|
: (selectedPlayers.length == allPlayers.length)
|
||||||
? AppLocalizations.of(context)!.all_players_selected
|
? AppLocalizations.of(context).all_players_selected
|
||||||
: AppLocalizations.of(
|
: AppLocalizations.of(
|
||||||
context,
|
context,
|
||||||
)!.no_players_found_with_that_name,
|
)!.no_players_found_with_that_name,
|
||||||
@@ -276,7 +276,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
backgroundColor: CustomTheme.boxColor,
|
backgroundColor: CustomTheme.boxColor,
|
||||||
content: Center(
|
content: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context)!.could_not_add_player(playerName),
|
AppLocalizations.of(context).could_not_add_player(playerName),
|
||||||
style: const TextStyle(color: Colors.white),
|
style: const TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context)!.winner(winner.name),
|
AppLocalizations.of(context).winner(winner.name),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -115,7 +115,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
|
|
||||||
if (allPlayers.isNotEmpty) ...[
|
if (allPlayers.isNotEmpty) ...[
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context)!.players,
|
AppLocalizations.of(context).players,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
@@ -150,7 +150,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
context,
|
context,
|
||||||
)!.yesterday_at(DateFormat('HH:mm').format(dateTime));
|
)!.yesterday_at(DateFormat('HH:mm').format(dateTime));
|
||||||
} else if (difference.inDays < 7) {
|
} else if (difference.inDays < 7) {
|
||||||
return AppLocalizations.of(context)!.days_ago(difference.inDays);
|
return AppLocalizations.of(context).days_ago(difference.inDays);
|
||||||
} else {
|
} else {
|
||||||
return DateFormat('MMM d, yyyy').format(dateTime);
|
return DateFormat('MMM d, yyyy').format(dateTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
visible: values.isNotEmpty,
|
visible: values.isNotEmpty,
|
||||||
replacement: Center(
|
replacement: Center(
|
||||||
heightFactor: 4,
|
heightFactor: 4,
|
||||||
child: Text(AppLocalizations.of(context)!.no_data_available),
|
child: Text(AppLocalizations.of(context).no_data_available),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: List.generate(min(values.length, itemCount), (index) {
|
children: List.generate(min(values.length, itemCount), (index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user