From ecccd4a9bf164873f4b9dc0e8449c5dfdf9aa9b4 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 3 Mar 2025 13:38:06 +0800 Subject: [PATCH] update --- .../arm64-v8a/configure_fingerprint.bin | 24 ++-- .../armeabi-v7a/configure_fingerprint.bin | 24 ++-- .../k6q1g3c4/x86/configure_fingerprint.bin | 24 ++-- .../k6q1g3c4/x86_64/configure_fingerprint.bin | 24 ++-- lib/main.dart | 4 +- lib/pages/add_category_page.dart | 15 +- lib/pages/add_generics_page.dart | 64 +++------ ...anufactorer.dart => add_manufacturer.dart} | 22 +-- lib/pages/add_medicine_page.dart | 132 +++++++++--------- lib/pages/add_type_page.dart | 14 +- lib/pages/login_page.dart | 11 +- lib/pages/main_page.dart | 4 +- lib/pages/register_page.dart | 14 +- lib/widgets/buttonwithprogress_widget.dart | 37 +++++ lib/widgets/dropdown_wrapper_widget.dart | 5 +- lib/widgets/dropdown_wrappermulti_widget.dart | 7 +- 16 files changed, 232 insertions(+), 193 deletions(-) rename lib/pages/{add_manufactorer.dart => add_manufacturer.dart} (79%) create mode 100644 lib/widgets/buttonwithprogress_widget.dart diff --git a/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/configure_fingerprint.bin index bc0e34b..3ce49bc 100644 --- a/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logz x v/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2w +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2w u -s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/android_gradle_build.json  2 Ǖ2| +s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/android_gradle_build.json  2 Ǖ2| z -x/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/android_gradle_build_mini.json  2 򕂎2i +x/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/android_gradle_build_mini.json  2 򕂎2i g -e/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build.ninja  2 2m +e/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build.ninja  2 2m k -i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build.ninja.txt  2r +i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build.ninja.txt  2r p -n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build_file_index.txt  2 ^ 2s +n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/build_file_index.txt  2 ^ 2s q -o/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/compile_commands.json  2w +o/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/compile_commands.json  2w u -s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/compile_commands.json.bin  2 } +s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/compile_commands.json.bin  2 } { -y/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/metadata_generation_command.txt  2 +y/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/metadata_generation_command.txt  2  2p n -l/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/prefab_config.json  2  ( 2u +l/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/prefab_config.json  2  ( 2u s -q/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/symbol_folder_index.txt  2  h 2b +q/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/arm64-v8a/symbol_folder_index.txt  2  h 2b ` -^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file +^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/configure_fingerprint.bin index 5669b3d..250d412 100644 --- a/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Log| z x/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2y +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2y w -u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/android_gradle_build.json  2 2~ +u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/android_gradle_build.json  2 2~ | -z/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/android_gradle_build_mini.json  2 2k +z/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/android_gradle_build_mini.json  2 2k i -g/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build.ninja  2 2o +g/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build.ninja  2 2o m -k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build.ninja.txt  2t +k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build.ninja.txt  2t r -p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build_file_index.txt  2 ^ 2u +p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/build_file_index.txt  2 ^ 2u s -q/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/compile_commands.json  2y +q/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/compile_commands.json  2y w -u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/compile_commands.json.bin  2  +u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/compile_commands.json.bin  2  } -{/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/metadata_generation_command.txt  2 +{/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/metadata_generation_command.txt  2  2r p -n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/prefab_config.json  2  ( 2w +n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/prefab_config.json  2  ( 2w u -s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/symbol_folder_index.txt  2  j 2b +s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/armeabi-v7a/symbol_folder_index.txt  2  j 2b ` -^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file +^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/k6q1g3c4/x86/configure_fingerprint.bin b/android/app/.cxx/Debug/k6q1g3c4/x86/configure_fingerprint.bin index a2b5879..b8a4e5a 100644 --- a/android/app/.cxx/Debug/k6q1g3c4/x86/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/k6q1g3c4/x86/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logt r p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2q +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2q o -m/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/android_gradle_build.json  2 2v +m/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/android_gradle_build.json  2 2v t -r/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/android_gradle_build_mini.json  2 2c +r/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/android_gradle_build_mini.json  2 2c a -_/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build.ninja  2 2g +_/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build.ninja  2 2g e -c/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build.ninja.txt  2l +c/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build.ninja.txt  2l j -h/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build_file_index.txt  2 ^ 2m +h/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/build_file_index.txt  2 ^ 2m k -i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/compile_commands.json  2q +i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/compile_commands.json  2q o -m/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/compile_commands.json.bin  2 w +m/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/compile_commands.json.bin  2 w u -s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/metadata_generation_command.txt  2 +s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/metadata_generation_command.txt  2  2j h -f/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/prefab_config.json  2  ( 2o +f/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/prefab_config.json  2  ( 2o m -k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/symbol_folder_index.txt  2  b 2b +k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86/symbol_folder_index.txt  2  b 2b ` -^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file +^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/k6q1g3c4/x86_64/configure_fingerprint.bin b/android/app/.cxx/Debug/k6q1g3c4/x86_64/configure_fingerprint.bin index 46ccfec..7d16616 100644 --- a/android/app/.cxx/Debug/k6q1g3c4/x86_64/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/k6q1g3c4/x86_64/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logw u s/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2t +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ҕ2  2t r -p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/android_gradle_build.json  2 2y +p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/android_gradle_build.json  ҕ2 2y w -u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/android_gradle_build_mini.json  2 2f +u/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/android_gradle_build_mini.json  ҕ2 2f d -b/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build.ninja  2 2j +b/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build.ninja  ҕ2 2j h -f/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build.ninja.txt  2o +f/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build.ninja.txt  ҕ2o m -k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build_file_index.txt  2 ^ 2p +k/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/build_file_index.txt  ӕ2 ^ 2p n -l/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/compile_commands.json  2t +l/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/compile_commands.json  ӕ2t r -p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/compile_commands.json.bin  2 z +p/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/compile_commands.json.bin  ӕ2 z x -v/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/metadata_generation_command.txt  2 +v/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/metadata_generation_command.txt  ӕ2  2m k -i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/prefab_config.json  2  ( 2r +i/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/prefab_config.json  ӕ2  ( 2r p -n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/symbol_folder_index.txt  2  e 2b +n/home/patrick/Documents/WebApps/pharmacy_mobile/android/app/.cxx/Debug/k6q1g3c4/x86_64/symbol_folder_index.txt  ӕ2  e 2b ` -^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  2  ȼ2 \ No newline at end of file +^/home/patrick/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt  ӕ2  ȼ2 \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 2ca3e01..3661fc9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:pharmacy_mobile/auth/auth_gate.dart'; import 'package:pharmacy_mobile/pages/add_category_page.dart'; import 'package:pharmacy_mobile/pages/add_generics_page.dart'; -import 'package:pharmacy_mobile/pages/add_manufactorer.dart'; +import 'package:pharmacy_mobile/pages/add_manufacturer.dart'; import 'package:pharmacy_mobile/pages/add_medicine_page.dart'; import 'package:pharmacy_mobile/pages/add_stock_page.dart'; import 'package:pharmacy_mobile/pages/add_type_page.dart'; @@ -57,7 +57,7 @@ final _router = GoRouter( GoRoute( name: 'addmanufactorer', path: '/addmanufactorer', - builder: (context, state) => const AddManufactorerPage(), + builder: (context, state) => const AddManufacturerPage(), ), GoRoute( name: 'addmedicines', diff --git a/lib/pages/add_category_page.dart b/lib/pages/add_category_page.dart index cacc95b..46566a2 100644 --- a/lib/pages/add_category_page.dart +++ b/lib/pages/add_category_page.dart @@ -3,7 +3,7 @@ import 'package:gap/gap.dart'; import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:pharmacy_mobile/functions/checkexisting_function.dart'; import 'package:pharmacy_mobile/tables/ref_categories.dart'; -import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/form_border_widget2.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; @@ -94,10 +94,15 @@ class _AddCategoryPageState extends State { children: [ InputWidget(label: 'Category Name', controller: _categoryController), const Gap(32), - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Save Category', onPressed: _saveCategory) + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Colors.white)) + // else + // ButtonWidget(text: 'Save Category', onPressed: _saveCategory) + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Adding Category', + buttonText: 'Save', + onPressed: _saveCategory) ], ), )), diff --git a/lib/pages/add_generics_page.dart b/lib/pages/add_generics_page.dart index fde1498..a923145 100644 --- a/lib/pages/add_generics_page.dart +++ b/lib/pages/add_generics_page.dart @@ -4,8 +4,9 @@ import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:pharmacy_mobile/functions/checkexisting_function.dart'; import 'package:pharmacy_mobile/tables/ref_categories.dart'; import 'package:pharmacy_mobile/tables/ref_generic_names.dart'; -import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/dropdown_widget.dart'; +import 'package:pharmacy_mobile/widgets/dropdown_wrappermulti_widget.dart'; import 'package:pharmacy_mobile/widgets/form_border_widget2.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; @@ -71,7 +72,7 @@ class _AddGenericsPageState extends State { _selectedCategory = category; } - void saveGeneric() async { + void _saveGeneric() async { setState(() => _isLoading = true); try { @@ -153,47 +154,26 @@ class _AddGenericsPageState extends State { color: 'blue', child: Form( key: _formKey, - child: Column( - children: [ - InputWidget(label: 'Name', controller: _nameController), - const Gap(16), - if (_categoryList.isEmpty) - const Column( - children: [ - Gap(8), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - spacing: 16, - children: [ - CircularProgressIndicator(color: Colors.white), - TextWidget( - text: 'Fetching Categories', - size: 16, - ) - ], - ), - ], - ) - else - Column( - children: [ - DropDownWidget( - label: 'Category', - list: _categoryList, - listTitle: 'category_name', - onChanged: _updateCategory, - // value: _selectedCategory, - ), - const Gap(32), - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Add', onPressed: saveGeneric) - ], + child: DropdownWrapperMultiWidget(list: _categoryList, text: 'List', children: [ + Column( + children: [ + InputWidget(label: 'Name', controller: _nameController), + const Gap(16), + DropDownWidget( + label: 'Category', + list: _categoryList, + listTitle: 'category_name', + onChanged: _updateCategory, ), - ], - )), + const Gap(32), + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Adding Generics', + buttonText: 'Save', + onPressed: _saveGeneric) + ], + ), + ])), ) ], )), diff --git a/lib/pages/add_manufactorer.dart b/lib/pages/add_manufacturer.dart similarity index 79% rename from lib/pages/add_manufactorer.dart rename to lib/pages/add_manufacturer.dart index f4742c7..7b9145c 100644 --- a/lib/pages/add_manufactorer.dart +++ b/lib/pages/add_manufacturer.dart @@ -5,6 +5,7 @@ import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:pharmacy_mobile/functions/checkexisting_function.dart'; import 'package:pharmacy_mobile/tables/ref_manufactorers.dart'; import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/form_border_widget2.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; @@ -12,14 +13,14 @@ import 'package:pharmacy_mobile/widgets/snackbar_widget.dart'; import 'package:pharmacy_mobile/widgets/text_widget.dart'; import 'package:pharmacy_mobile/widgets/title_widget.dart'; -class AddManufactorerPage extends StatefulWidget { - const AddManufactorerPage({super.key}); +class AddManufacturerPage extends StatefulWidget { + const AddManufacturerPage({super.key}); @override - State createState() => _AddManufactorerPageState(); + State createState() => _AddManufactorerPageState(); } -class _AddManufactorerPageState extends State { +class _AddManufactorerPageState extends State { final _formKey = GlobalKey(); final _nameController = TextEditingController(); final _addressController = TextEditingController(); @@ -100,10 +101,15 @@ class _AddManufactorerPageState extends State { const Gap(16), InputWidget(label: 'Address', controller: _addressController), const Gap(32), - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Save Manufactorer', onPressed: _saveManufactorer) + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Colors.white)) + // else + // ButtonWidget(text: 'Save Manufactorer', onPressed: _saveManufactorer) + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Adding Manufacturer', + buttonText: 'Save', + onPressed: _saveManufactorer) ], ))) ], diff --git a/lib/pages/add_medicine_page.dart b/lib/pages/add_medicine_page.dart index 745e250..a0afe4a 100644 --- a/lib/pages/add_medicine_page.dart +++ b/lib/pages/add_medicine_page.dart @@ -12,6 +12,7 @@ import 'package:pharmacy_mobile/tables/ref_medicines.dart'; import 'package:pharmacy_mobile/tables/ref_types.dart'; import 'package:pharmacy_mobile/tables/storage.dart'; import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/dropdown_widget.dart'; import 'package:pharmacy_mobile/widgets/dropdown_wrappermulti_widget.dart'; import 'package:pharmacy_mobile/widgets/form_border_widget2.dart'; @@ -240,74 +241,69 @@ class _AddMedicinePageState extends State { color: 'green', child: Form( key: _formKey, - child: Center( - child: Column( - children: [ - InputWidget(label: 'Name', controller: _nameController), - const Gap(16), - DropdownWrapperMultiWidget(list: _genericNameList, text: 'Data', children: [ - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - DropDownWidget( - label: 'Generic Name', - list: _genericNameList, - listTitle: 'generic_name', - onChanged: _updateGeneric, - // value: _selectedGeneric, - ), - const Gap(8), - 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, - // value: _selectedType, - ), - const Gap(16), - DropDownWidget( - label: 'Manufactorer', - list: _manufactorerList, - listTitle: 'manufactorer_name', - onChanged: _updateManufactorer, - // value: _selectedManufactorer, - ), - const Gap(16), - InputWidget(label: 'Barcode', controller: _barcodeController), - ScanbarcodeWidget(onTap: _scanBarcode), - const Gap(16), - if (imageUrl.isNotEmpty) - Center( - child: ClipRRect( - borderRadius: - BorderRadius.circular(12), // Add your desired border radius here - child: ImageWidget( - imagePath: imageUrl, - size: 250, - measureByHeight: false, - network: true, - )) - // Image.network(imageUrl, fit: BoxFit.cover, width: 250, height: 250)), - ) - else - ButtonWidget( - text: 'Add Image', - onPressed: _addImage, - outline: true, - ), - const Gap(32), - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Save Medicine', onPressed: _saveMedicine) - ]) - ]), - ], - ), - ))) + child: DropdownWrapperMultiWidget(list: _genericNameList, text: 'Data', children: [ + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + InputWidget(label: 'Name', controller: _nameController), + const Gap(16), + DropDownWidget( + label: 'Generic Name', + list: _genericNameList, + listTitle: 'generic_name', + onChanged: _updateGeneric, + ), + const Gap(8), + 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, + ), + const Gap(16), + DropDownWidget( + label: 'Manufactorer', + list: _manufactorerList, + listTitle: 'manufactorer_name', + onChanged: _updateManufactorer, + ), + const Gap(16), + InputWidget(label: 'Barcode', controller: _barcodeController), + ScanbarcodeWidget(onTap: _scanBarcode), + const Gap(16), + if (imageUrl.isNotEmpty) + Center( + child: ClipRRect( + borderRadius: BorderRadius.circular(12), // Add your desired border radius here + child: ImageWidget( + imagePath: imageUrl, + size: 250, + measureByHeight: false, + network: true, + )) + // Image.network(imageUrl, fit: BoxFit.cover, width: 250, height: 250)), + ) + else + ButtonWidget( + text: 'Add Image', + onPressed: _addImage, + outline: true, + ), + const Gap(32), + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Colors.white)) + // else + // ButtonWidget(text: 'Save Medicine', onPressed: _saveMedicine) + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Adding Medicine', + buttonText: 'Save', + onPressed: _saveMedicine) + ]) + ]))) ])))); } } diff --git a/lib/pages/add_type_page.dart b/lib/pages/add_type_page.dart index 5e6d69e..77a3d7f 100644 --- a/lib/pages/add_type_page.dart +++ b/lib/pages/add_type_page.dart @@ -4,6 +4,7 @@ import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:pharmacy_mobile/functions/checkexisting_function.dart'; import 'package:pharmacy_mobile/tables/ref_types.dart'; import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/form_border_widget2.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; @@ -97,10 +98,15 @@ class _AddTypePageState extends State { children: [ InputWidget(label: 'Type Name', controller: _typeController), const Gap(32), - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Save Type', onPressed: _saveType) + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Colors.white)) + // else + // ButtonWidget(text: 'Save Type', onPressed: _saveType) + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Adding Type', + buttonText: 'Save', + onPressed: _saveType) ], ), )), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 53b6aae..748652e 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -4,6 +4,7 @@ import 'package:go_router/go_router.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/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; import 'package:pharmacy_mobile/widgets/snackbar_widget.dart'; @@ -151,10 +152,12 @@ class _LoginPageState extends State { ), const Gap(40), // TextButton(onPressed: () => {_signIn()}, child: const Text('Login')) - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1))) - else - ButtonWidget(text: 'Login', onPressed: _signIn) + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1))) + // else + // ButtonWidget(text: 'Login', onPressed: _signIn), + ButtonWithProgressWidget( + trigger: _isLoading, progressText: 'Logging In', buttonText: 'Login', onPressed: _signIn) ], )), ), diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 460cfb2..c5825e4 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -52,8 +52,8 @@ class _MainPageState extends State { const Gap(16), MenuWidget( icon: FontAwesomeIcons.circlePlus, - text: 'Add Manufactorer', - description: 'Register manufactorer to the list', + text: 'Add Manufacturer', + description: 'Register manufacturer to the list', onPressed: () => {context.push('/addmanufactorer')}, color: 'blue', ), diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart index 62be2aa..acffed5 100644 --- a/lib/pages/register_page.dart +++ b/lib/pages/register_page.dart @@ -3,6 +3,7 @@ import 'package:gap/gap.dart'; import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:pharmacy_mobile/auth/auth_service.dart'; import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart'; import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; import 'package:pharmacy_mobile/widgets/snackbar_widget.dart'; @@ -150,10 +151,15 @@ class _RegisterPageState extends State { ), const Gap(40), // TextButton(onPressed: () => {_signIn()}, child: const Text('Login')) - if (_isLoading) - const Center(child: CircularProgressIndicator(color: Colors.white)) - else - ButtonWidget(text: 'Create Account', onPressed: _signUp) + // if (_isLoading) + // const Center(child: CircularProgressIndicator(color: Colors.white)) + // else + // ButtonWidget(text: 'Create Account', onPressed: _signUp) + ButtonWithProgressWidget( + trigger: _isLoading, + progressText: 'Registering', + buttonText: 'Register', + onPressed: _signUp) ], )), ), diff --git a/lib/widgets/buttonwithprogress_widget.dart b/lib/widgets/buttonwithprogress_widget.dart new file mode 100644 index 0000000..da66c10 --- /dev/null +++ b/lib/widgets/buttonwithprogress_widget.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:pharmacy_mobile/widgets/button_widget.dart'; +import 'package:pharmacy_mobile/widgets/text_widget.dart'; + +class ButtonWithProgressWidget extends StatelessWidget { + final bool trigger; + final String progressText; + final String buttonText; + final VoidCallback onPressed; + + const ButtonWithProgressWidget( + {super.key, + required this.trigger, + required this.progressText, + required this.buttonText, + required this.onPressed}); + + @override + Widget build(BuildContext context) { + if (trigger) { + return Center( + child: Column( + children: [ + const CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1)), + const Gap(16), + TextWidget( + text: progressText, + size: 12, + ) + ], + )); + } else { + return ButtonWidget(text: buttonText, onPressed: onPressed); + } + } +} diff --git a/lib/widgets/dropdown_wrapper_widget.dart b/lib/widgets/dropdown_wrapper_widget.dart index 8f0f75c..90cbb76 100644 --- a/lib/widgets/dropdown_wrapper_widget.dart +++ b/lib/widgets/dropdown_wrapper_widget.dart @@ -20,13 +20,14 @@ class DropdownWrapperWidget extends StatelessWidget { ? Column( children: [ const Gap(8), - Row( + Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, spacing: 16, children: [ const CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1)), - TextWidget(text: 'Fetching $text', size: 16) + const Gap(4), + TextWidget(text: 'Fetching $text', size: 14) ], ), ], diff --git a/lib/widgets/dropdown_wrappermulti_widget.dart b/lib/widgets/dropdown_wrappermulti_widget.dart index c983445..023e319 100644 --- a/lib/widgets/dropdown_wrappermulti_widget.dart +++ b/lib/widgets/dropdown_wrappermulti_widget.dart @@ -19,16 +19,15 @@ class DropdownWrapperMultiWidget extends StatelessWidget { return (list.isEmpty) ? Column( children: [ - const Gap(8), - Row( + Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - spacing: 16, children: [ const CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1)), + const Gap(16), TextWidget( text: 'Fetching $text', - size: 16, + size: 14, ) ], ),