@@ -16,13 +16,14 @@ class CheckoutPage extends StatelessWidget {
1616
1717 @override
1818 Widget build (BuildContext context) {
19+ var checkoutItems = context.watch <CheckoutCN >().items;
1920 return Column (
2021 crossAxisAlignment: CrossAxisAlignment .start,
2122 children: [
2223 Text (
23- context. watch < CheckoutCN >().items .isEmpty
24+ checkoutItems .isEmpty
2425 ? 'Checkout'
25- : "Checkout - ${context . watch < CheckoutCN >(). items .length } item${context .read <CheckoutCN >().items .length == 1 ? '' : 's' }" ,
26+ : "Checkout - ${checkoutItems .length } item${context .read <CheckoutCN >().items .length == 1 ? '' : 's' }" ,
2627 style: MTextStyles .dsmMdGrey900,
2728 ),
2829 const SizedBox (height: 24 ),
@@ -38,7 +39,7 @@ class CheckoutPage extends StatelessWidget {
3839 }
3940 },
4041 title: (context.watch <CheckoutCN >().selected.length ==
41- context. watch < CheckoutCN >().items .length)
42+ checkoutItems .length)
4243 ? "Select None"
4344 : "Select All" ,
4445 ),
@@ -52,7 +53,7 @@ class CheckoutPage extends StatelessWidget {
5253 const Spacer (),
5354 MButton (
5455 onPressed: () {
55- if (context.read <DownloadCN >().downloadPath == '' ) {
56+ if (context.read <DownloadCN >().downloadPath.isEmpty ) {
5657 // show alertdialog
5758 showDialog (
5859 context: context,
@@ -92,21 +93,20 @@ class CheckoutPage extends StatelessWidget {
9293 child: Column (
9394 children: [
9495 const CheckoutTableHeader (),
95- if (context. watch < CheckoutCN >().items .isEmpty)
96+ if (checkoutItems .isEmpty)
9697 const NoCheckoutPlaceholder (),
97- for (var i = 0 , l = context.watch <CheckoutCN >().items;
98- i < l.length;
99- i++ ) ...[
98+ for (final (i, item) in checkoutItems.indexed)...[
10099 CheckoutEntryRow (
101- item: l. elementAt (i) ,
100+ item: item ,
102101 documentType: "Document" ,
103102 isSelected: context
104103 .watch <CheckoutCN >()
105104 .selected
106- .contains (l. elementAt (i) ),
107- isLast: i == l .length - 1 ,
105+ .contains (item ),
106+ isLast: i == checkoutItems .length - 1 ,
108107 ),
109- ],
108+ ]
109+ ,
110110 ],
111111 ),
112112 ),
0 commit comments