This commit is contained in:
Patrick Alvin Alcala 2025-02-27 11:32:15 +08:00
parent c41c19b469
commit 6e4b2249b0
17 changed files with 276 additions and 187 deletions

View file

@ -4,7 +4,7 @@ import 'package:pharmacy_mobile/auth/auth_service.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/consultation_widget.dart';
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
import 'package:pharmacy_mobile/widgets/menu_widget2.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';
@ -20,87 +20,77 @@ class CustomerMainPage extends StatefulWidget {
}
class _CustomerMainPageState extends State<CustomerMainPage> {
final _authService = AuthService();
void signOut() async {
// ignore: use_build_context_synchronously
await _authService.signOut().then((_) => {context.go('/'), showNotification(context, 'Logged Out', true)});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageBackgroundWidget(
dark: true,
child: Column(
children: [
Column(
children: [
const Gap(96),
const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Gap(16),
LogoWidget(size: 56),
],
),
const Gap(16),
const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Gap(16),
TextWidget(
text: 'Pharmacist Consultation',
title: true,
size: 14,
),
],
),
const Gap(8),
ConsultationWidget(name: 'Ofelia Franco-Alcala, RPh'),
MenuWidget(
// icon: FontAwesomeIcons.diagramNext,
text: 'Ofelia Franco-Alcala, RPh',
description: 'aaa',
onPressed: () => {context.push('/deletestock')},
color: 'green',
width: MediaQuery.of(context).size.width - 32,
),
const Gap(8),
MenuWidget(
// icon: FontAwesomeIcons.diagramNext,
text: 'Pamela Claire Alcala, RPh',
description: 'aaa',
onPressed: () => {context.push('/deletestock')},
color: 'green',
width: MediaQuery.of(context).size.width - 32,
),
const Gap(16),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Gap(16),
const TextWidget(
text: 'Doctor Consultation',
title: true,
size: 14,
),
],
),
const Gap(8),
MenuWidget(
// icon: FontAwesomeIcons.diagramNext,
text: 'Floherna Franco-Diccion, PhD',
description: 'aaa',
onPressed: () => {context.push('/deletestock')},
color: 'green',
width: MediaQuery.of(context).size.width - 32,
),
const Gap(32),
ButtonWidget(text: 'Log Out', onPressed: signOut)
],
)
],
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
const Gap(96),
const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Gap(16),
LogoWidget(size: 56),
],
),
const Gap(16),
const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextWidget(
text: 'Pharmacist Consultation',
title: true,
size: 14,
),
],
),
const Gap(8),
ConsultationWidget(
name: 'Ofelia Franco-Alcala, RPh',
description: 'Pharmacist',
contact: '09205436095',
imagePath: 'assets/images/ofelia.webp',
color: 'pink',
margin: 32,
),
const Gap(8),
ConsultationWidget(
name: 'Pamela Claire Alcala, RPh',
description: 'Pharmacist',
contact: '09205436095',
imagePath: 'assets/images/pamela.webp',
color: 'pink',
margin: 32,
),
const Gap(16),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const TextWidget(
text: 'Doctor Consultation',
title: true,
size: 14,
),
],
),
const Gap(8),
ConsultationWidget(
name: 'Floherna Franco-Diccion, PhD',
description: 'Physician',
contact: '09205436095',
imagePath: 'assets/ph_logo.webp',
color: 'yellow',
margin: 32,
),
// const Gap(32),
// ButtonWidget(text: 'Log Out', onPressed: signOut)
],
),
)));
}
}

View file

@ -1,6 +1,10 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:pharmacy_mobile/auth/auth_service.dart';
import 'package:pharmacy_mobile/widgets/button_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:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
@ -11,6 +15,13 @@ class CustomerProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final authService = AuthService();
void signOut() async {
// ignore: use_build_context_synchronously
await authService.signOut().then((_) => {context.go('/'), showNotification(context, 'Logged Out', true)});
}
return Scaffold(
body: PageBackgroundWidget(
child: Column(
@ -26,6 +37,8 @@ class CustomerProfilePage extends StatelessWidget {
const Gap(32),
const TextWidget(text: 'My Profile'),
const Gap(16),
const Gap(32),
ButtonWidget(text: 'Log Out', onPressed: signOut)
],
)
],

View file

@ -4,7 +4,7 @@ import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:pharmacy_mobile/auth/auth_service.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/menu_widget2.dart';
import 'package:pharmacy_mobile/widgets/menu_widget.dart';
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
import 'package:pharmacy_mobile/widgets/pull_refresh_widget.dart';
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';

View file

@ -4,41 +4,99 @@ import 'package:pharmacy_mobile/widgets/text_widget.dart';
class ConsultationWidget extends StatelessWidget {
final String name;
// final IconData? icon;
final String description;
final String contact;
final String imagePath;
final VoidCallback? onTap;
final double? width;
// final String? color;
final String? color;
final double? margin;
// final String description;
const ConsultationWidget({super.key, required this.name, this.onTap, this.width});
final List<Color> blue = [
const Color.fromRGBO(59, 101, 156, 0.8),
const Color.fromRGBO(59, 101, 156, 0.8),
const Color.fromRGBO(59, 156, 156, 0.8),
];
final List<Color> green = [
const Color.fromRGBO(59, 156, 103, 0.8),
const Color.fromRGBO(59, 156, 103, 0.8),
const Color.fromRGBO(122, 182, 70, 0.8),
];
final List<Color> red = [
const Color.fromRGBO(156, 59, 59, 0.8),
const Color.fromRGBO(164, 62, 62, 0.8),
const Color.fromRGBO(186, 120, 70, 0.8),
];
final List<Color> yellow = [
const Color.fromRGBO(156, 156, 59, 0.8),
const Color.fromRGBO(156, 156, 59, 0.8),
const Color.fromRGBO(104, 156, 59, 0.8),
];
final List<Color> pink = [
const Color.fromRGBO(130, 59, 156, 0.8),
const Color.fromRGBO(130, 59, 156, 0.8),
const Color.fromARGB(204, 156, 59, 150),
];
ConsultationWidget({
super.key,
required this.name,
required this.description,
required this.contact,
required this.imagePath,
this.onTap,
this.color,
this.margin,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: width ?? MediaQuery.of(context).size.width - 96,
padding: const EdgeInsets.symmetric(vertical: 16),
width: MediaQuery.of(context).size.width - (margin ?? 0),
padding: const EdgeInsets.symmetric(vertical: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
// gradient: LinearGradient(
// colors: Colors.white,
// begin: Alignment.centerLeft,
// end: Alignment.centerRight,
// ),
gradient: LinearGradient(
colors: _getColorList(color ?? ''),
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Gap(32),
ClipRRect(
borderRadius: BorderRadius.circular(12), // Adjust the radius as needed
child:
Image.asset(imagePath, width: 80, cacheWidth: (80 * MediaQuery.of(context).devicePixelRatio).round()),
),
const Gap(24),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: name,
size: 18,
size: 16,
bold: true,
),
const Gap(4),
TextWidget(
text: description,
size: 12,
),
const Gap(4),
TextWidget(
text: contact,
size: 12,
color: const Color.fromRGBO(188, 188, 188, 1),
),
],
),
],
@ -46,4 +104,25 @@ class ConsultationWidget extends StatelessWidget {
),
);
}
List<Color> _getColorList(String color) {
switch (color.toLowerCase()) {
case 'green':
return green;
case 'blue':
return blue;
case 'red':
return red;
case 'yellow':
return yellow;
case 'pink':
return pink;
default:
return [
const Color.fromRGBO(0, 0, 0, 1),
const Color.fromRGBO(68, 68, 68, 1),
const Color.fromRGBO(158, 158, 158, 1),
];
}
}
}