hmxc
小赖 4 years ago
parent 524bcc1610
commit a2b2e4e691

@ -28,7 +28,7 @@ class BorrowGoodsDetailPage extends StatefulWidget {
class _BorrowGoodsDetailPageState extends State<BorrowGoodsDetailPage> { class _BorrowGoodsDetailPageState extends State<BorrowGoodsDetailPage> {
EasyRefreshController? _easyRefreshController; EasyRefreshController? _easyRefreshController;
late List<ArticleBorrowDetailModel> _models; List<ArticleBorrowDetailModel> _models = [];
bool _onload = true; bool _onload = true;
List<int?>? _selectItems = []; List<int?>? _selectItems = [];
bool get allSelect => _selectItems!.length == _models.length; bool get allSelect => _selectItems!.length == _models.length;
@ -54,13 +54,13 @@ class _BorrowGoodsDetailPageState extends State<BorrowGoodsDetailPage> {
body: EasyRefresh( body: EasyRefresh(
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { // onRefresh: () async {
List models = await (getModels()); // List<dynamic> models = await (getModels());
_models = // _models =
models.map((e) => ArticleBorrowDetailModel.fromJson(e)).toList(); // models.map((e) => ArticleBorrowDetailModel.fromJson(e)).toList();
_onload = false; // _onload = false;
setState(() {}); // setState(() {});
}, // },
child: _onload child: _onload
? _empty() ? _empty()
: ListView( : ListView(
@ -155,7 +155,7 @@ class _BorrowGoodsDetailPageState extends State<BorrowGoodsDetailPage> {
} }
Widget _empty() { Widget _empty() {
return Container(); return ListView();
} }
Future getModels() async { Future getModels() async {

@ -194,7 +194,7 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
.withRounded(value: 6.w) .withRounded(value: 6.w)
.make() .make()
.onInkTap(() async { .onInkTap(() async {
_receiveIds!.forEach((element) { _receiveIds?.forEach((element) {
_submitIds.remove(element); _submitIds.remove(element);
}); });
await Get.to(() => BorrowGoodsDetailPage( await Get.to(() => BorrowGoodsDetailPage(
@ -204,8 +204,8 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
.then((value) { .then((value) {
_receiveIds = value; _receiveIds = value;
}); });
_counts[index] = _receiveIds!.length; _counts[index] = _receiveIds?.length ?? 0;
_submitIds.addAll(_receiveIds!); _submitIds.addAll(_receiveIds ?? []);
setState(() {}); setState(() {});
}); });
} }

@ -2,7 +2,7 @@ name: aku_community
description: A new Flutter project. description: A new Flutter project.
publish_to: "none" publish_to: "none"
version: 1.2.0-dev+37 version: 1.3.0-dev+38
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"

Loading…
Cancel
Save