add pagination
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/package_search/package_serach.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';
|
||||
@@ -33,7 +34,7 @@ class _ProcessingListState extends State<ProcessingList> {
|
||||
@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,
|
||||
@@ -52,33 +53,25 @@ class _ProcessingListState extends State<ProcessingList> {
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
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 ProcessingListRow(
|
||||
key: ValueKey(packageModel.packages[index].id),
|
||||
package: packageModel.packages[index],
|
||||
);
|
||||
})),
|
||||
body: PaginatorListView<Package>(
|
||||
paginatorListener: packages,
|
||||
rowBuilder: (p) => ProcessingListRow(
|
||||
key: ValueKey(p.id),
|
||||
package: p,
|
||||
),
|
||||
color: primaryColor,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user