modify package list

This commit is contained in:
PhyoThandar
2020-06-24 16:06:15 +06:30
parent 3c147e0ecd
commit 76235bed4b
17 changed files with 52727 additions and 190 deletions

View File

@@ -0,0 +1,202 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/theme/theme.dart';
import 'package:fcs/vo/invoice.dart';
import 'package:fcs/vo/package.dart';
import 'package:fcs/widget/local_text.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/multi_img_controller.dart';
import 'package:fcs/widget/multi_img_file.dart';
import 'package:fcs/widget/my_data_table.dart';
import 'package:fcs/widget/number_cell.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
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;
PaymentPage({this.invoice});
@override
_PaymentPageState createState() => _PaymentPageState();
}
class _PaymentPageState extends State<PaymentPage> {
TextEditingController _addressEditingController = new TextEditingController();
TextEditingController _fromTimeEditingController =
new TextEditingController();
TextEditingController _toTimeEditingController = new TextEditingController();
TextEditingController _noOfPackageEditingController =
new TextEditingController();
TextEditingController _weightEditingController = new TextEditingController();
MultiImgController multiImgController = MultiImgController();
var dateFormatter = new DateFormat('dd MMM yyyy');
Invoice _invoice = new Invoice();
bool _isLoading = false;
List<String> _receipts = [
"assets/photos/1.jpg",
"assets/photos/2.jpg",
"assets/photos/3.jpg"
];
bool isNew;
@override
void initState() {
if (widget.invoice != null) {
_invoice = widget.invoice;
}
super.initState();
}
@override
void dispose() {
super.dispose();
}
final DateFormat dateFormat = DateFormat("d MMM yyyy");
@override
Widget build(BuildContext context) {
var owner = Provider.of<MainModel>(context).isOwner();
// var images = isNew ? [] : _images;
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("payment.title")),
),
body: Card(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
child: Row(
children: <Widget>[
Text(
'Remaining Balance : ',
style: TextStyle(fontSize: 16),
),
Text(
'${_invoice.amount}',
style: TextStyle(
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold),
)
],
)),
),
Expanded(
child: ListView(
children: [
ExpansionTile(
title: Text('Payment Attachment'),
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",
)
])),
SizedBox(
height: 25,
),
],
),
ExpansionTile(
title: Text('Receipt'),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 20,
columns: [
MyDataColumn(
label: LocalText(
context,
"payment.date",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"payment.amount",
color: Colors.grey,
),
),
],
rows: getPackageRow(context),
),
),
),
owner
? Container(
padding: EdgeInsets.only(top: 20),
child: Align(
alignment: Alignment.bottomRight,
child: FloatingActionButton.extended(
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context)
.text("invoice.add_box")),
backgroundColor: primaryColor,
onPressed: () {
// Navigator.of(context)
// .push(BottomUpPageRoute(PackageAddition()));
},
),
),
)
: Container(),
SizedBox(height: 25),
],
),
],
),
),
],
),
),
),
);
}
List<MyDataRow> getPackageRow(BuildContext context) {
return _invoice.receipts.map((r) {
return MyDataRow(
onSelectChanged: (bool selected) {},
cells: [
MyDataCell(
new Text(dateFormatter.format(r.date), style: textStyle),
),
MyDataCell(NumberCell(r.amount))
],
);
}).toList();
}
}