add pagination
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:fcs/pages/package_search/package_serach.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:fcs/pagination/paginator_listview.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -25,7 +26,6 @@ class _ReceivingListState extends State<ReceivingList> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Provider.of<PackageModel>(context, listen: false).initData(false);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -36,7 +36,7 @@ class _ReceivingListState extends State<ReceivingList> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var packageModel = Provider.of<PackageModel>(context);
|
||||
bool isCustomer = context.select((MainModel m) => m.isCustomer());
|
||||
var packages = packageModel.activePackages;
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -55,44 +55,33 @@ class _ReceivingListState extends State<ReceivingList> {
|
||||
color: Colors.white,
|
||||
),
|
||||
actions: <Widget>[
|
||||
isCustomer
|
||||
? Container()
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
iconSize: 30,
|
||||
onPressed: () => searchPackage(context,
|
||||
callbackPackageSelect: _searchCallback),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
iconSize: 30,
|
||||
onPressed: () => searchPackage(context,
|
||||
callbackPackageSelect: _searchCallback),
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: isCustomer
|
||||
? Container()
|
||||
: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
_newReceiving();
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label:
|
||||
LocalText(context, "receiving.new", color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
height: 1,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: packageModel.packages.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ReceivingListRow(
|
||||
key: ValueKey(packageModel.packages[index].id),
|
||||
package: packageModel.packages[index],
|
||||
);
|
||||
})),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
_newReceiving();
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: LocalText(context, "receiving.new", color: Colors.white),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: PaginatorListView<Package>(
|
||||
paginatorListener: packages,
|
||||
rowBuilder: (p) => ReceivingListRow(
|
||||
key: ValueKey(p.id),
|
||||
package: p,
|
||||
),
|
||||
color: primaryColor,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user