Merge branch 'main' of gitea.dsv.su.se:gupr9513/smilet

This commit is contained in:
Jonathan Belloni 2024-05-15 14:07:09 +02:00
commit 3b3f7bfeeb

@ -28,6 +28,10 @@ class _LeaderMainState extends State<LeaderMain> with TickerProviderStateMixin {
//final _formKey = GlobalKey<FormState>();
late final TabController _tabController;
late final List<int> placement = <int>[1, 2, 3, 4, 5];
late final List<String> entries = <String>['Etta', 'Tvåa', 'Trea', 'Fyra', 'Femma'];
late final List<int> time = <int>[42, 46, 49, 53, 57];
@override
void initState() {
super.initState();
@ -42,8 +46,8 @@ class _LeaderMainState extends State<LeaderMain> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
const textHeadStyle =
TextStyle(fontSize: 40.0, fontWeight: FontWeight.bold);
// const textHeadStyle =
// TextStyle(fontSize: 40.0, fontWeight: FontWeight.bold);
const textRunnersStyle =
TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold);
const textH2Style = TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold);
@ -73,495 +77,74 @@ class _LeaderMainState extends State<LeaderMain> with TickerProviderStateMixin {
),
]),
),
// Form för att kunna använda TextFormField
body: TabBarView(
controller: _tabController,
children: const <Widget>[
children: <Widget>[
//Tab 1
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Five K',
style: textHeadStyle,
),
//implementera att användare hämtas och alla fälten fylls
//från användardata.
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'',
style: textH2Style,
),
),
Expanded(
child: Text(
'Namn',
style: textH2Style,
),
),
Expanded(
child: Text(
'Tid',
style: textH2Style,
),
),
Expanded(
child: Text(
'Poäng',
style: textH2Style,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'1:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Den som leder',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:00:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'100',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'2:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Runnerup',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:15:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'75',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'3:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Tredje plats',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:30:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'50',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'4:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Fjärde',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:45:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'25',
style: textRunnersStyle,
),
),
],
),
],
ListView.separated(
padding: const EdgeInsets.all(8),
itemCount: entries.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.all(8),
height: 50,
color: Colors.amber,
child: Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(child: Text('${placement[index]}', style: textH2Style,),),
Expanded(child: Text('${entries[index]}', style: textRunnersStyle,),),
Expanded(child: Text('${time[index]}', style: textRunnersStyle,),),
],
),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(),
),
//Tab2
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Milen',
style: textHeadStyle,
),
//implementera att användare hämtas och alla fälten fylls
//från användardata.
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'',
style: textH2Style,
),
),
Expanded(
child: Text(
'Namn',
style: textH2Style,
),
),
Expanded(
child: Text(
'Tid',
style: textH2Style,
),
),
Expanded(
child: Text(
'Poäng',
style: textH2Style,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'1:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Den som leder',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:00:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'100',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'2:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Runnerup',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:15:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'75',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'3:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Tredje plats',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:30:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'50',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'4:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Fjärde',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:45:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'25',
style: textRunnersStyle,
),
),
],
),
],
//Tab 2
ListView.separated(
padding: const EdgeInsets.all(8),
itemCount: entries.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.all(8),
height: 50,
color: Colors.green,
child: Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(child: Text('${placement[index]}', style: textH2Style,),),
Expanded(child: Text('${entries[index]}', style: textRunnersStyle,),),
Expanded(child: Text('${time[index]}', style: textRunnersStyle,),),
],
),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(),
),
//Tab 3
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Enskilda Löpare',
style: textHeadStyle,
),
//implementera att användare hämtas och alla fälten fylls
//från användardata.
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'',
style: textH2Style,
),
),
Expanded(
child: Text(
'Namn',
style: textH2Style,
),
),
Expanded(
child: Text(
'Tid',
style: textH2Style,
),
),
Expanded(
child: Text(
'Poäng',
style: textH2Style,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'1:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Den som leder',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:00:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'100',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'2:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Runnerup',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:15:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'75',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'3:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Tredje plats',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:30:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'50',
style: textRunnersStyle,
),
),
],
),
Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(
child: Text(
'4:',
textAlign: TextAlign.center,
style: textH2Style,
),
),
Expanded(
child: Text(
'Fjärde',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'1:45:00',
style: textRunnersStyle,
),
),
Expanded(
child: Text(
'25',
style: textRunnersStyle,
),
),
],
),
],
)
ListView.separated(
padding: const EdgeInsets.all(8),
itemCount: entries.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.all(8),
height: 50,
color: Colors.purple,
child: Row(
textDirection: TextDirection.ltr,
children: <Widget>[
Expanded(child: Text('${placement[index]}', style: textH2Style,),),
Expanded(child: Text('${entries[index]}', style: textRunnersStyle,),),
Expanded(child: Text('${time[index]}', style: textRunnersStyle,),),
],
),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(),
),
],
),
bottomNavigationBar: BottomAppBar(