adjusted team creation
This commit is contained in:
@@ -572,6 +572,12 @@ abstract class AppLocalizations {
|
||||
/// **'Matches'**
|
||||
String get matches;
|
||||
|
||||
/// No description provided for @member.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Member'**
|
||||
String get member;
|
||||
|
||||
/// No description provided for @members.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -261,6 +261,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get matches => 'Spiele';
|
||||
|
||||
@override
|
||||
String get member => 'Mitglied';
|
||||
|
||||
@override
|
||||
String get members => 'Mitglieder';
|
||||
|
||||
|
||||
@@ -261,6 +261,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get matches => 'Matches';
|
||||
|
||||
@override
|
||||
String get member => 'Member';
|
||||
|
||||
@override
|
||||
String get members => 'Members';
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tallee/core/adaptive_page_route.dart';
|
||||
import 'package:tallee/core/common.dart';
|
||||
import 'package:tallee/core/custom_theme.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/models/match.dart';
|
||||
import 'package:tallee/data/models/player.dart';
|
||||
import 'package:tallee/data/models/team.dart';
|
||||
@@ -97,13 +95,12 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
|
||||
// Confirm teams and start match
|
||||
// Confirm teams and continue with member assignment
|
||||
MainMenuButton(
|
||||
icon: Icons.arrow_forward_sharp,
|
||||
onPressed: teams.length >= 2
|
||||
? () async {
|
||||
final match = await createMatchWithTeams();
|
||||
if (context.mounted) {
|
||||
? () {
|
||||
final match = widget.match.copyWith(teams: teams);
|
||||
Navigator.push(
|
||||
context,
|
||||
adaptivePageRoute(
|
||||
@@ -114,7 +111,6 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
@@ -202,14 +198,6 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Saves the teams to the database and returns the updated match with the teams.
|
||||
Future<Match> createMatchWithTeams() async {
|
||||
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||
final match = widget.match.copyWith(teams: teams);
|
||||
await db.matchDao.addMatch(match: match);
|
||||
return match;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
for (final c in nameController) {
|
||||
|
||||
Reference in New Issue
Block a user