Merge remote-tracking branch 'ptd/master'

This commit is contained in:
tzw
2021-09-13 08:47:01 +06:30

View File

@@ -15,9 +15,9 @@ class FcsShipmentModel extends BaseModel {
List<FcsShipment> _fcsShipments = []; List<FcsShipment> _fcsShipments = [];
List<FcsShipment> get fcsShipments => _selectedIndex == 1 List<FcsShipment> get fcsShipments => _selectedIndex == 1
? _fcsShipments ? _fcsShipments
: List<FcsShipment>.from(_shipped.values); : List<FcsShipment>.from(_shipped!.values);
late Paginator _shipped; Paginator? _shipped;
bool isLoading = false; bool isLoading = false;
int _selectedIndex = 1; int _selectedIndex = 1;
set selectedIndex(int index) { set selectedIndex(int index) {
@@ -37,9 +37,9 @@ class FcsShipmentModel extends BaseModel {
_selectedIndex = 1; _selectedIndex = 1;
_loadFcsShipments(); _loadFcsShipments();
if (_shipped != null) _shipped.close(); if (_shipped != null) _shipped!.close();
_shipped = _getShipped(); _shipped = _getShipped();
_shipped.load(); _shipped!.load();
} }
Future<void> _loadFcsShipments() async { Future<void> _loadFcsShipments() async {
@@ -84,10 +84,10 @@ class FcsShipmentModel extends BaseModel {
} }
Future<void> loadMore() async { Future<void> loadMore() async {
if (_shipped.ended || _selectedIndex == 1) return; if (_shipped!.ended || _selectedIndex == 1) return;
isLoading = true; isLoading = true;
notifyListeners(); notifyListeners();
await _shipped.load(onFinished: () { await _shipped!.load(onFinished: () {
isLoading = false; isLoading = false;
notifyListeners(); notifyListeners();
}); });
@@ -95,7 +95,7 @@ class FcsShipmentModel extends BaseModel {
Future<void> refresh() async { Future<void> refresh() async {
if (_selectedIndex == 1) return; if (_selectedIndex == 1) return;
await _shipped.refresh(onFinished: () { await _shipped!.refresh(onFinished: () {
notifyListeners(); notifyListeners();
}); });
} }
@@ -158,7 +158,7 @@ class FcsShipmentModel extends BaseModel {
@override @override
logout() async { logout() async {
if (listener != null) await listener!.cancel(); if (listener != null) await listener!.cancel();
if (_shipped != null) _shipped.close(); if (_shipped != null) _shipped!.close();
_fcsShipments = []; _fcsShipments = [];
} }