format with dart format
This commit is contained in:
@@ -35,10 +35,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text(
|
title: Text(
|
||||||
_currentTabTitle(),
|
_currentTabTitle(),
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
@@ -114,6 +111,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String _currentTabTitle() {
|
String _currentTabTitle() {
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -128,4 +126,4 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
late List<Map<String, dynamic>> suggestedGameData;
|
late List<Map<String, dynamic>> suggestedGameData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -134,9 +134,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(margin: EdgeInsets.only(bottom: 75)),
|
||||||
margin: EdgeInsets.only(bottom: 75),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: gameHistoryListView(allGameData, suggestedGameData),
|
child: gameHistoryListView(allGameData, suggestedGameData),
|
||||||
),
|
),
|
||||||
@@ -146,7 +144,7 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
margin: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
|
margin: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
leading: Icon(Icons.search),
|
leading: Icon(Icons.search),
|
||||||
onChanged:(value) {
|
onChanged: (value) {
|
||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
suggestedGameData.clear();
|
suggestedGameData.clear();
|
||||||
@@ -155,9 +153,15 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final suggestions = allGameData.where((currentGame) {
|
final suggestions = allGameData.where((currentGame) {
|
||||||
return currentGame['game'].toString().toLowerCase().contains(value.toLowerCase()) ||
|
return currentGame['game'].toString().toLowerCase().contains(
|
||||||
currentGame['title'].toString().toLowerCase().contains(value.toLowerCase()) ||
|
value.toLowerCase(),
|
||||||
currentGame['group'].toString().toLowerCase().contains(value.toLowerCase());
|
) ||
|
||||||
|
currentGame['title'].toString().toLowerCase().contains(
|
||||||
|
value.toLowerCase(),
|
||||||
|
) ||
|
||||||
|
currentGame['group'].toString().toLowerCase().contains(
|
||||||
|
value.toLowerCase(),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
setState(() {
|
setState(() {
|
||||||
suggestedGameData.clear();
|
suggestedGameData.clear();
|
||||||
@@ -179,10 +183,10 @@ Widget gameHistoryListView(allGameData, suggestedGameData) {
|
|||||||
return TopCenteredMessage("Kein Spiel mit den Suchparametern gefunden.");
|
return TopCenteredMessage("Kein Spiel mit den Suchparametern gefunden.");
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: suggestedGameData.length,
|
itemCount: suggestedGameData.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final currentGame = suggestedGameData[index];
|
final currentGame = suggestedGameData[index];
|
||||||
return GameHistoryListTile(currentGame);
|
return GameHistoryListTile(currentGame);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,35 @@
|
|||||||
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';
|
||||||
|
|
||||||
Widget GameHistoryListTile(Map<String, dynamic> currentGame){
|
Widget GameHistoryListTile(Map<String, dynamic> currentGame) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
|
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
color: CustomTheme.secondaryColor,
|
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(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text("${currentGame['game']}: ", style: TextStyle(fontSize: 20)),
|
Text("${currentGame['group']}", style: TextStyle(fontSize: 20)),
|
||||||
Text("${currentGame['title']}", style: TextStyle(fontSize: 20)),
|
Spacer(),
|
||||||
Spacer(),
|
Text("${currentGame['date']}", style: TextStyle(fontSize: 20)),
|
||||||
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))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
Widget TopCenteredMessage(String message) {
|
Widget TopCenteredMessage(String message) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(top:100),
|
padding: EdgeInsets.only(top: 100),
|
||||||
margin: EdgeInsets.only(left: 10, right: 10),
|
margin: EdgeInsets.only(left: 10, right: 10),
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Text(
|
child: Text(
|
||||||
"$message",
|
"$message",
|
||||||
style: TextStyle(fontSize: 20),
|
style: TextStyle(fontSize: 20),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user