Some last changes
This commit is contained in:
@@ -29,7 +29,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
|
|
||||||
/// Controller for the match name input field
|
/// Controller for the match name input field
|
||||||
final TextEditingController _gameNameController = TextEditingController();
|
final TextEditingController _matchNameController = TextEditingController();
|
||||||
|
|
||||||
/// List of all groups from the database
|
/// List of all groups from the database
|
||||||
List<Group> groupsList = [];
|
List<Group> groupsList = [];
|
||||||
@@ -95,7 +95,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_gameNameController.addListener(() {
|
_matchNameController.addListener(() {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
title: const Text(
|
title: const Text(
|
||||||
'Create new game',
|
'Create new match',
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -131,7 +131,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||||
child: TextInputField(
|
child: TextInputField(
|
||||||
controller: _gameNameController,
|
controller: _matchNameController,
|
||||||
hintText: 'Match name',
|
hintText: 'Match name',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -222,13 +222,13 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
CustomWidthButton(
|
CustomWidthButton(
|
||||||
text: 'Create game',
|
text: 'Create match',
|
||||||
sizeRelativeToWidth: 0.95,
|
sizeRelativeToWidth: 0.95,
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
onPressed: _enableCreateGameButton()
|
onPressed: _enableCreateGameButton()
|
||||||
? () async {
|
? () async {
|
||||||
Match match = Match(
|
Match match = Match(
|
||||||
name: _gameNameController.text.trim(),
|
name: _matchNameController.text.trim(),
|
||||||
createdAt: DateTime.now(),
|
createdAt: DateTime.now(),
|
||||||
group: selectedGroup,
|
group: selectedGroup,
|
||||||
players: selectedPlayers,
|
players: selectedPlayers,
|
||||||
@@ -258,7 +258,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
/// Determines whether the "Create Game" button should be enabled based on
|
/// Determines whether the "Create Game" button should be enabled based on
|
||||||
/// the current state of the input fields.
|
/// the current state of the input fields.
|
||||||
bool _enableCreateGameButton() {
|
bool _enableCreateGameButton() {
|
||||||
return _gameNameController.text.isNotEmpty &&
|
return _matchNameController.text.isNotEmpty &&
|
||||||
(selectedGroup != null ||
|
(selectedGroup != null ||
|
||||||
(selectedPlayers != null && selectedPlayers!.length > 1)) &&
|
(selectedPlayers != null && selectedPlayers!.length > 1)) &&
|
||||||
selectedRuleset != null;
|
selectedRuleset != null;
|
||||||
|
|||||||
Reference in New Issue
Block a user