Merge remote-tracking branch 'origin/development' into feature/100-lokalisierung-hinzufügen
# Conflicts: # lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart # lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart # lib/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart
This commit is contained in:
@@ -48,42 +48,53 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: PopScope(
|
||||||
children: [
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
Padding(
|
// selectedGameIndex and therefore the selected Game wasn't saved
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
canPop: false,
|
||||||
child: CustomSearchBar(
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
controller: searchBarController,
|
if (didPop) {
|
||||||
hintText: AppLocalizations.of(context).game_name,
|
return;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop(selectedGameIndex);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: CustomSearchBar(
|
||||||
|
controller: searchBarController,
|
||||||
|
hintText: AppLocalizations.of(context).game_name,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
const SizedBox(height: 5),
|
Expanded(
|
||||||
Expanded(
|
child: ListView.builder(
|
||||||
child: ListView.builder(
|
itemCount: widget.games.length,
|
||||||
itemCount: widget.games.length,
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
return TitleDescriptionListTile(
|
||||||
return TitleDescriptionListTile(
|
title: widget.games[index].$1,
|
||||||
title: widget.games[index].$1,
|
description: widget.games[index].$2,
|
||||||
description: widget.games[index].$2,
|
badgeText: translateRulesetToString(
|
||||||
badgeText: translateRulesetToString(
|
|
||||||
widget.games[index].$3,
|
widget.games[index].$3,
|
||||||
context,
|
context,
|
||||||
),
|
),
|
||||||
isHighlighted: selectedGameIndex == index,
|
isHighlighted: selectedGameIndex == index,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (selectedGameIndex == index) {
|
if (selectedGameIndex == index) {
|
||||||
selectedGameIndex = -1;
|
selectedGameIndex = -1;
|
||||||
} else {
|
} else {
|
||||||
selectedGameIndex = index;
|
selectedGameIndex = index;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,63 +57,80 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: PopScope(
|
||||||
children: [
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
Padding(
|
// selectedGroupId and therefore the selected Group wasn't saved
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
canPop: false,
|
||||||
child: CustomSearchBar(
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
controller: controller,
|
if (didPop) {
|
||||||
hintText: AppLocalizations.of(context).search_for_groups,
|
return;
|
||||||
onChanged: (value) {
|
}
|
||||||
setState(() {
|
Navigator.of(context).pop(
|
||||||
filterGroups(value);
|
selectedGroupId == ''
|
||||||
});
|
? null
|
||||||
},
|
: widget.groups.firstWhere(
|
||||||
),
|
(group) => group.id == selectedGroupId,
|
||||||
),
|
),
|
||||||
Expanded(
|
);
|
||||||
child: Visibility(
|
},
|
||||||
visible: filteredGroups.isNotEmpty,
|
child: Column(
|
||||||
replacement: Visibility(
|
children: [
|
||||||
visible: widget.groups.isNotEmpty,
|
Padding(
|
||||||
replacement: TopCenteredMessage(
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
icon: Icons.info,
|
child: CustomSearchBar(
|
||||||
title: AppLocalizations.of(context).info,
|
controller: controller,
|
||||||
message: AppLocalizations.of(context).no_groups_created_yet,
|
hintText: AppLocalizations.of(context).search_for_groups,
|
||||||
),
|
onChanged: (value) {
|
||||||
child: TopCenteredMessage(
|
setState(() {
|
||||||
icon: Icons.info,
|
filterGroups(value);
|
||||||
title: AppLocalizations.of(context).info,
|
});
|
||||||
message: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).there_is_no_group_matching_your_search,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
|
||||||
itemCount: filteredGroups.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
if (selectedGroupId != filteredGroups[index].id) {
|
|
||||||
selectedGroupId = filteredGroups[index].id;
|
|
||||||
} else {
|
|
||||||
selectedGroupId = '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: GroupTile(
|
|
||||||
group: filteredGroups[index],
|
|
||||||
isHighlighted:
|
|
||||||
selectedGroupId == filteredGroups[index].id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
],
|
child: Visibility(
|
||||||
|
visible: filteredGroups.isNotEmpty,
|
||||||
|
replacement: Visibility(
|
||||||
|
visible: widget.groups.isNotEmpty,
|
||||||
|
replacement: TopCenteredMessage(
|
||||||
|
icon: Icons.info,
|
||||||
|
title: AppLocalizations.of(context).info,
|
||||||
|
message: AppLocalizations.of(context).no_groups_created_yet,
|
||||||
|
),
|
||||||
|
child: TopCenteredMessage(
|
||||||
|
icon: Icons.info,
|
||||||
|
title: AppLocalizations.of(context).info,
|
||||||
|
message: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
).there_is_no_group_matching_your_search,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsets.only(bottom: 85),
|
||||||
|
itemCount: filteredGroups.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (selectedGroupId != filteredGroups[index].id) {
|
||||||
|
selectedGroupId = filteredGroups[index].id;
|
||||||
|
} else {
|
||||||
|
selectedGroupId = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: GroupTile(
|
||||||
|
group: filteredGroups[index],
|
||||||
|
isHighlighted:
|
||||||
|
selectedGroupId == filteredGroups[index].id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,28 +53,43 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
body: PopScope(
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
itemCount: widget.rulesets.length,
|
// selectedRulesetIndex and therefore the selected Ruleset wasn't saved
|
||||||
itemBuilder: (BuildContext context, int index) {
|
canPop: false,
|
||||||
return TitleDescriptionListTile(
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
onPressed: () async {
|
if (didPop) {
|
||||||
setState(() {
|
return;
|
||||||
if (selectedRulesetIndex == index) {
|
}
|
||||||
selectedRulesetIndex = -1;
|
Navigator.of(context).pop(
|
||||||
} else {
|
selectedRulesetIndex == -1
|
||||||
selectedRulesetIndex = index;
|
? null
|
||||||
}
|
: widget.rulesets[selectedRulesetIndex].$1,
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
title: translateRulesetToString(
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsets.only(bottom: 85),
|
||||||
|
itemCount: widget.rulesets.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return TitleDescriptionListTile(
|
||||||
|
onPressed: () async {
|
||||||
|
setState(() {
|
||||||
|
if (selectedRulesetIndex == index) {
|
||||||
|
selectedRulesetIndex = -1;
|
||||||
|
} else {
|
||||||
|
selectedRulesetIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
title: translateRulesetToString(
|
||||||
widget.rulesets[index].$1,
|
widget.rulesets[index].$1,
|
||||||
context,
|
context,
|
||||||
),
|
),
|
||||||
description: widget.rulesets[index].$2,
|
description: widget.rulesets[index].$2,
|
||||||
isHighlighted: selectedRulesetIndex == index,
|
isHighlighted: selectedRulesetIndex == index,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user