change theme color and add new page to dashboard

This commit is contained in:
Mikkel Troels Kongsted 2025-02-07 10:36:37 +01:00
parent caa33d0a7d
commit 55b87419be
5 changed files with 38 additions and 14 deletions

View File

@ -33,7 +33,8 @@ class MyApp extends StatelessWidget {
child: MaterialApp( child: MaterialApp(
title: 'Fresh Plaza', title: 'Fresh Plaza',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 149, 92, 255)),
scaffoldBackgroundColor: const Color(0xFFFAFAFF), scaffoldBackgroundColor: const Color(0xFFFAFAFF),
textTheme: const TextTheme( textTheme: const TextTheme(
headlineLarge: TextStyle(color: Color(0xFF000000), fontSize: 64), headlineLarge: TextStyle(color: Color(0xFF000000), fontSize: 64),

View File

@ -2,12 +2,14 @@ import 'package:flutter/material.dart';
import 'package:mobile/pages/all_products_page.dart'; import 'package:mobile/pages/all_products_page.dart';
import 'package:mobile/pages/cart_page.dart'; import 'package:mobile/pages/cart_page.dart';
import 'package:mobile/pages/all_receipts_page.dart'; import 'package:mobile/pages/all_receipts_page.dart';
import 'package:mobile/pages/home_page.dart';
import 'package:mobile/repos/bottom_navigation_bar.dart'; import 'package:mobile/repos/bottom_navigation_bar.dart';
import 'package:mobile/repos/cart.dart'; import 'package:mobile/repos/cart.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class Dashboard extends StatelessWidget { class Dashboard extends StatelessWidget {
final List<StatelessWidget> pages = [ final List<StatelessWidget> pages = [
const HomePage(),
const AllProductsPage(), const AllProductsPage(),
const CartPage(), const CartPage(),
const AllReceiptsPage(), const AllReceiptsPage(),
@ -23,6 +25,7 @@ class Dashboard extends StatelessWidget {
return Scaffold( return Scaffold(
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
onTap: (index) => pageIndexProvider.setIndex(index), onTap: (index) => pageIndexProvider.setIndex(index),
currentIndex: currentIndex, currentIndex: currentIndex,
items: <BottomNavigationBarItem>[ items: <BottomNavigationBarItem>[
@ -30,15 +33,24 @@ class Dashboard extends StatelessWidget {
icon: Icon(currentIndex == 0 ? Icons.home : Icons.home_outlined), icon: Icon(currentIndex == 0 ? Icons.home : Icons.home_outlined),
label: "Home"), label: "Home"),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Badge.count( icon: Icon(
count: cartRepo.totalItemsInCart(), currentIndex == 1 ? Icons.search : Icons.search_outlined),
child: Icon(currentIndex == 1 label: "Products"),
? Icons.shopping_cart BottomNavigationBarItem(
: Icons.shopping_cart_outlined), icon: cartRepo.totalItemsInCart() == 0
), ? Icon(currentIndex == 2
? Icons.shopping_cart
: Icons.shopping_cart_outlined)
: Badge.count(
backgroundColor: Theme.of(context).primaryColor,
count: cartRepo.totalItemsInCart(),
child: Icon(currentIndex == 2
? Icons.shopping_cart
: Icons.shopping_cart_outlined),
),
label: "Cart"), label: "Cart"),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(currentIndex == 2 icon: Icon(currentIndex == 3
? Icons.receipt_long ? Icons.receipt_long
: Icons.receipt_long_outlined), : Icons.receipt_long_outlined),
label: "Receipts") label: "Receipts")

View File

@ -83,12 +83,12 @@ class FinishShoppingPage extends StatelessWidget {
color: Colors.white, color: Colors.white,
), ),
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: const SizedBox( child: SizedBox(
width: 50, width: 50,
height: 50, height: 50,
child: CircularProgressIndicator( child: CircularProgressIndicator(
valueColor: valueColor: AlwaysStoppedAnimation<Color>(
AlwaysStoppedAnimation<Color>(Colors.blue), Theme.of(context).primaryColor),
strokeWidth: 6.0, strokeWidth: 6.0,
), ),
), ),
@ -101,9 +101,9 @@ class FinishShoppingPage extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.white, color: Colors.white,
), ),
child: const Icon( child: Icon(
Icons.check_rounded, Icons.check_rounded,
color: Colors.blue, color: Theme.of(context).primaryColor,
size: 70, size: 70,
), ),
) )

View File

@ -0,0 +1,10 @@
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return const Column();
}
}

View File

@ -15,7 +15,8 @@ class PrimaryButton extends StatelessWidget {
return TextButton( return TextButton(
onPressed: onPressed, onPressed: onPressed,
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: Colors.blue, foregroundColor: Colors.white), backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Colors.white),
child: child); child: child);
} }
} }