add slide to stock and cleanup
This commit is contained in:
parent
b892cc485f
commit
1222f15766
5 changed files with 17 additions and 39 deletions
|
|
@ -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<void>(
|
||||
key: state.pageKey,
|
||||
child: const AddStockPage(),
|
||||
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation,
|
||||
Widget child) =>
|
||||
SlideTransition(
|
||||
position: animation.drive(
|
||||
Tween<Offset>(begin: Offset(0.95, 0), end: Offset.zero).chain(CurveTween(curve: Curves.easeIn))),
|
||||
child: child),
|
||||
),
|
||||
),
|
||||
// GoRoute(
|
||||
// name: 'liststocks',
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
|
||||
Future<bool> _getMedicinesCache() async {
|
||||
final cache = await cacheGetMedicineList(context);
|
||||
print('cache: $cache');
|
||||
|
||||
if (cache.isNotEmpty) {
|
||||
_medicineList = cache;
|
||||
|
|
@ -65,7 +64,6 @@ class _AddStockPageState extends State<AddStockPage> 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<AddStockPage> with WidgetsBindingObserver
|
|||
showNotification(context, 'Error: No Internet Connection', false);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.push('/main');
|
||||
context.pop();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<DeleteStockPage> {
|
|||
}
|
||||
}
|
||||
|
||||
// Future<bool> _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<DeleteStockPage> {
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -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<MainPage> {
|
|||
}
|
||||
}
|
||||
|
||||
// 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<void> _getCategoryListCache() async {
|
||||
final categoryList = await _refCategories.getList();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue