From e7727e4461ac7e293e1ef03a944c37bea5410a6c Mon Sep 17 00:00:00 2001 From: Atuoha Date: Wed, 28 Sep 2022 07:09:15 +0100 Subject: [PATCH] task: category screen set up --- lib/views/auth/account_type_selector.dart | 1 - lib/views/main/bottomNav.dart | 2 +- lib/views/main/category.dart | 47 ++++++++++++++++++++++- lib/views/splash/entry.dart | 15 ++++++-- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/lib/views/auth/account_type_selector.dart b/lib/views/auth/account_type_selector.dart index dfe0236..2669337 100644 --- a/lib/views/auth/account_type_selector.dart +++ b/lib/views/auth/account_type_selector.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:multivendor_shop/views/auth/customer_auth.dart'; - import '../../constants/colors.dart'; class AccountTypeSelector extends StatefulWidget { diff --git a/lib/views/main/bottomNav.dart b/lib/views/main/bottomNav.dart index bf6a16c..c0c8104 100644 --- a/lib/views/main/bottomNav.dart +++ b/lib/views/main/bottomNav.dart @@ -60,7 +60,7 @@ class _BottomNavState extends State { icon: Icons.favorite_border, ), TabItem( - icon: Icons.search, + icon: Icons.category_outlined, ), TabItem( icon: Icons.storefront, diff --git a/lib/views/main/category.dart b/lib/views/main/category.dart index 122f9d9..4ec96a2 100644 --- a/lib/views/main/category.dart +++ b/lib/views/main/category.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import '../../constants/colors.dart'; + class CategoryScreen extends StatefulWidget { const CategoryScreen({Key? key}) : super(key: key); @@ -10,6 +12,49 @@ class CategoryScreen extends StatefulWidget { class _CategoryScreenState extends State { @override Widget build(BuildContext context) { - return Container(child: Center(child:Text('Category Screen'))); + Size size = MediaQuery.of(context).size; + + return Padding( + padding: const EdgeInsets.only(top: 48.0), + child: Column( + children: [ + Center( + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: const [ + Icon( + Icons.category, + color: primaryColor, + ), + Text( + 'Categories', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 28, + color: primaryColor, + ), + ), + ], + ), + ), + Row( + children: [ + SizedBox( + width: size.width / 1.25, + height: size.height * 0.83, + ), + Container( + width: size.width / 5, + height: size.height * 0.83, + decoration: BoxDecoration( + color: litePrimary.withOpacity(0.1), + borderRadius: BorderRadius.circular(5), + ), + ), + ], + ) + ], + ), + ); } } diff --git a/lib/views/splash/entry.dart b/lib/views/splash/entry.dart index b27534e..fbd90a8 100644 --- a/lib/views/splash/entry.dart +++ b/lib/views/splash/entry.dart @@ -31,7 +31,10 @@ class _EntryScreenState extends State { _navigateToSplash() { // Routing to Splash - Navigator.of(context).pushNamed(SplashScreen.routeName); + Navigator.of(context).pushNamedAndRemoveUntil( + SplashScreen.routeName, + (route) => false, + ); } _navigateToAuthOrHome() { @@ -39,10 +42,16 @@ class _EntryScreenState extends State { FirebaseAuth.instance.authStateChanges().listen((User? user) { if (user != null) { // home screen - Navigator.of(context).pushNamed(BottomNav.routeName); + Navigator.of(context).pushNamedAndRemoveUntil( + BottomNav.routeName, + (route) => false, + ); } else { // auth screen - Navigator.of(context).pushNamed(AccountTypeSelector.routeName); + Navigator.of(context).pushNamedAndRemoveUntil( + AccountTypeSelector.routeName, + (route) => false, + ); } }); }