diff --git a/lib/presentation/views/main_menu/home_view.dart b/lib/presentation/views/main_menu/home_view.dart index fb23bc1..675d739 100644 --- a/lib/presentation/views/main_menu/home_view.dart +++ b/lib/presentation/views/main_menu/home_view.dart @@ -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}); @override - Widget build(BuildContext context) { - return const Center(child: Text('Home View')); - } + State createState() => _HomeViewState(); } + +class _HomeViewState extends State { + final gameData = > [ + { + '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 + Widget build(BuildContext context) { + 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: () {}) + ), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/presentation/widgets/primary_container.dart b/lib/presentation/widgets/primary_container.dart new file mode 100644 index 0000000..5af3a07 --- /dev/null +++ b/lib/presentation/widgets/primary_container.dart @@ -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, + ); +} \ No newline at end of file diff --git a/lib/presentation/widgets/primary_outlined_button.dart b/lib/presentation/widgets/primary_outlined_button.dart new file mode 100644 index 0000000..1c87b4a --- /dev/null +++ b/lib/presentation/widgets/primary_outlined_button.dart @@ -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, + ), + ), + ), + ), + ); +} \ No newline at end of file