implemented basic home view

This commit is contained in:
2025-08-02 15:08:09 +02:00
parent 7000429856
commit e1bc0c946f
3 changed files with 173 additions and 5 deletions

View File

@@ -1,10 +1,131 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
import 'package:game_tracker/presentation/widgets/primary_outlined_button.dart';
import 'package:game_tracker/presentation/widgets/primary_container.dart';
class HomeView extends StatelessWidget { class HomeView extends StatefulWidget {
const HomeView({super.key}); const HomeView({super.key});
@override
State<HomeView> createState() => _HomeViewState();
}
class _HomeViewState extends State<HomeView> {
final gameData = <Map<String, String>> [
{
'game': 'Cabo',
'group': 'Bananencrew',
'date': '01.08.2024',
},
{
'game': 'Quixx',
'group': 'Die Anhänger Jesu',
'date': '30.07.2024',
},
{
'game': '6 Nimmt',
'group': 'Säufer',
'date': '28.07.2024',
},
{
'game': 'Uno',
'group': 'Grillraketen',
'date': '25.07.2024',
},
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Center(child: Text('Home View')); return Scaffold(
backgroundColor: CustomTheme.backgroundColor,
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
'Zuletzt verwendete Gruppen',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
PrimaryContainer(
Column(
children: [
Row(
children: [
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[0]['group']}", onPressed: () {}),
),
const SizedBox(width: 8),
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[1]['group']}", onPressed: () {}),
),
],
),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[2]['group']}", onPressed: () {}),
),
const SizedBox(width: 8),
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[3]['group']}", onPressed: () {}),
),
],
),
],
),
),
const SizedBox(height: 24),
const Text(
'Zuletzt gespielte Spiele',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
PrimaryContainer(
Column(
children: [
Row(
children: [
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[0]['game']}", onPressed: () {}),
),
const SizedBox(width: 8),
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[1]['game']}", onPressed: () {}),
),
],
),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[2]['game']}", onPressed: () {}),
),
const SizedBox(width: 8),
Expanded(
child: PrimaryOutlinedButton(text: "${gameData[3]['game']}", onPressed: () {}),
),
],
),
],
),
),
const SizedBox(height: 24),
const Text(
'Lieblingsspiel nicht gefunden?',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
PrimaryContainer(
Center(
child: PrimaryOutlinedButton(text: 'Jetzt vorschlagen', onPressed: () {})
),
),
],
),
),
);
} }
} }

View File

@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
Widget PrimaryContainer(Widget childWidget) {
return Container(
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0),
color: CustomTheme.secondaryColor,
),
child: childWidget,
);
}

View File

@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
Widget PrimaryOutlinedButton({
required String text,
required onPressed,
}) {
return SizedBox(
height: 65,
child: OutlinedButton(
onPressed: onPressed,
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
),
backgroundColor: CustomTheme.primaryColor,
),
child: SizedBox(
width: double.infinity,
child: Text(
text,
textAlign: TextAlign.center,
softWrap: true,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: const TextStyle(
color: Colors.white,
fontSize: 15,
),
),
),
),
);
}