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:game_tracker/core/custom_theme.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';
class ChooseGameView extends StatefulWidget {
@@ -19,6 +20,7 @@ class ChooseGameView extends StatefulWidget {
class _ChooseGameViewState extends State<ChooseGameView> {
late int selectedGameIndex;
final TextEditingController searchBarController = TextEditingController();
@override
void initState() {
@@ -39,8 +41,15 @@ class _ChooseGameViewState extends State<ChooseGameView> {
),
centerTitle: true,
),
body: ListView.builder(
padding: const EdgeInsets.only(bottom: 85),
body: Column(
children: [
CustomSearchBar(
controller: searchBarController,
hintText: 'Game Name',
),
const SizedBox(height: 5),
Expanded(
child: ListView.builder(
itemCount: widget.games.length,
itemBuilder: (BuildContext context, int index) {
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
/// as tuples of (Ruleset, String, String)
/// TODO: Replace when rulesets are implemented
List<(Ruleset, String, String)> rulesets = [
(
Ruleset.singleWinner,
@@ -84,9 +85,10 @@ class _CreateGameViewState extends State<CreateGameView> {
),
];
// TODO: Replace when games are implemented
List<(String, String, Ruleset)> games = [
('Cabo', 'A memory card game', Ruleset.leastPoints),
('Uno', 'The Classic', Ruleset.singleWinner),
('Example Game 1', 'This is a discription', Ruleset.leastPoints),
('Example Game 2', '', Ruleset.singleWinner),
];
@override

View File

@@ -32,7 +32,7 @@ class TitleDescriptionListTile extends StatelessWidget {
duration: const Duration(milliseconds: 200),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -70,10 +70,12 @@ class TitleDescriptionListTile extends StatelessWidget {
],
],
),
if (description.isNotEmpty) ...[
const SizedBox(height: 5),
Text(description, style: const TextStyle(fontSize: 14)),
const SizedBox(height: 2.5),
],
],
),
),
);