add cache for stocks
This commit is contained in:
parent
92df0af895
commit
de5a7c66a3
11 changed files with 134 additions and 3 deletions
|
|
@ -9,12 +9,14 @@ import 'package:pharmacy_mobile/blocs/caches/categorylist/functions/cache_setcat
|
|||
import 'package:pharmacy_mobile/blocs/caches/genericlist/functions/cache_setgenericlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/manufacturerlist/functions/cache_setmanufacturerlist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/medicinelist/functions/cache_setmedicinelist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/stocklist/functions/cache_setstocklist.dart';
|
||||
import 'package:pharmacy_mobile/blocs/caches/typelist/functions/cache_settypelist.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_manufacturers.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_types.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/menu_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
|
|
@ -37,6 +39,7 @@ class _MainPageState extends State<MainPage> {
|
|||
final _refTypes = RefTypes();
|
||||
final _refManufacturers = RefManufacturers();
|
||||
final _refMedicines = RefMedicines();
|
||||
final _stocks = Stocks();
|
||||
|
||||
late bool _isLoading = false;
|
||||
|
||||
|
|
@ -130,12 +133,23 @@ class _MainPageState extends State<MainPage> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _getStockListCache() async {
|
||||
final stockList = await _stocks.getList();
|
||||
|
||||
if (stockList.isNotEmpty) {
|
||||
// ignore: use_build_context_synchronously
|
||||
final setCache = await cacheSetStockList(context, stockList);
|
||||
if (!setCache) {}
|
||||
}
|
||||
}
|
||||
|
||||
void autoRun() async {
|
||||
await _getCategoryListCache();
|
||||
await _getGenericListCache();
|
||||
await _getTypeListCache();
|
||||
await _getManufacturerListCache();
|
||||
await _getMedicineListCache();
|
||||
await _getStockListCache();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue