modify
This commit is contained in:
@@ -40,13 +40,26 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
TextEditingController _discountController = new TextEditingController();
|
||||
TextEditingController _amountController = new TextEditingController();
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
TextEditingController _handlingFeeController = new TextEditingController();
|
||||
TextEditingController _customFeeController = new TextEditingController();
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
TextEditingController _descriptionController = new TextEditingController();
|
||||
TextEditingController _balanceController = new TextEditingController();
|
||||
|
||||
Invoice _invoice;
|
||||
bool _isLoading = false;
|
||||
List<Box> _boxes = [];
|
||||
bool isSwitched = false;
|
||||
String deliveryfee = '\$0';
|
||||
List<Cargo> _cargoTypes = [
|
||||
Cargo(type: 'General Cargo', weight: 33, price: 6),
|
||||
Cargo(type: 'Medicine', weight: 33, price: 7),
|
||||
Cargo(type: 'Dangerous Cargo', weight: 33, price: 8)
|
||||
];
|
||||
|
||||
List<String> _receipts = [
|
||||
"assets/photos/amazon_ins.png",
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -57,10 +70,24 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_dateController.text = dateFormatter.format(_invoice.invoiceDate);
|
||||
_nameController.text = _invoice.customerName;
|
||||
_phoneController.text = _invoice.customerPhoneNumber;
|
||||
_amountController.text = _invoice.getAmount.toString();
|
||||
// _amountController.text = _invoice.getAmount.toString();
|
||||
_amountController.text = _invoice.amount.toString();
|
||||
_statusController.text = _invoice.status.toString();
|
||||
_handlingFeeController.text = '0';
|
||||
_customFeeController.text = '0';
|
||||
multiImgController.setImageUrls = _receipts;
|
||||
_descriptionController.text = 'For Electronics goods';
|
||||
_balanceController.text =
|
||||
(_invoice.amount - _invoice.receipts[0].amount).toString();
|
||||
// _boxes = _invoice.packages;
|
||||
} else {}
|
||||
} else {
|
||||
_dateController.text = dateFormatter.format(DateTime.now());
|
||||
_amountController.text = '0';
|
||||
_handlingFeeController.text = '0';
|
||||
_customFeeController.text = '0';
|
||||
_descriptionController.text = '';
|
||||
_balanceController.text = '0';
|
||||
}
|
||||
|
||||
_boxes = [
|
||||
Box(
|
||||
@@ -140,8 +167,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
fcsInput('Invoice Date', Icons.date_range,
|
||||
controller: _dateController),
|
||||
TextFormField(
|
||||
controller: _dateController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Invoice Date',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
Icons.date_range,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: Container(
|
||||
@@ -152,8 +193,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Invoice Number',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, color: Colors.grey),
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16,),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
@@ -173,7 +214,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customer Name',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, color: Colors.grey),
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
@@ -202,7 +243,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customer Name',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
fontSize: 16,),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
@@ -236,28 +277,6 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
// controller: _amountController),
|
||||
// ),
|
||||
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: TextFormField(
|
||||
controller: _amountController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Amount',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: Container(
|
||||
@@ -269,7 +288,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Status',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
fontSize: 16, ),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
@@ -280,13 +299,120 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: TextFormField(
|
||||
controller: _amountController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Amount',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _balanceController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Balance',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, ),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _handlingFeeController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Handling Fee',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _customFeeController,
|
||||
readOnly: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customs Fee',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey, width: 1.0)),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _descriptionController,
|
||||
readOnly: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customs Fee Description',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16,),
|
||||
filled: true,
|
||||
icon: Icon(
|
||||
Icons.comment,
|
||||
color: primaryColor,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey, width: 1.0)),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, left: 18),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text('Discounts',
|
||||
style: TextStyle(fontSize: 16))),
|
||||
child: Text(
|
||||
'Discounts',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
)),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
@@ -306,8 +432,13 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text('Payment Method',
|
||||
style: TextStyle(fontSize: 16))),
|
||||
child: Text(
|
||||
'Payment Method',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
)),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
@@ -330,7 +461,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
padding: const EdgeInsets.only(left: 18.0),
|
||||
child: Text(
|
||||
'Delivery fee:',
|
||||
style: TextStyle(fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
)),
|
||||
Switch(
|
||||
@@ -349,38 +483,70 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
activeTrackColor: primaryColor.withOpacity(0.8),
|
||||
activeColor: primaryColor,
|
||||
),
|
||||
Text('(Delivery fee : $deliveryfee)',style: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),),
|
||||
Text(
|
||||
'(Delivery fee : $deliveryfee)',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
|
||||
ExpansionTile(
|
||||
title: Text('Payment Attachment'),
|
||||
title: Text(
|
||||
'Payment Attachment',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(children: <Widget>[
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.payment",
|
||||
color: Colors.grey,
|
||||
fontSize: 14,
|
||||
),
|
||||
MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
widget.invoice != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Text(
|
||||
'${dateFormatter.format(_invoice.receipts[0].date)} ',
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 16),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: MultiImageFile(
|
||||
enabled: false,
|
||||
controller: multiImgController,
|
||||
title: "Receipt",
|
||||
)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10, left: 10),
|
||||
child: Text(
|
||||
'\$${_invoice.receipts[0].amount} ',
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
])),
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text('Box Information'),
|
||||
title: Text(
|
||||
'Box Information',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
@@ -446,9 +612,52 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
|
||||
//Cargo Table
|
||||
ExpansionTile(
|
||||
title: Text('Cargo Table'),
|
||||
children: getCargoTableByBox(context),
|
||||
),
|
||||
title: Text(
|
||||
'Cargo Table',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.type",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.weight",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.rate",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.amount",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getCargoDataRow(context)),
|
||||
),
|
||||
),
|
||||
]),
|
||||
]),
|
||||
)),
|
||||
widget.invoice == null
|
||||
@@ -511,23 +720,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
}
|
||||
|
||||
getCargoTableByBox(BuildContext context) {
|
||||
return _boxes.map((b) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey[100],
|
||||
width: 1,
|
||||
),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey[100],
|
||||
width: 1,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
@@ -560,20 +768,29 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getCargoDataRow(context, b),
|
||||
),
|
||||
),
|
||||
rows: getCargoDataRow(context)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getBoxRow(BuildContext context) {
|
||||
return _boxes.map((p) {
|
||||
p.cargoTypes.map((cargo) {
|
||||
print('cargo => $cargo');
|
||||
_cargoTypes.asMap().map((index, _cargo) {
|
||||
if (_cargo.type == cargo.type) {
|
||||
setState(() {
|
||||
_cargoTypes[index].weight += cargo.weight;
|
||||
});
|
||||
print('${_cargoTypes[index].type} =>${_cargoTypes[index]}');
|
||||
}
|
||||
});
|
||||
});
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
@@ -600,24 +817,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoDataRow(BuildContext context, Box box) {
|
||||
var rate = 5;
|
||||
return box.cargoTypes.map((p) {
|
||||
rate++;
|
||||
var amt = p.weight * rate;
|
||||
List<MyDataRow> getCargoDataRow(BuildContext context) {
|
||||
return _cargoTypes.map((cargo) {
|
||||
var amt = cargo.weight * cargo.price;
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
p.type,
|
||||
cargo.type,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
p.weight.toString(),
|
||||
cargo.weight.toString(),
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
'\$${rate}',
|
||||
'\$${cargo.price}',
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
|
||||
@@ -30,7 +30,6 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
final double dotSize = 15.0;
|
||||
Invoice _invoice = new Invoice();
|
||||
// String pdfPath = 'assets/Invoice-A092(A)-32.pdf';
|
||||
String pdfPath = '';
|
||||
|
||||
@override
|
||||
@@ -41,11 +40,12 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
_invoice = widget.invoice;
|
||||
}
|
||||
|
||||
// fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
|
||||
// setState(() {
|
||||
// pdfPath = f.path;
|
||||
// });
|
||||
// });
|
||||
fromAsset('assets/Invoice-A092(A)-32.pdf', 'Invoice-A092(A)-32.pdf')
|
||||
.then((f) {
|
||||
setState(() {
|
||||
pdfPath = f.path;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<File> fromAsset(String asset, String filename) async {
|
||||
@@ -73,21 +73,21 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
var owner = Provider.of<MainModel>(context).isOwner();
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
owner
|
||||
? Navigator.of(context)
|
||||
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
|
||||
: Navigator.pop(context);
|
||||
// Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
|
||||
// path: pdfPath,
|
||||
// )));
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
owner
|
||||
? Navigator.of(context).push(
|
||||
BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
|
||||
: Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PaymentPDFScreen(
|
||||
path: pdfPath,
|
||||
)));
|
||||
},
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@@ -127,39 +127,39 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(_invoice.status),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.payment,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PaymentPage(invoice: _invoice)));
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(_invoice.status),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.payment,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PaymentPage(invoice: _invoice)));
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
var act = actionSheet(context);
|
||||
showCupertinoModalPopup(
|
||||
context: context, builder: (BuildContext context) => act);
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
var act = actionSheet(context);
|
||||
showCupertinoModalPopup(
|
||||
context: context, builder: (BuildContext context) => act);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
class PaymentPage extends StatefulWidget {
|
||||
final Invoice invoice;
|
||||
@@ -40,9 +38,7 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
Invoice _invoice = new Invoice();
|
||||
bool _isLoading = false;
|
||||
List<String> _receipts = [
|
||||
"assets/photos/1.jpg",
|
||||
"assets/photos/2.jpg",
|
||||
"assets/photos/3.jpg"
|
||||
"assets/photos/amazon_ins.png",
|
||||
];
|
||||
bool isNew;
|
||||
|
||||
@@ -50,6 +46,7 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
void initState() {
|
||||
if (widget.invoice != null) {
|
||||
_invoice = widget.invoice;
|
||||
multiImgController.setImageUrls = _receipts;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
@@ -63,8 +60,6 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var owner = Provider.of<MainModel>(context).isOwner();
|
||||
|
||||
// var images = isNew ? [] : _images;
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -81,6 +76,23 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
LocalText(context, 'total.amount',
|
||||
color: Colors.black, fontSize: 16),
|
||||
Text(
|
||||
' \$ ${_invoice.amount}',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Container(
|
||||
@@ -89,7 +101,7 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
LocalText(context, 'remaining_balance',
|
||||
color: Colors.black, fontSize: 16),
|
||||
Text(
|
||||
'${_invoice.amount}',
|
||||
' \$ ${_invoice.amount - _invoice.receipts[0].amount}',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
@@ -105,21 +117,30 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
title: LocalText(context, 'payment.attachment',
|
||||
color: Colors.black, fontSize: 16),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(children: <Widget>[
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.payment",
|
||||
color: Colors.grey,
|
||||
fontSize: 14,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'${dateFormatter.format(_invoice.receipts[0].date)} ',
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 16),
|
||||
),
|
||||
),
|
||||
MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)
|
||||
])),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user