null safety
This commit is contained in:
@@ -50,9 +50,9 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
_loadInvoice() async {
|
||||
InvoiceModel invoiceModel =
|
||||
Provider.of<InvoiceModel>(context, listen: false);
|
||||
Invoice i = await invoiceModel.getInvoice(_invoice.id);
|
||||
Invoice? i = await invoiceModel.getInvoice(_invoice.id!);
|
||||
setState(() {
|
||||
_invoice = i;
|
||||
_invoice = i!;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("pm_.title")),
|
||||
title: Text(AppTranslations.of(context)!.text("pm_.title")),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
@@ -130,74 +130,73 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
List<Widget> dataRow = [];
|
||||
|
||||
dataRow = _invoice.payments.map((p) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.grey))),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: Text(
|
||||
'${p.paymentDate != null ? dateFormatter.format(p.paymentDate!) : ""}'),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
LocalImagePicker(
|
||||
key: ValueKey(p.id),
|
||||
enabled: false,
|
||||
initialImgUrl: p.paymentReceiptURL!,
|
||||
title: "Receipt",
|
||||
color: primaryColor,
|
||||
)
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: Text(
|
||||
'${p.paymentDate != null ? dateFormatter.format(p.paymentDate) : ""}'),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
LocalImagePicker(
|
||||
key: ValueKey(p.id),
|
||||
enabled: false,
|
||||
initialImgUrl: p.paymentReceiptURL,
|
||||
title: "Receipt",
|
||||
color: primaryColor,
|
||||
)
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
children: [Text('\$ ${p.amount}'), Text('${p.status}')],
|
||||
))),
|
||||
widget.forCustomer!
|
||||
? Container()
|
||||
: Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [Text('\$ ${p.amount}'), Text('${p.status}')],
|
||||
))),
|
||||
widget.forCustomer!
|
||||
? Container()
|
||||
: Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: p.status == payment_pending_status
|
||||
? [
|
||||
InkWell(
|
||||
onTap: () => _confirm(p),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: p.status == payment_pending_status
|
||||
? [
|
||||
InkWell(
|
||||
onTap: () => _confirm(p),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: primaryColor,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => _cancel(p),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(Icons.close,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
]
|
||||
: [],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList() ;
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => _cancel(p),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(Icons.close, color: primaryColor),
|
||||
),
|
||||
),
|
||||
]
|
||||
: [],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
dataRow.insert(
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user