This commit is contained in:
Patrick Alvin Alcala 2025-02-18 17:19:24 +08:00
parent a06b1287f0
commit 27f654837b
47 changed files with 428 additions and 205 deletions

View file

@ -2,13 +2,20 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/auth/auth_service.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_additem_page.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_cart_page.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_main_page.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_profile_page.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_search_page.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
import 'package:pharmacy_mobile/widgets/menu_widget.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:go_router/go_router.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerPage extends StatefulWidget {
const CustomerPage({super.key});
@ -19,6 +26,8 @@ class CustomerPage extends StatefulWidget {
class _CustomerPageState extends State<CustomerPage> {
final _authService = AuthService();
final _pageController = PageController(initialPage: 0);
final NotchBottomBarController _notchController = NotchBottomBarController(index: 0);
void sample() {}
@ -29,36 +38,78 @@ class _CustomerPageState extends State<CustomerPage> {
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
child: Scaffold(
resizeToAvoidBottomInset: false,
body: SingleChildScrollView(
child: PageBackgroundWidget(
height: MediaQuery.of(context).size.height + 400,
page: 'menu',
child: Center(
child: Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'Menu'),
const Gap(16),
const MenuWidget(icon: FontAwesomeIcons.kitMedical, text: 'Buy Medicine', color: 'blue'),
const Gap(32),
ButtonWidget(
text: 'Logout',
onPressed: signOut,
)
// CustomerMenuWidget(
// onHomePressed: sample,
// onProfilePressed: sample,
// )
],
))),
),
final List<Widget> bottomBarPages = [
CustomerMainPage(
controller: _notchController,
),
);
const CustomerSearchPage(),
const CustomerAddItemPage(),
const CustomerCartPage(),
const CustomerProfilePage()
];
final Color selectedBarColor = const Color.fromRGBO(241, 255, 255, 0.83);
final Color unselectedBarColor = const Color.fromRGBO(206, 206, 206, 1);
return PopScope(
canPop: false,
child: Scaffold(
resizeToAvoidBottomInset: false,
body: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: List.generate(bottomBarPages.length, (index) => bottomBarPages[index]),
),
extendBody: true,
bottomNavigationBar: AnimatedNotchBottomBar(
notchBottomBarController: _notchController,
showLabel: true,
textOverflow: TextOverflow.visible,
maxLine: 1,
// shadowElevation: 5,
kBottomRadius: 28.0,
color: const Color.fromARGB(99, 204, 166, 240),
notchColor: const Color.fromARGB(161, 209, 166, 240),
removeMargins: false,
bottomBarWidth: 500,
durationInMilliSeconds: 300,
// itemLabelStyle: const TextStyle(fontSize: 10),
// elevation: 1,
bottomBarItems: [
BottomBarItem(
inActiveItem: FaIcon(FontAwesomeIcons.house, size: 20, color: unselectedBarColor),
activeItem: FaIcon(
FontAwesomeIcons.house,
size: 20,
color: selectedBarColor,
),
itemLabelWidget: TextWidget(text: 'Home', size: 12, bold: true, color: unselectedBarColor)),
BottomBarItem(
inActiveItem: FaIcon(FontAwesomeIcons.magnifyingGlass, size: 20, color: unselectedBarColor),
activeItem: Icon(FontAwesomeIcons.magnifyingGlass, size: 20, color: selectedBarColor),
itemLabelWidget: TextWidget(text: 'Search', size: 12, bold: true, color: unselectedBarColor),
),
BottomBarItem(
inActiveItem: FaIcon(FontAwesomeIcons.plus, size: 20, color: unselectedBarColor),
activeItem: Icon(FontAwesomeIcons.plus, size: 20, color: selectedBarColor),
itemLabelWidget: TextWidget(text: 'Add Item', size: 12, bold: true, color: unselectedBarColor),
),
BottomBarItem(
inActiveItem: FaIcon(FontAwesomeIcons.cartShopping, size: 20, color: unselectedBarColor),
activeItem: FaIcon(FontAwesomeIcons.cartShopping, size: 20, color: selectedBarColor),
itemLabelWidget: TextWidget(text: 'Cart', size: 12, bold: true, color: unselectedBarColor),
),
BottomBarItem(
inActiveItem: Icon(Icons.person, size: 20, color: unselectedBarColor),
activeItem: Icon(Icons.person, size: 20, color: selectedBarColor),
itemLabelWidget: TextWidget(text: 'Profile', size: 12, bold: true, color: unselectedBarColor),
),
],
onTap: (index) {
_pageController.jumpToPage(index);
setState(() {});
},
kIconSize: 24,
)));
}
}

View file

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerAddItemPage extends StatelessWidget {
final NotchBottomBarController? controller;
const CustomerAddItemPage({super.key, this.controller});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [
Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'Add Item'),
const Gap(16),
],
)
],
)));
}
}

View file

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerCartPage extends StatelessWidget {
final NotchBottomBarController? controller;
const CustomerCartPage({super.key, this.controller});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [
Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'My Cart'),
const Gap(16),
],
)
],
)));
}
}

View file

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerMainPage extends StatelessWidget {
final NotchBottomBarController? controller;
const CustomerMainPage({super.key, this.controller});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [
Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'Menu'),
const Gap(16),
],
)
],
)));
}
}

View file

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerProfilePage extends StatelessWidget {
final NotchBottomBarController? controller;
const CustomerProfilePage({super.key, this.controller});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [
Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'My Profile'),
const Gap(16),
],
)
],
)));
}
}

View file

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';
import 'package:pharmacy_mobile/widgets/title_widget.dart';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
class CustomerSearchPage extends StatelessWidget {
final NotchBottomBarController? controller;
const CustomerSearchPage({super.key, this.controller});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [
Column(
children: [
const Gap(96),
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
const Gap(32),
const TextWidget(text: 'Search'),
const Gap(16),
],
)
],
)));
}
}

View file

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:internet_connection_checker/internet_connection_checker.dart';
@ -32,6 +34,7 @@ class _RegisterPageState extends State<RegisterPage> {
final confirmPassword = _confirmPasswordController.text;
if (email.isEmpty) {
log('message');
if (mounted) {
showNotification(context, 'Error: Please enter a valid email', false);
}