update
This commit is contained in:
parent
cbf2ff062f
commit
7886eeb6c2
26 changed files with 210 additions and 228 deletions
|
|
@ -1,10 +1,14 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/barcode_scan_function.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkresult_function.dart';
|
||||
import 'package:pharmacy_mobile/security/encryption.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_manufactorers.dart';
|
||||
|
|
@ -22,7 +26,6 @@ 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:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:flutter_image_compress/flutter_image_compress.dart';
|
||||
|
||||
|
|
@ -161,7 +164,8 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
setState(() => _isLoading = true);
|
||||
|
||||
try {
|
||||
final String encrpytedBarcode = await encrypt(_barcodeController.text);
|
||||
// final String encrpytedBarcode = await encrypt(_barcodeController.text);
|
||||
final String encrpytedBarcode = _barcodeController.text;
|
||||
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
final medName = _nameController.text;
|
||||
|
|
@ -187,16 +191,19 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
|
||||
void _addImage() async {
|
||||
final imageName = Uuid().v4();
|
||||
uuid = imageName;
|
||||
|
||||
final ImagePicker picker = ImagePicker();
|
||||
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
|
||||
final XFile? image = await picker.pickImage(source: ImageSource.gallery, imageQuality: 100);
|
||||
const storageName = 'ref_medicines_images';
|
||||
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
final imageBytes = await image!.readAsBytes();
|
||||
final webpImage = await _webpConvert(imageBytes);
|
||||
|
||||
imageUrl = await _storage.uploadImage(context, storageName, image, '$imageName.webp');
|
||||
uuid = imageName;
|
||||
|
||||
if (mounted) {
|
||||
imageUrl = await _storage.uploadImage(context, storageName, webpImage, '$imageName.webp');
|
||||
}
|
||||
|
||||
setState(() {
|
||||
if (imageUrl.isEmpty) {
|
||||
|
|
@ -207,6 +214,19 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
});
|
||||
}
|
||||
|
||||
Future<Uint8List> _webpConvert(Uint8List file) async {
|
||||
final result = await FlutterImageCompress.compressWithList(
|
||||
file,
|
||||
// minHeight: 1080,
|
||||
// minWidth: 1080,
|
||||
quality: 75,
|
||||
rotate: 0,
|
||||
keepExif: false,
|
||||
format: CompressFormat.webp,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
autoRun();
|
||||
|
|
@ -261,7 +281,10 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
listTitle: 'generic_name',
|
||||
onChanged: _updateGeneric),
|
||||
const Gap(8),
|
||||
TextWidget(text: _selectedCategory, size: 18),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: TextWidget(text: _selectedCategory, size: 18),
|
||||
),
|
||||
const Gap(16),
|
||||
DropDownWidget(
|
||||
label: 'Type', list: _typeList, listTitle: 'type_name', onChanged: _updateType),
|
||||
|
|
@ -282,7 +305,11 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
child: Image.network(imageUrl, fit: BoxFit.cover, width: 250, height: 250)),
|
||||
)
|
||||
else
|
||||
ButtonWidget(text: 'Add Image', onPressed: _addImage),
|
||||
ButtonWidget(
|
||||
text: 'Add Image',
|
||||
onPressed: _addImage,
|
||||
outline: true,
|
||||
),
|
||||
const Gap(32),
|
||||
if (_isLoading)
|
||||
const Center(child: CircularProgressIndicator(color: Colors.white))
|
||||
|
|
|
|||
|
|
@ -85,11 +85,16 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
}
|
||||
|
||||
void _saveStock() async {
|
||||
final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
|
||||
final stockQuantity = _quantityController.text;
|
||||
final stockExpiration = _dateController.text;
|
||||
// final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
|
||||
// final stockQuantity = _quantityController.text;
|
||||
// final stockExpiration = _dateController.text;
|
||||
|
||||
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
// await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
final aa = await encrypt('text');
|
||||
final bb =
|
||||
await decrypt('4cee2f33af6ebac8dcfdeeccdd6c73c4698ce25b0cb26249c571fafc8483b5a047baefc4d626fa56e027343d');
|
||||
log('encrypt: $aa');
|
||||
log('plain: $bb');
|
||||
}
|
||||
|
||||
Future<void> _scanBarcode() async {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ class _CustomerPageState extends State<CustomerPage> {
|
|||
size: barFontSize,
|
||||
bold: true,
|
||||
color: unselectedBarColor,
|
||||
footer: true,
|
||||
)),
|
||||
BottomBarItem(
|
||||
inActiveItem:
|
||||
|
|
@ -81,7 +80,6 @@ class _CustomerPageState extends State<CustomerPage> {
|
|||
size: barFontSize,
|
||||
bold: true,
|
||||
color: unselectedBarColor,
|
||||
footer: true,
|
||||
),
|
||||
),
|
||||
BottomBarItem(
|
||||
|
|
@ -93,7 +91,6 @@ class _CustomerPageState extends State<CustomerPage> {
|
|||
size: barFontSize,
|
||||
bold: true,
|
||||
color: unselectedBarColor,
|
||||
footer: true,
|
||||
),
|
||||
),
|
||||
BottomBarItem(
|
||||
|
|
@ -104,7 +101,6 @@ class _CustomerPageState extends State<CustomerPage> {
|
|||
size: barFontSize,
|
||||
bold: true,
|
||||
color: unselectedBarColor,
|
||||
footer: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class _CustomerMainPageState extends State<CustomerMainPage> {
|
|||
const Gap(32),
|
||||
const TextWidget(text: 'Menu'),
|
||||
const Gap(16),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
// icon: FontAwesomeIcons.diagramNext,
|
||||
text: 'Diagnose by ',
|
||||
description: 'aaa',
|
||||
|
|
|
|||
|
|
@ -49,9 +49,12 @@ class IndexPage extends StatelessWidget {
|
|||
text: 'Copyright © 2025 - Ofelia Franco-Alcala Pharmacy',
|
||||
size: 10,
|
||||
bold: true,
|
||||
footer: true,
|
||||
),
|
||||
const TextWidget(text: 'Developed By: Pat Alcala', size: 8, opacity: 0.8, footer: true),
|
||||
const TextWidget(
|
||||
text: 'Developed By: Pat Alcala',
|
||||
size: 8,
|
||||
opacity: 0.8,
|
||||
),
|
||||
const Gap(16),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -123,7 +123,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Login'),
|
||||
const TextWidget(
|
||||
text: 'Login',
|
||||
title: true,
|
||||
),
|
||||
const Gap(16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 32, right: 32),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ 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/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';
|
||||
|
|
@ -46,9 +45,12 @@ class _MainPageState extends State<MainPage> {
|
|||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Menu'),
|
||||
const TextWidget(
|
||||
text: 'Menu',
|
||||
title: true,
|
||||
),
|
||||
const Gap(16),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Type',
|
||||
description: 'Create a new medical type',
|
||||
|
|
@ -56,7 +58,7 @@ class _MainPageState extends State<MainPage> {
|
|||
color: 'blue',
|
||||
),
|
||||
const Gap(16),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Category',
|
||||
description: 'Create a new medicine category',
|
||||
|
|
@ -64,35 +66,35 @@ class _MainPageState extends State<MainPage> {
|
|||
color: 'blue',
|
||||
),
|
||||
const Gap(16),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Generics',
|
||||
description: 'Add generic name on the list',
|
||||
onPressed: () => {context.push('/addgenerics')},
|
||||
color: 'blue'),
|
||||
const Gap(32),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Medicine',
|
||||
description: 'Add generic name on the list',
|
||||
onPressed: () => {context.push('/addmedicines')},
|
||||
color: 'green'),
|
||||
const Gap(16),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Stock',
|
||||
description: 'Add generic name on the list',
|
||||
onPressed: () => {context.push('/addstock')},
|
||||
color: 'green'),
|
||||
const Gap(32),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: Icons.delete,
|
||||
text: 'Remove Stock',
|
||||
description: 'Add generic name on the list',
|
||||
onPressed: () => {context.push('/deletestock')},
|
||||
color: 'red'),
|
||||
const Gap(32),
|
||||
MenuWidget2(
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.listCheck,
|
||||
text: 'List of Stocks',
|
||||
description: 'Add generic name on the list',
|
||||
|
|
|
|||
|
|
@ -116,7 +116,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
|||
logoSize: 90,
|
||||
),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Register'),
|
||||
const TextWidget(
|
||||
text: 'Register',
|
||||
title: true,
|
||||
),
|
||||
const Gap(16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 32, right: 32),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue