Merge remote-tracking branch 'origin/development' into feature/100-lokalisierung-hinzufügen
# Conflicts: # lib/presentation/views/main_menu/home_view.dart # lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart # lib/presentation/views/main_menu/match_view/match_view.dart
This commit is contained in:
@@ -32,6 +32,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
/// Controller for the match name input field
|
||||
final TextEditingController _matchNameController = TextEditingController();
|
||||
|
||||
/// Hint text for the match name input field
|
||||
String hintText = 'Match Name';
|
||||
|
||||
/// List of all groups from the database
|
||||
List<Group> groupsList = [];
|
||||
|
||||
@@ -132,7 +135,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||
child: TextInputField(
|
||||
controller: _matchNameController,
|
||||
hintText: AppLocalizations.of(context)!.match_name,
|
||||
hintText: hintText,
|
||||
),
|
||||
),
|
||||
ChooseTile(
|
||||
@@ -151,11 +154,13 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
);
|
||||
setState(() {
|
||||
if (selectedGameIndex != -1) {
|
||||
hintText = games[selectedGameIndex].$1;
|
||||
selectedRuleset = games[selectedGameIndex].$3;
|
||||
selectedRulesetIndex = _getRulesets(
|
||||
context,
|
||||
).indexWhere((r) => r.$1 == selectedRuleset);
|
||||
} else {
|
||||
hintText = 'Match Name';
|
||||
selectedRuleset = null;
|
||||
}
|
||||
});
|
||||
@@ -230,7 +235,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
onPressed: _enableCreateGameButton()
|
||||
? () async {
|
||||
Match match = Match(
|
||||
name: _matchNameController.text.trim(),
|
||||
name: _matchNameController.text.isEmpty
|
||||
? hintText
|
||||
: _matchNameController.text.trim(),
|
||||
createdAt: DateTime.now(),
|
||||
group: selectedGroup,
|
||||
players: selectedPlayers,
|
||||
@@ -260,9 +267,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
/// Determines whether the "Create Game" button should be enabled based on
|
||||
/// the current state of the input fields.
|
||||
bool _enableCreateGameButton() {
|
||||
return _matchNameController.text.isNotEmpty &&
|
||||
(selectedGroup != null ||
|
||||
(selectedPlayers != null && selectedPlayers!.length > 1)) &&
|
||||
selectedRuleset != null;
|
||||
return selectedGroup != null ||
|
||||
(selectedPlayers != null && selectedPlayers!.length > 1) &&
|
||||
selectedRuleset != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user