3 Commits

Author SHA1 Message Date
b4ccb567b5 Added conditional description
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m4s
Pull Request Pipeline / lint (pull_request) Successful in 2m4s
2025-11-28 23:15:08 +01:00
bcd7bf751b Added todo & example data 2025-11-28 23:14:29 +01:00
4dbc106e38 Added searchbar 2025-11-28 23:14:13 +01:00
3 changed files with 42 additions and 26 deletions

View File

@@ -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,8 +41,15 @@ class _ChooseGameViewState extends State<ChooseGameView> {
), ),
centerTitle: true, centerTitle: true,
), ),
body: ListView.builder( body: Column(
padding: const EdgeInsets.only(bottom: 85), children: [
CustomSearchBar(
controller: searchBarController,
hintText: 'Game Name',
),
const SizedBox(height: 5),
Expanded(
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(
@@ -60,6 +69,9 @@ class _ChooseGameViewState extends State<ChooseGameView> {
); );
}, },
), ),
),
],
),
); );
} }
} }

View File

@@ -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

View File

@@ -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,10 +70,12 @@ class TitleDescriptionListTile extends StatelessWidget {
], ],
], ],
), ),
if (description.isNotEmpty) ...[
const SizedBox(height: 5), const SizedBox(height: 5),
Text(description, style: const TextStyle(fontSize: 14)), Text(description, style: const TextStyle(fontSize: 14)),
const SizedBox(height: 2.5), const SizedBox(height: 2.5),
], ],
],
), ),
), ),
); );