Merge branch 'master' of phyothandar/fcs into master

This commit is contained in:
2020-06-26 00:46:49 +00:00
committed by Gogs
10 changed files with 319 additions and 150 deletions

View File

@@ -1,6 +1,7 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:barcode_scan/model/scan_result.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:fcs/model/product_model.dart';
@@ -26,49 +27,6 @@ class _BarcodeScreenPageState extends State<BarcodeScreenPage> {
super.initState();
}
Widget showProducts(BuildContext context, ProductModel productModel) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Icon(
FontAwesomeIcons.tag,
color: primaryColor,
size: 20,
),
SizedBox(
width: 20,
),
new Flexible(
child: Container(
width: 170.0,
child: DropdownButton<String>(
// value: currentProductID,
isExpanded: true,
hint: Text(
'Select Product',
style: labelStyle,
),
onChanged: changedProduct,
items: productModel.products
.map<DropdownMenuItem<String>>((Product product) {
return new DropdownMenuItem<String>(
value: product.id,
child: new Text(product.name, style: textStyle),
);
}).toList(),
),
),
),
],
);
}
void changedProduct(selected) {
setState(() {
// currentProductID = selected;
});
}
@override
Widget build(BuildContext context) {
return LocalProgress(
@@ -82,9 +40,24 @@ class _BarcodeScreenPageState extends State<BarcodeScreenPage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RaisedButton(
child: Icon(Icons.scanner),
onPressed: () async {
InkWell(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Scan : ",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 20),
),
Icon(
Ionicons.ios_qr_scanner,
size: 50,
),
],
),
onTap: () async {
await scan();
},
)
@@ -98,15 +71,4 @@ class _BarcodeScreenPageState extends State<BarcodeScreenPage> {
print("ScanResult => $result");
setState(() => scanResult = result);
}
// _save() {
// if (currentProductID == null) return;
// this.buyerProduct.productID = currentProductID;
// var productName =
// Provider.of<ProductModel>(context).getProductName(currentProductID);
// this.buyerProduct.productName = productName;
// this.buyerProduct.storageCapacityQty = int.parse(_storage.text);
// this.buyerProduct.dailySaleQty = int.parse(_sales.text);
// Navigator.pop<BuyerProduct>(context, this.buyerProduct);
// }
}

View File

@@ -298,7 +298,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: FloatingActionButton.extended(
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context)
.text("invoice.add_box")),
.text("invoice.add_package")),
backgroundColor: primaryColor,
onPressed: () {
Navigator.of(context)

View File

@@ -41,11 +41,11 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
_invoice = widget.invoice;
}
fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
setState(() {
pdfPath = f.path;
});
});
// fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
// setState(() {
// pdfPath = f.path;
// });
// });
}
Future<File> fromAsset(String asset, String filename) async {
@@ -62,7 +62,7 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
await file.writeAsBytes(bytes, flush: true);
completer.complete(file);
} catch (e) {
throw Exception('Error parsing asset file!'+ e.toString());
throw Exception('Error parsing asset file! ===> ' + e.toString());
}
return completer.future;
@@ -78,9 +78,10 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
owner
? Navigator.of(context)
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
: Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
path: pdfPath,
)));
: Navigator.pop(context);
// Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
// path: pdfPath,
// )));
},
child: Row(
children: <Widget>[
@@ -167,7 +168,18 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
return CupertinoActionSheet(
actions: <Widget>[
CupertinoActionSheetAction(
child: Text("Download"),
child: Row(
children: <Widget>[
Icon(Icons.file_download),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'Download',
style: TextStyle(fontSize: 16, color: Colors.black),
),
),
],
),
onPressed: () {
Navigator.pop(context);
},

View File

@@ -86,10 +86,8 @@ class _PaymentPageState extends State<PaymentPage> {
child: Container(
child: Row(
children: <Widget>[
Text(
'Remaining Balance : ',
style: TextStyle(fontSize: 16),
),
LocalText(context, 'remaining_balance',
color: Colors.black, fontSize: 16),
Text(
'${_invoice.amount}',
style: TextStyle(
@@ -104,7 +102,8 @@ class _PaymentPageState extends State<PaymentPage> {
child: ListView(
children: [
ExpansionTile(
title: Text('Payment Attachment'),
title: LocalText(context, 'payment.attachment',
color: Colors.black, fontSize: 16),
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 20),
@@ -127,7 +126,8 @@ class _PaymentPageState extends State<PaymentPage> {
],
),
ExpansionTile(
title: Text('Receipt'),
title: LocalText(context, 'payment.receipt',
color: Colors.black, fontSize: 16),
children: <Widget>[
Container(
child: SingleChildScrollView(
@@ -155,24 +155,6 @@ class _PaymentPageState extends State<PaymentPage> {
),
),
),
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),
],
),

View File

@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:fcs/theme/theme.dart';
import 'package:fcs/widget/local_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart';
@@ -29,7 +30,8 @@ class _PaymentPDFScreenState extends State<PaymentPDFScreen>
return Scaffold(
appBar: AppBar(
backgroundColor: primaryColor,
title: Text("Document"),
title: LocalText(context, 'pdf_view.title',
color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
icon: Icon(Icons.share),