update
This commit is contained in:
parent
9d5a392db3
commit
c41c19b469
10 changed files with 299 additions and 181 deletions
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
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/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
||||
|
|
@ -29,31 +31,76 @@ class _CustomerMainPageState extends State<CustomerMainPage> {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: PageBackgroundWidget(
|
||||
dark: true,
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
const TitleWidget(
|
||||
firstTextSize: 14,
|
||||
secondTextSize: 24,
|
||||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Menu'),
|
||||
const Gap(16),
|
||||
MenuWidget(
|
||||
// icon: FontAwesomeIcons.diagramNext,
|
||||
text: 'Diagnose by ',
|
||||
description: 'aaa',
|
||||
onPressed: () => {context.push('/deletestock')},
|
||||
color: 'green',
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Log Out', onPressed: signOut)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
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)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ import 'dart:developer';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/tables/storage.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/item_card_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/logo_widget.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';
|
||||
|
|
@ -23,18 +25,20 @@ class CustomerSearchPage extends StatefulWidget {
|
|||
class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
||||
final _searchController = TextEditingController();
|
||||
final _storage = Storage();
|
||||
final _stocks = Stocks();
|
||||
// final _refMedicines = RefMedicines();
|
||||
late String imageUrl = '';
|
||||
// List<String> imageUrl = [];
|
||||
late List _stockList = [];
|
||||
|
||||
void getURL() async {
|
||||
final image = await _storage.getPublicURL('ref_medicines_images', 'cb6eafdb-d86f-460a-9571-44446570d4cb.webp');
|
||||
Future<void> _getURL() async {
|
||||
final image = await _storage.getPublicURL('ref_medicines_images', 'a3e430fe-86c1-4d46-9c6a-aed2dae57fef.webp');
|
||||
setState(() {
|
||||
imageUrl = image;
|
||||
});
|
||||
}
|
||||
|
||||
// final meds = await _refMedicines.getList2();
|
||||
// log(meds.toString());
|
||||
Future<void> _getAllStocks() async {
|
||||
_stockList = await _stocks.getList();
|
||||
}
|
||||
|
||||
// void getURLs() async {
|
||||
|
|
@ -57,9 +61,14 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
void _filterList() {}
|
||||
|
||||
void autoRun() async {
|
||||
await _getAllStocks();
|
||||
await _getURL();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getURL();
|
||||
autoRun();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +76,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
void dispose() {
|
||||
_searchController.dispose();
|
||||
imageUrl = '';
|
||||
_stockList = [];
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -76,103 +86,106 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
return Scaffold(
|
||||
body: PageBackgroundWidget(
|
||||
dark: true,
|
||||
// height: MediaQuery.of(context).size.height * 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
const TitleWidget(
|
||||
firstTextSize: 14,
|
||||
secondTextSize: 24,
|
||||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 64, right: 64),
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(
|
||||
label: '',
|
||||
controller: _searchController,
|
||||
placeholder: 'Search for medicine',
|
||||
),
|
||||
// const Gap(8),
|
||||
// ButtonWidget(
|
||||
// text: 'Search',
|
||||
// onPressed: _filterList,
|
||||
// width: 160,
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
const Gap(32),
|
||||
// Center(
|
||||
// child: imageUrl.isNotEmpty
|
||||
// ? ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(12), // Add your desired border radius here
|
||||
// child: Image.network(imageUrl,
|
||||
// fit: BoxFit.cover,
|
||||
// width: 250,
|
||||
// height: 250,
|
||||
// cacheWidth: (250 * MediaQuery.of(context).devicePixelRatio).round()))
|
||||
// : const CircularProgressIndicator(
|
||||
// color: Colors.white,
|
||||
// strokeWidth: 4,
|
||||
// padding: EdgeInsets.all(8),
|
||||
// ),
|
||||
// )
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Gap(16),
|
||||
const LogoWidget(size: 56),
|
||||
],
|
||||
),
|
||||
const Gap(8),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 64, right: 64),
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(
|
||||
label: '',
|
||||
controller: _searchController,
|
||||
placeholder: 'Search for medicine',
|
||||
),
|
||||
// const Gap(8),
|
||||
// ButtonWidget(
|
||||
// text: 'Search',
|
||||
// onPressed: _filterList,
|
||||
// width: 160,
|
||||
// )
|
||||
],
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Gap(32),
|
||||
// Center(
|
||||
// child: imageUrl.isNotEmpty
|
||||
// ? ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(12), // Add your desired border radius here
|
||||
// child: Image.network(imageUrl,
|
||||
// fit: BoxFit.cover,
|
||||
// width: 250,
|
||||
// height: 250,
|
||||
// cacheWidth: (250 * MediaQuery.of(context).devicePixelRatio).round()))
|
||||
// : const CircularProgressIndicator(
|
||||
// color: Colors.white,
|
||||
// strokeWidth: 4,
|
||||
// padding: EdgeInsets.all(8),
|
||||
// ),
|
||||
// )
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
),
|
||||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
price: 20,
|
||||
quantity: 85,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,15 @@ class Stocks {
|
|||
Future<List> getList() async {
|
||||
List<Map<String, dynamic>> stockData = [];
|
||||
|
||||
final data = await _supabase.from('stocks').select('ref_medicines(medicine_name), expiration_date, quantity');
|
||||
final data =
|
||||
await _supabase.from('stocks').select('ref_medicines(medicine_name), expiration_date, quantity, price');
|
||||
|
||||
for (var item in data) {
|
||||
stockData.add({
|
||||
'medicine_name': item['ref_medicines']['medicine_name'],
|
||||
'quantity': item['quantity'].toString(),
|
||||
'expiration_date': item['expiration_date'],
|
||||
'price': item['price'],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
49
lib/widgets/consultation_widget.dart
Normal file
49
lib/widgets/consultation_widget.dart
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
|
||||
class ConsultationWidget extends StatelessWidget {
|
||||
final String name;
|
||||
// final IconData? icon;
|
||||
final VoidCallback? onTap;
|
||||
final double? width;
|
||||
// final String? color;
|
||||
// final String description;
|
||||
|
||||
const ConsultationWidget({super.key, required this.name, this.onTap, this.width});
|
||||
|
||||
@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),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// gradient: LinearGradient(
|
||||
// colors: Colors.white,
|
||||
// begin: Alignment.centerLeft,
|
||||
// end: Alignment.centerRight,
|
||||
// ),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Gap(32),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: name,
|
||||
size: 18,
|
||||
bold: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ class MenuWidget extends StatelessWidget {
|
|||
final VoidCallback? onPressed;
|
||||
final String? color;
|
||||
final String description;
|
||||
final double? width;
|
||||
|
||||
final List<Color> blue = [
|
||||
const Color.fromRGBO(59, 101, 156, 0.8),
|
||||
|
|
@ -34,14 +35,14 @@ class MenuWidget extends StatelessWidget {
|
|||
const Color.fromRGBO(104, 156, 59, 0.8),
|
||||
];
|
||||
|
||||
MenuWidget({super.key, required this.text, required this.description, this.icon, this.onPressed, this.color});
|
||||
MenuWidget({super.key, required this.text, required this.description, this.icon, this.onPressed, this.color, this.width});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width - 96,
|
||||
width: width ?? MediaQuery.of(context).size.width - 96,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ class PageBackgroundWidget extends StatelessWidget {
|
|||
final Widget child;
|
||||
final String? page;
|
||||
final double? height;
|
||||
final bool? dark;
|
||||
|
||||
const PageBackgroundWidget({super.key, required this.child, this.page, this.height});
|
||||
const PageBackgroundWidget({super.key, required this.child, this.page, this.height, this.dark});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -27,14 +28,19 @@ class PageBackgroundWidget extends StatelessWidget {
|
|||
),
|
||||
fit: BoxFit.cover, // Ensures the background covers the entire container
|
||||
alignment: Alignment.center,
|
||||
opacity: 0.3, // Adjusts the opacity as needed
|
||||
opacity: dark == true ? 0.1 : 0.3, // Adjusts the opacity as needed
|
||||
),
|
||||
gradient: const RadialGradient(
|
||||
gradient: RadialGradient(
|
||||
tileMode: TileMode.clamp,
|
||||
colors: [
|
||||
Color.fromRGBO(26, 8, 25, 1),
|
||||
Color.fromRGBO(60, 22, 57, 1),
|
||||
],
|
||||
colors: dark == true
|
||||
? [
|
||||
Color.fromRGBO(19, 8, 26, 1),
|
||||
Color.fromRGBO(43, 22, 60, 1),
|
||||
]
|
||||
: [
|
||||
Color.fromRGBO(26, 8, 25, 1),
|
||||
Color.fromRGBO(60, 22, 57, 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue