diff --git a/lib/main.dart b/lib/main.dart index d0b65a0..02d20c6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -179,10 +179,24 @@ final _router = GoRouter( child: child), ), ), + // GoRoute( + // name: 'addstock', + // path: '/addstock', + // builder: (context, state) => const AddStockPage(), + // ), GoRoute( name: 'addstock', path: '/addstock', - builder: (context, state) => const AddStockPage(), + pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage( + key: state.pageKey, + child: const AddStockPage(), + transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, + Widget child) => + SlideTransition( + position: animation.drive( + Tween(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))), + child: child), + ), ), // GoRoute( // name: 'liststocks', diff --git a/lib/pages/add_medicine_page.dart b/lib/pages/add_medicine_page.dart index fe436f0..7f41481 100644 --- a/lib/pages/add_medicine_page.dart +++ b/lib/pages/add_medicine_page.dart @@ -1,10 +1,8 @@ -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:path_provider/path_provider.dart'; import 'package:pharmacy_mobile/blocs/caches/genericlist/functions/cache_getgenericlist.dart'; import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/functions/cache_getmanufacturerlist.dart'; import 'package:pharmacy_mobile/blocs/caches/typelist/functions/cache_gettypelist.dart'; diff --git a/lib/pages/add_stock_page.dart b/lib/pages/add_stock_page.dart index c17091c..ca5c8b1 100644 --- a/lib/pages/add_stock_page.dart +++ b/lib/pages/add_stock_page.dart @@ -52,7 +52,6 @@ class _AddStockPageState extends State with WidgetsBindingObserver Future _getMedicinesCache() async { final cache = await cacheGetMedicineList(context); - print('cache: $cache'); if (cache.isNotEmpty) { _medicineList = cache; @@ -65,7 +64,6 @@ class _AddStockPageState extends State with WidgetsBindingObserver void autoRun() async { final medicines = await _getMedicinesCache(); - print('medicines: $medicines'); if (!medicines) { if (await InternetConnectionChecker.instance.hasConnection) { @@ -75,7 +73,7 @@ class _AddStockPageState extends State with WidgetsBindingObserver showNotification(context, 'Error: No Internet Connection', false); WidgetsBinding.instance.addPostFrameCallback((_) { - context.push('/main'); + context.pop(); }); } } diff --git a/lib/pages/delete_stock_page.dart b/lib/pages/delete_stock_page.dart index e3078e5..7473573 100644 --- a/lib/pages/delete_stock_page.dart +++ b/lib/pages/delete_stock_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:internet_connection_checker/internet_connection_checker.dart'; -import 'package:pharmacy_mobile/blocs/caches/stocklist/functions/cache_getstocklist.dart'; import 'package:pharmacy_mobile/functions/checkresult_function.dart'; import 'package:pharmacy_mobile/functions/getlist_cache_function.dart'; import 'package:pharmacy_mobile/tables/stocks.dart'; @@ -51,17 +50,6 @@ class _DeleteStockPageState extends State { } } - // Future _getStocksCache() async { - // final cache = await cacheGetStockList(context); - - // if (cache.isNotEmpty) { - // _stockList = cache; - // return true; - // } else { - // return false; - // } - // } - void _updateStock(dynamic stock) { _selectedStock = stock; _getQuantity(_selectedStock); @@ -70,7 +58,7 @@ class _DeleteStockPageState extends State { void _saveDeletion() async { final newQuantity = _serverQuantity - double.parse(_quantityController.text); final newQuantityFixed = newQuantity.toStringAsFixed(0); - // log(newQuantityFixed); + try { _stocks.updateStock(_selectedUUID, 'quantity', newQuantityFixed); if (mounted) { diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index ac9f487..78ef53a 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:gap/gap.dart'; @@ -65,24 +63,6 @@ class _MainPageState extends State { } } - // void _getList() async { - // _categoryList = await _refCategories.getList(); - - // if (_categoryList.isEmpty) { - // if (mounted) { - // showNotification(context, 'Error: No Categories Found', false); - - // WidgetsBinding.instance.addPostFrameCallback((_) { - // if (mounted) { - // context.push('/main'); - // } - // }); - // } - // } else { - // setState(() => {}); - // } - // } - Future _getCategoryListCache() async { final categoryList = await _refCategories.getList();