Merge branch 'master' of tzw/fcs into master
This commit is contained in:
@@ -364,6 +364,8 @@
|
|||||||
"box.ship.confirm":"Confirm ship?",
|
"box.ship.confirm":"Confirm ship?",
|
||||||
"box.arrive.confirm":"Confirm arrive?",
|
"box.arrive.confirm":"Confirm arrive?",
|
||||||
"box.invoice.confirm":"Confirm invoice?",
|
"box.invoice.confirm":"Confirm invoice?",
|
||||||
|
"box.print.qr.title":"Print QRCode",
|
||||||
|
"box.print.btn":"Print",
|
||||||
"Boxes End ================================================================":"",
|
"Boxes End ================================================================":"",
|
||||||
|
|
||||||
"Delivery Start ================================================================":"",
|
"Delivery Start ================================================================":"",
|
||||||
|
|||||||
@@ -364,6 +364,8 @@
|
|||||||
"box.ship.confirm":"ပို့ဆောင်မှုကို အတည်ပြုပါ ?",
|
"box.ship.confirm":"ပို့ဆောင်မှုကို အတည်ပြုပါ ?",
|
||||||
"box.arrive.confirm":"ရောက်ရှိကြောင်း အတည်ပြုပါ ?",
|
"box.arrive.confirm":"ရောက်ရှိကြောင်း အတည်ပြုပါ ?",
|
||||||
"box.invoice.confirm":"ပြေစာ အတည်ပြုပါ ?",
|
"box.invoice.confirm":"ပြေစာ အတည်ပြုပါ ?",
|
||||||
|
"box.print.qr.title":"QRCode ပရင့်ထုတ်ရန်",
|
||||||
|
"box.print.btn":"ပရင့်ထုတ်မည်",
|
||||||
"Boxes End ================================================================":"",
|
"Boxes End ================================================================":"",
|
||||||
|
|
||||||
"Delivery Start ================================================================":"",
|
"Delivery Start ================================================================":"",
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ Future<void> generateCartonPdf(Carton carton) async {
|
|||||||
style: pw.TextStyle(
|
style: pw.TextStyle(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
)),
|
)),
|
||||||
|
pw.SizedBox(height: 3),
|
||||||
pw.Text("${carton.actualWeight} lb",
|
pw.Text("${carton.actualWeight} lb",
|
||||||
style: pw.TextStyle(
|
style: pw.TextStyle(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
|||||||
CupertinoPageRoute(builder: (context) => CartonInfo(carton: c)),
|
CupertinoPageRoute(builder: (context) => CartonInfo(carton: c)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: CartonRow(box: c));
|
child: CartonRow(carton: c));
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import '../widgets/local_button.dart';
|
|||||||
import 'carton_package_editor.dart';
|
import 'carton_package_editor.dart';
|
||||||
import 'mix_carton/mix_carton_editor.dart';
|
import 'mix_carton/mix_carton_editor.dart';
|
||||||
import 'model/carton_model.dart';
|
import 'model/carton_model.dart';
|
||||||
|
import 'print_qr_code_page.dart';
|
||||||
|
|
||||||
class CartonInfo extends StatefulWidget {
|
class CartonInfo extends StatefulWidget {
|
||||||
final Carton carton;
|
final Carton carton;
|
||||||
@@ -100,7 +101,16 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
labelTextKey: "box.number",
|
labelTextKey: "box.number",
|
||||||
);
|
);
|
||||||
|
|
||||||
final cartonQrBox = DisplayText(iconData: AntDesign.qrcode);
|
final cartonQrBox = IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) => PrintQrCodePage(carton: _carton)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(AntDesign.qrcode, color: Colors.black));
|
||||||
|
|
||||||
final cartonSubTypeBox = DisplayText(
|
final cartonSubTypeBox = DisplayText(
|
||||||
text: _carton.cartonType == carton_from_packages
|
text: _carton.cartonType == carton_from_packages
|
||||||
? "Carton for packages"
|
? "Carton for packages"
|
||||||
@@ -315,8 +325,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
child: LocalText(context, "box.imageupload.title",
|
child: LocalText(context, "box.imageupload.title",
|
||||||
color: Colors.white, fontSize: 14)),
|
color: Colors.white, fontSize: 14)),
|
||||||
);
|
);
|
||||||
|
|
||||||
final deleteBtn = Padding(
|
final deleteBtn = Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||||
child: LocalButton(
|
child: LocalButton(
|
||||||
color: dangerColor,
|
color: dangerColor,
|
||||||
@@ -400,7 +410,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
img,
|
img,
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
deleteBtn,
|
deleteBtn,
|
||||||
const SizedBox(height: 20)
|
const SizedBox(height: 20)
|
||||||
]))));
|
]))));
|
||||||
}
|
}
|
||||||
@@ -446,7 +456,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
|||||||
_init();
|
_init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_delete() {
|
|
||||||
|
_delete() {
|
||||||
showConfirmDialog(context, "box.delete.confirm", () {
|
showConfirmDialog(context, "box.delete.confirm", () {
|
||||||
_deleteCarton();
|
_deleteCarton();
|
||||||
});
|
});
|
||||||
|
|||||||
64
lib/pages/carton/print_qr_code_page.dart
Normal file
64
lib/pages/carton/print_qr_code_page.dart
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import 'package:fcs/domain/entities/carton.dart';
|
||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_button.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
|
import '../../helpers/pdf.dart';
|
||||||
|
|
||||||
|
class PrintQrCodePage extends StatelessWidget {
|
||||||
|
final Carton carton;
|
||||||
|
const PrintQrCodePage({required this.carton});
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: LocalAppBar(
|
||||||
|
labelKey: "box.print.qr.title",
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
labelColor: primaryColor,
|
||||||
|
arrowColor: primaryColor,
|
||||||
|
actions: []),
|
||||||
|
body: ListView(
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
QrImageView(
|
||||||
|
data: 'This is a simple QR code',
|
||||||
|
version: QrVersions.auto,
|
||||||
|
size: 100,
|
||||||
|
gapless: true,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(carton.cartonNumber ?? "",
|
||||||
|
style: TextStyle(fontSize: 18,fontFamily: "Roboto")),
|
||||||
|
Text(carton.userName!, style: TextStyle(fontSize: 16,fontFamily: "Roboto")),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 3),
|
||||||
|
child: Text("${carton.actualWeight} lb",
|
||||||
|
style: TextStyle(fontSize: 16, color: labelColor,fontFamily: "Roboto")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
child: LocalButton(
|
||||||
|
textKey: "box.print.btn",
|
||||||
|
color: primaryColor,
|
||||||
|
iconData: Icons.print_outlined,
|
||||||
|
callBack: () {
|
||||||
|
generateCartonPdf(carton);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import 'package:fcs/domain/entities/carton.dart';
|
import 'package:fcs/domain/entities/carton.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/carton/model/carton_model.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import '../../../helpers/pdf.dart';
|
|
||||||
import '../carton_info.dart';
|
import '../carton_info.dart';
|
||||||
|
import '../print_qr_code_page.dart';
|
||||||
|
|
||||||
class CartonListRow extends StatelessWidget {
|
class CartonListRow extends StatelessWidget {
|
||||||
final Carton box;
|
final Carton box;
|
||||||
@@ -68,7 +66,12 @@ class CartonListRow extends StatelessWidget {
|
|||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_pdf(box, context);
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
PrintQrCodePage(carton: box)),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
icon:
|
icon:
|
||||||
Icon(AntDesign.qrcode, color: Colors.black))
|
Icon(AntDesign.qrcode, color: Colors.black))
|
||||||
@@ -107,11 +110,4 @@ class CartonListRow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pdf(Carton carton, BuildContext context) async {
|
|
||||||
Carton? c = await context.read<CartonModel>().getCarton(carton.id!);
|
|
||||||
if (c == null) return;
|
|
||||||
|
|
||||||
generateCartonPdf(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import 'package:fcs/domain/entities/carton.dart';
|
import 'package:fcs/domain/entities/carton.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../print_qr_code_page.dart';
|
||||||
|
|
||||||
class CartonRow extends StatelessWidget {
|
class CartonRow extends StatelessWidget {
|
||||||
final Carton box;
|
final Carton carton;
|
||||||
CartonRow({Key? key, required this.box}) : super(key: key);
|
CartonRow({Key? key, required this.carton}) : super(key: key);
|
||||||
|
|
||||||
final double dotSize = 15.0;
|
final double dotSize = 15.0;
|
||||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
@@ -23,25 +26,34 @@ class CartonRow extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(box.cartonNumber ?? "",
|
new Text(carton.cartonNumber ?? "",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.black)),
|
new TextStyle(fontSize: 15.0, color: Colors.black)),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
IconButton(onPressed: () {}, icon: Icon(AntDesign.qrcode)),
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
PrintQrCodePage(carton: carton)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(AntDesign.qrcode)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
box.cartonWeight == 0
|
carton.cartonWeight == 0
|
||||||
? Container()
|
? Container()
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
|
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${box.cartonWeight.toStringAsFixed(2)} lb",
|
"${carton.cartonWeight.toStringAsFixed(2)} lb",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ dependencies:
|
|||||||
flutter_vector_icons: ^2.0.0
|
flutter_vector_icons: ^2.0.0
|
||||||
open_file: ^3.3.2
|
open_file: ^3.3.2
|
||||||
pdf: ^3.10.8
|
pdf: ^3.10.8
|
||||||
|
qr_flutter: ^4.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user