Compare commits
3 Commits
236a737fd1
...
b4ccb567b5
| Author | SHA1 | Date | |
|---|---|---|---|
| b4ccb567b5 | |||
| bcd7bf751b | |||
| 4dbc106e38 |
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/core/enums.dart';
|
import 'package:game_tracker/core/enums.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/text_input/custom_search_bar.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/title_description_list_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/title_description_list_tile.dart';
|
||||||
|
|
||||||
class ChooseGameView extends StatefulWidget {
|
class ChooseGameView extends StatefulWidget {
|
||||||
@@ -19,6 +20,7 @@ class ChooseGameView extends StatefulWidget {
|
|||||||
|
|
||||||
class _ChooseGameViewState extends State<ChooseGameView> {
|
class _ChooseGameViewState extends State<ChooseGameView> {
|
||||||
late int selectedGameIndex;
|
late int selectedGameIndex;
|
||||||
|
final TextEditingController searchBarController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -39,26 +41,36 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
body: Column(
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
children: [
|
||||||
itemCount: widget.games.length,
|
CustomSearchBar(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
controller: searchBarController,
|
||||||
return TitleDescriptionListTile(
|
hintText: 'Game Name',
|
||||||
title: widget.games[index].$1,
|
),
|
||||||
description: widget.games[index].$2,
|
const SizedBox(height: 5),
|
||||||
badgeText: translateRulesetToString(widget.games[index].$3),
|
Expanded(
|
||||||
isHighlighted: selectedGameIndex == index,
|
child: ListView.builder(
|
||||||
onPressed: () async {
|
itemCount: widget.games.length,
|
||||||
setState(() {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
selectedGameIndex = index;
|
return TitleDescriptionListTile(
|
||||||
});
|
title: widget.games[index].$1,
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
description: widget.games[index].$2,
|
||||||
if (!context.mounted) return;
|
badgeText: translateRulesetToString(widget.games[index].$3),
|
||||||
Navigator.of(context).pop(selectedGameIndex);
|
isHighlighted: selectedGameIndex == index,
|
||||||
});
|
onPressed: () async {
|
||||||
},
|
setState(() {
|
||||||
);
|
selectedGameIndex = index;
|
||||||
},
|
});
|
||||||
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
Navigator.of(context).pop(selectedGameIndex);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
|
|
||||||
/// List of available rulesets with their display names and descriptions
|
/// List of available rulesets with their display names and descriptions
|
||||||
/// as tuples of (Ruleset, String, String)
|
/// as tuples of (Ruleset, String, String)
|
||||||
|
/// TODO: Replace when rulesets are implemented
|
||||||
List<(Ruleset, String, String)> rulesets = [
|
List<(Ruleset, String, String)> rulesets = [
|
||||||
(
|
(
|
||||||
Ruleset.singleWinner,
|
Ruleset.singleWinner,
|
||||||
@@ -84,9 +85,10 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// TODO: Replace when games are implemented
|
||||||
List<(String, String, Ruleset)> games = [
|
List<(String, String, Ruleset)> games = [
|
||||||
('Cabo', 'A memory card game', Ruleset.leastPoints),
|
('Example Game 1', 'This is a discription', Ruleset.leastPoints),
|
||||||
('Uno', 'The Classic', Ruleset.singleWinner),
|
('Example Game 2', '', Ruleset.singleWinner),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class TitleDescriptionListTile extends StatelessWidget {
|
|||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -70,9 +70,11 @@ class TitleDescriptionListTile extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
if (description.isNotEmpty) ...[
|
||||||
Text(description, style: const TextStyle(fontSize: 14)),
|
const SizedBox(height: 5),
|
||||||
const SizedBox(height: 2.5),
|
Text(description, style: const TextStyle(fontSize: 14)),
|
||||||
|
const SizedBox(height: 2.5),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user