format with dart format

This commit is contained in:
2025-06-25 16:39:51 +02:00
parent 0c39f4836e
commit b41821df47
4 changed files with 63 additions and 58 deletions

View File

@@ -35,10 +35,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
centerTitle: true,
title: Text(
_currentTabTitle(),
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
backgroundColor: CustomTheme.backgroundColor,
scrolledUnderElevation: 0,
@@ -114,6 +111,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
currentIndex = index;
});
}
String _currentTabTitle() {
switch (currentIndex) {
case 0:
@@ -128,4 +126,4 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
return '';
}
}
}
}

View File

@@ -119,7 +119,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
},
];
late List<Map<String, dynamic>> suggestedGameData;
@override
void initState() {
super.initState();
@@ -134,9 +134,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
children: [
Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 75),
),
Container(margin: EdgeInsets.only(bottom: 75)),
Expanded(
child: gameHistoryListView(allGameData, suggestedGameData),
),
@@ -146,7 +144,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
margin: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
child: SearchBar(
leading: Icon(Icons.search),
onChanged:(value) {
onChanged: (value) {
if (value.isEmpty) {
setState(() {
suggestedGameData.clear();
@@ -155,9 +153,15 @@ class _GameHistoryViewState extends State<GameHistoryView> {
return;
}
final suggestions = allGameData.where((currentGame) {
return currentGame['game'].toString().toLowerCase().contains(value.toLowerCase()) ||
currentGame['title'].toString().toLowerCase().contains(value.toLowerCase()) ||
currentGame['group'].toString().toLowerCase().contains(value.toLowerCase());
return currentGame['game'].toString().toLowerCase().contains(
value.toLowerCase(),
) ||
currentGame['title'].toString().toLowerCase().contains(
value.toLowerCase(),
) ||
currentGame['group'].toString().toLowerCase().contains(
value.toLowerCase(),
);
});
setState(() {
suggestedGameData.clear();
@@ -179,10 +183,10 @@ Widget gameHistoryListView(allGameData, suggestedGameData) {
return TopCenteredMessage("Kein Spiel mit den Suchparametern gefunden.");
}
return ListView.builder(
itemCount: suggestedGameData.length,
itemBuilder: (context, index) {
final currentGame = suggestedGameData[index];
return GameHistoryListTile(currentGame);
}
);
}
itemCount: suggestedGameData.length,
itemBuilder: (context, index) {
final currentGame = suggestedGameData[index];
return GameHistoryListTile(currentGame);
},
);
}

View File

@@ -1,32 +1,35 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
Widget GameHistoryListTile(Map<String, dynamic> currentGame){
return Container(
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: CustomTheme.secondaryColor,
Widget GameHistoryListTile(Map<String, dynamic> currentGame) {
return Container(
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: CustomTheme.secondaryColor,
),
child: Column(
children: [
Row(
children: [
Text("${currentGame['game']}: ", style: TextStyle(fontSize: 20)),
Text("${currentGame['title']}", style: TextStyle(fontSize: 20)),
Spacer(),
Text(
"${currentGame['players']} Spieler",
style: TextStyle(fontSize: 20),
),
child: Column(
children: [
Row(
children: [
Text("${currentGame['game']}: ", style: TextStyle(fontSize: 20)),
Text("${currentGame['title']}", style: TextStyle(fontSize: 20)),
Spacer(),
Text("${currentGame['players']} Spieler", style: TextStyle(fontSize: 20))
],
),
Row(
children: [
Text("${currentGame['group']}", style: TextStyle(fontSize: 20)),
Spacer(),
Text("${currentGame['date']}", style: TextStyle(fontSize: 20))
],
),
],
),
);
}
],
),
Row(
children: [
Text("${currentGame['group']}", style: TextStyle(fontSize: 20)),
Spacer(),
Text("${currentGame['date']}", style: TextStyle(fontSize: 20)),
],
),
],
),
);
}

View File

@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
Widget TopCenteredMessage(String message) {
return Container(
padding: EdgeInsets.only(top:100),
margin: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.topCenter,
child: Text(
"$message",
style: TextStyle(fontSize: 20),
textAlign: TextAlign.center,
)
);
}
padding: EdgeInsets.only(top: 100),
margin: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.topCenter,
child: Text(
"$message",
style: TextStyle(fontSize: 20),
textAlign: TextAlign.center,
),
);
}