Merge branch 'master' of tzw/fcs into master
This commit is contained in:
@@ -54,20 +54,13 @@ class Setting {
|
|||||||
emailAddress: map['email_address'],
|
emailAddress: map['email_address'],
|
||||||
facebookLink: map['facebook_link'],
|
facebookLink: map['facebook_link'],
|
||||||
about: map['about'],
|
about: map['about'],
|
||||||
termsEng: map['terms_eng'],
|
termsEng: map['terms_eng_markdown'],
|
||||||
termsMm: map['terms_mm'],
|
termsMm: map['terms_mm_markdown'],
|
||||||
shipmentTypes: List.from(map['shipment_types']),
|
shipmentTypes: List.from(map['shipment_types']),
|
||||||
courierWebsite: map['courier_website'],
|
courierWebsite: map['courier_website'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {
|
|
||||||
'terms_eng': termsEng,
|
|
||||||
'terms_mm': termsMm,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Setting{supportBuildNum:$supportBuildNum,about:$about}';
|
return 'Setting{supportBuildNum:$supportBuildNum,about:$about}';
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Future<void> generateCartonPdf(Carton carton) async {
|
|||||||
height: 50,
|
height: 50,
|
||||||
color: PdfColor.fromHex("#000000"),
|
color: PdfColor.fromHex("#000000"),
|
||||||
barcode: pw.Barcode.qrCode(),
|
barcode: pw.Barcode.qrCode(),
|
||||||
data: carton.cartonNumber!),
|
data: carton.cartonNumber ?? ""),
|
||||||
pw.Padding(
|
pw.Padding(
|
||||||
padding: const pw.EdgeInsets.all(5),
|
padding: const pw.EdgeInsets.all(5),
|
||||||
child: pw.Column(
|
child: pw.Column(
|
||||||
|
|||||||
@@ -26,21 +26,24 @@ class PrintQrCodePage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
QrImageView(
|
QrImageView(
|
||||||
data: 'This is a simple QR code',
|
data: carton.cartonNumber ?? "",
|
||||||
version: QrVersions.auto,
|
version: QrVersions.auto,
|
||||||
size: 100,
|
size: 100,
|
||||||
gapless: true,
|
gapless: true),
|
||||||
),
|
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(carton.cartonNumber ?? "",
|
Text(carton.cartonNumber ?? "",
|
||||||
style: TextStyle(fontSize: 18, fontFamily: "Roboto")),
|
style: TextStyle(fontSize: 18, fontFamily: "Roboto")),
|
||||||
Text(carton.userName!, style: TextStyle(fontSize: 16,fontFamily: "Roboto")),
|
Text(carton.userName!,
|
||||||
|
style: TextStyle(fontSize: 16, fontFamily: "Roboto")),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 3),
|
padding: const EdgeInsets.only(top: 3),
|
||||||
child: Text("${carton.actualWeight} lb",
|
child: Text("${carton.actualWeight} lb",
|
||||||
style: TextStyle(fontSize: 16, color: labelColor,fontFamily: "Roboto")),
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: labelColor,
|
||||||
|
fontFamily: "Roboto")),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CartonListRow extends StatelessWidget {
|
|||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(left: 5),
|
padding: EdgeInsets.only(left: 0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
MaterialCommunityIcons.package,
|
MaterialCommunityIcons.package,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
@@ -42,7 +42,7 @@ class CartonListRow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
new Expanded(
|
new Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 18.0),
|
padding: const EdgeInsets.only(left: 15.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
new Column(
|
new Column(
|
||||||
@@ -98,7 +98,7 @@ class CartonListRow extends StatelessWidget {
|
|||||||
new Text(
|
new Text(
|
||||||
"${box.cartonWeight.toStringAsFixed(2)} lb",
|
"${box.cartonWeight.toStringAsFixed(2)} lb",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late String dialCode;
|
late String dialCode;
|
||||||
|
final _inviteFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -36,7 +37,15 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
final nameBox = InputText(
|
final nameBox = InputText(
|
||||||
labelTextKey: 'customer.name',
|
labelTextKey: 'customer.name',
|
||||||
iconData: Icons.person,
|
iconData: Icons.person,
|
||||||
controller: _nameController);
|
controller: _nameController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert name";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -56,7 +65,9 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
|
key: _inviteFormKey,
|
||||||
|
child: Container(
|
||||||
padding: EdgeInsets.all(18),
|
padding: EdgeInsets.all(18),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -75,7 +86,8 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border:
|
border:
|
||||||
Border.all(color: Colors.grey.shade400, width: 1),
|
Border.all(color: Colors.grey.shade400, width: 1),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12.0))),
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(12.0))),
|
||||||
child: CountryCodePicker(
|
child: CountryCodePicker(
|
||||||
onChanged: _countryChange,
|
onChanged: _countryChange,
|
||||||
initialSelection: dialCode,
|
initialSelection: dialCode,
|
||||||
@@ -83,11 +95,12 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
showCountryOnly: false,
|
showCountryOnly: false,
|
||||||
showOnlyCountryWhenClosed: false,
|
showOnlyCountryWhenClosed: false,
|
||||||
alignLeft: false,
|
alignLeft: false,
|
||||||
textStyle: TextStyle(fontSize: 16, color: Colors.black87),
|
textStyle:
|
||||||
|
TextStyle(fontSize: 16, color: Colors.black87),
|
||||||
searchDecoration: InputDecoration(
|
searchDecoration: InputDecoration(
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide:
|
borderSide: BorderSide(
|
||||||
BorderSide(color: Colors.black, width: 1.0))),
|
color: Colors.black, width: 1.0))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -106,14 +119,24 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
),
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
labelText: getLocalString(context, "customer.phone"),
|
labelText:
|
||||||
|
getLocalString(context, "customer.phone"),
|
||||||
labelStyle:
|
labelStyle:
|
||||||
TextStyle(fontSize: 16, color: Colors.grey),
|
TextStyle(fontSize: 16, color: Colors.grey),
|
||||||
filled: true,
|
filled: true,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide:
|
borderSide: BorderSide(
|
||||||
BorderSide(color: Colors.grey, width: 1.0)),
|
color: Colors.grey, width: 1.0)),
|
||||||
),
|
errorStyle: TextStyle(
|
||||||
|
color: dangerColor,
|
||||||
|
)),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert phone no";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -126,6 +149,7 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,9 +162,9 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
_invite() async {
|
_invite() async {
|
||||||
String userName = _nameController.text;
|
String userName = _nameController.text;
|
||||||
String phoneNumber = dialCode + _phoneController.text;
|
String phoneNumber = dialCode + _phoneController.text;
|
||||||
if (userName == "" || phoneNumber == "") {
|
|
||||||
showMsgDialog(context, "Error", "Invalid name or phone number");
|
if (!_inviteFormKey.currentState!.validate()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
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/main/util.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';
|
||||||
@@ -9,8 +8,8 @@ import 'package:intl/intl.dart';
|
|||||||
import 'delivery_info.dart';
|
import 'delivery_info.dart';
|
||||||
|
|
||||||
class DeliveryListRow extends StatelessWidget {
|
class DeliveryListRow extends StatelessWidget {
|
||||||
final Carton? box;
|
final Carton box;
|
||||||
DeliveryListRow({Key? key, this.box}) : super(key: key);
|
DeliveryListRow({Key? key, required this.box}) : 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");
|
||||||
@@ -19,10 +18,9 @@ class DeliveryListRow extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (box != null)
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box!)),
|
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -31,33 +29,26 @@ class DeliveryListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Icon(MaterialCommunityIcons.truck_fast,
|
||||||
padding: EdgeInsets.only(left: 5, right: 10),
|
color: primaryColor, size: 30),
|
||||||
child: Icon(
|
|
||||||
MaterialCommunityIcons.truck_fast,
|
|
||||||
color: primaryColor,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
box.cartonNumber ?? "",
|
||||||
child: new Text(
|
|
||||||
box?.cartonNumber ?? "",
|
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
box?.userName ?? "",
|
box.userName ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -65,24 +56,27 @@ class DeliveryListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(box.status ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: getStatus(box?.status ?? ''),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${box?.actualWeight.toString() ?? ''} lb",
|
"${box.actualWeight.toString()} lb",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ typedef OnSelect(Discount discount);
|
|||||||
|
|
||||||
class DiscountListRow extends StatelessWidget {
|
class DiscountListRow extends StatelessWidget {
|
||||||
final OnSelect? onSelect;
|
final OnSelect? onSelect;
|
||||||
final Discount? discount;
|
final Discount discount;
|
||||||
DiscountListRow({Key? key, this.discount, this.onSelect}) : super(key: key);
|
DiscountListRow({Key? key, required this.discount, this.onSelect})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
@@ -17,9 +18,7 @@ class DiscountListRow extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (onSelect != null && discount != null) {
|
onSelect!(discount);
|
||||||
onSelect!(discount!);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 15, right: 15),
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
@@ -27,33 +26,25 @@ class DiscountListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Icon(Entypo.price_ribbon, color: primaryColor, size: 30),
|
||||||
padding: EdgeInsets.only(left: 5, right: 10),
|
|
||||||
child: Icon(
|
|
||||||
Entypo.price_ribbon,
|
|
||||||
color: primaryColor,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
discount.code ?? "",
|
||||||
child: new Text(
|
|
||||||
discount?.code ?? "",
|
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
discount?.customerName ?? "",
|
discount.customerName ?? "",
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.grey),
|
fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -61,22 +52,23 @@ class DiscountListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(discount.status ?? ''),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.only(
|
||||||
child: Text(discount?.status ?? ''),
|
top: 5,
|
||||||
),
|
),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
new Text(
|
||||||
"${discount?.amount.toStringAsFixed(2) ?? ''}",
|
"${discount.amount.toStringAsFixed(2)}",
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.number",
|
labelTextKey: "FCSshipment.number",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
controller: _shipmentNumberController,
|
controller: _shipmentNumberController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Enter shipment number";
|
return "Enter shipment number";
|
||||||
@@ -132,6 +133,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.cutoff_date",
|
labelTextKey: "FCSshipment.cutoff_date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _cutoffDateController,
|
controller: _cutoffDateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Select cutoff date";
|
return "Select cutoff date";
|
||||||
@@ -143,6 +145,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.ETA",
|
labelTextKey: "FCSshipment.ETA",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _arrivalDateController,
|
controller: _arrivalDateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Select ETA date";
|
return "Select ETA date";
|
||||||
|
|||||||
@@ -24,20 +24,17 @@ class FcsShipmentListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Icon(
|
||||||
padding: EdgeInsets.only(left: 5),
|
|
||||||
child: Icon(
|
|
||||||
Ionicons.ios_airplane,
|
Ionicons.ios_airplane,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
size: 30,
|
size: 30,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 18.0),
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
|
||||||
import 'package:fcs/pages/package/package_info.dart';
|
import 'package:fcs/pages/package/package_info.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -11,14 +10,14 @@ typedef CallbackPackageSelect(Package package);
|
|||||||
|
|
||||||
class PackageListRow extends StatelessWidget {
|
class PackageListRow extends StatelessWidget {
|
||||||
final bool isCustomer;
|
final bool isCustomer;
|
||||||
final Package? package;
|
final Package package;
|
||||||
final CallbackPackageSelect? callbackPackageSelect;
|
final CallbackPackageSelect? callbackPackageSelect;
|
||||||
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");
|
||||||
|
|
||||||
PackageListRow(
|
PackageListRow(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
this.package,
|
required this.package,
|
||||||
this.callbackPackageSelect,
|
this.callbackPackageSelect,
|
||||||
this.isCustomer = false})
|
this.isCustomer = false})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@@ -28,7 +27,7 @@ class PackageListRow extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (callbackPackageSelect != null) {
|
if (callbackPackageSelect != null) {
|
||||||
callbackPackageSelect!(package!);
|
callbackPackageSelect!(package);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
@@ -48,31 +47,27 @@ class PackageListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Octicons.package, color: primaryColor),
|
Icon(Octicons.package, color: primaryColor),
|
||||||
SizedBox(width: 8),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
package.id == null ? '' : package.trackingID!,
|
||||||
child: new Text(
|
|
||||||
package!.id == null
|
|
||||||
? ''
|
|
||||||
: package!.trackingID!,
|
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.market == null
|
package.market == null
|
||||||
? ''
|
? ''
|
||||||
: package!.market!,
|
: package.market!,
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -80,24 +75,27 @@ class PackageListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(package.status ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(3.0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: getStatus(package!.status??""),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.currentStatusDate != null
|
package.currentStatusDate != null
|
||||||
? dateFormat.format(package!.currentStatusDate!)
|
? dateFormat.format(package.currentStatusDate!)
|
||||||
: '',
|
: '',
|
||||||
style:
|
style:
|
||||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:fcs/domain/entities/pickup.dart';
|
|||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/pickup/pickup_info.dart';
|
import 'package:fcs/pages/pickup/pickup_info.dart';
|
||||||
import 'package:fcs/pages/pickup/pickup_list_row.dart';
|
import 'package:fcs/pages/pickup/pickup_list_row.dart';
|
||||||
import 'package:fcs/pages/pickup_search/pickup_serach.dart';
|
import 'package:fcs/pages/pickup_search/pickup_search.dart';
|
||||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:fcs/pagination/paginator_listview.dart';
|
import 'package:fcs/pagination/paginator_listview.dart';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:fcs/domain/entities/pickup.dart';
|
import 'package:fcs/domain/entities/pickup.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.dart';
|
|
||||||
import 'package:fcs/pages/pickup/pickup_info.dart';
|
import 'package:fcs/pages/pickup/pickup_info.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -37,31 +36,27 @@ class PickupListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Icon(
|
||||||
padding: EdgeInsets.only(left: 5, right: 10),
|
|
||||||
child: Icon(
|
|
||||||
SimpleLineIcons.direction,
|
SimpleLineIcons.direction,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
size: 30,
|
size: 30,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15.0),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
|
||||||
child: new Text(
|
|
||||||
pickup?.pickupNumber ?? '',
|
pickup?.pickupNumber ?? '',
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
pickup!.pickupDate != null
|
pickup!.pickupDate != null
|
||||||
? dateFormat.format(pickup!.pickupDate!)
|
? dateFormat.format(pickup!.pickupDate!)
|
||||||
@@ -73,15 +68,21 @@ class PickupListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Text(pickup?.status ?? "",
|
||||||
children: <Widget>[
|
style: TextStyle(
|
||||||
getStatus(pickup!.status ?? ""),
|
color: primaryColor,
|
||||||
],
|
fontSize: 15,
|
||||||
)
|
fontWeight: FontWeight.bold)),
|
||||||
|
// Column(
|
||||||
|
// children: <Widget>[
|
||||||
|
// getStatus(pickup!.status ?? ""),
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.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';
|
||||||
@@ -11,12 +10,13 @@ import 'processing_info.dart';
|
|||||||
typedef CallbackPackageSelect(Package package);
|
typedef CallbackPackageSelect(Package package);
|
||||||
|
|
||||||
class ProcessingListRow extends StatelessWidget {
|
class ProcessingListRow extends StatelessWidget {
|
||||||
final Package? package;
|
final Package package;
|
||||||
final CallbackPackageSelect? callbackPackageSelect;
|
final CallbackPackageSelect? callbackPackageSelect;
|
||||||
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");
|
||||||
|
|
||||||
ProcessingListRow({Key? key, this.package, this.callbackPackageSelect})
|
ProcessingListRow(
|
||||||
|
{Key? key, required this.package, this.callbackPackageSelect})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -24,7 +24,7 @@ class ProcessingListRow extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (callbackPackageSelect != null) {
|
if (callbackPackageSelect != null) {
|
||||||
callbackPackageSelect!(package!);
|
callbackPackageSelect!(package);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
@@ -39,33 +39,27 @@ class ProcessingListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Icon(FontAwesome.dropbox, color: primaryColor, size: 30),
|
||||||
padding: EdgeInsets.only(left: 5, right: 10),
|
|
||||||
child: Icon(
|
|
||||||
FontAwesome.dropbox,
|
|
||||||
color: primaryColor,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
package.trackingID == null
|
||||||
child: new Text(
|
? ''
|
||||||
package!.id == null ? '' : package!.trackingID!,
|
: package.trackingID!,
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(top: 5.0),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.market == null ? '' : package!.market!,
|
package.market == null ? '' : package.market!,
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -73,23 +67,26 @@ class ProcessingListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(package.status ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(3.0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: getStatus(package!.status??""),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.currentStatusDate != null
|
package.currentStatusDate != null
|
||||||
? dateFormat.format(package!.currentStatusDate!)
|
? dateFormat.format(package.currentStatusDate!)
|
||||||
: '',
|
: '',
|
||||||
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
|
style: new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late CargoType _cargo;
|
late CargoType _cargo;
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
final _cargoFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -47,11 +48,26 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
final typeBox = InputText(
|
final typeBox = InputText(
|
||||||
labelTextKey: 'cargo.type',
|
labelTextKey: 'cargo.type',
|
||||||
iconData: Icons.text_format,
|
iconData: Icons.text_format,
|
||||||
controller: _descController);
|
controller: _descController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "Please insert cargo type";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},);
|
||||||
final rateBox = InputText(
|
final rateBox = InputText(
|
||||||
labelTextKey: 'cargo.rate',
|
labelTextKey: 'cargo.rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _rateController);
|
controller: _rateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -78,7 +94,9 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
|
key: _cargoFormKey,
|
||||||
|
child: Container(
|
||||||
padding: EdgeInsets.all(18),
|
padding: EdgeInsets.all(18),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -98,12 +116,12 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_rateController.text == "") {
|
if (!_cargoFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
CargoType _custom = new CargoType();
|
CargoType _custom = new CargoType();
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
final _customFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -50,16 +51,39 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
final productBox = InputText(
|
final productBox = InputText(
|
||||||
labelTextKey: 'rate.cutom.product_type',
|
labelTextKey: 'rate.cutom.product_type',
|
||||||
iconData: FontAwesomeIcons.weightHanging,
|
iconData: FontAwesomeIcons.weightHanging,
|
||||||
controller: _productController);
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
controller: _productController,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "Please insert product type";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},);
|
||||||
final feeBox = InputText(
|
final feeBox = InputText(
|
||||||
labelTextKey: 'rate.custom.fee',
|
labelTextKey: 'rate.custom.fee',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _feeController);
|
controller: _feeController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert fee";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
final shipmentRateBox = InputText(
|
final shipmentRateBox = InputText(
|
||||||
labelTextKey: 'rate.custom.shipment_rate',
|
labelTextKey: 'rate.custom.shipment_rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _shipmentRateController);
|
controller: _shipmentRateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert shipment rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -86,7 +110,9 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
|
key: _customFormKey,
|
||||||
|
child: Container(
|
||||||
padding: EdgeInsets.all(18),
|
padding: EdgeInsets.all(18),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -107,17 +133,12 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_feeController.text == "") {
|
if (!_customFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert fee");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_shipmentRateController.text == "") {
|
|
||||||
showMsgDialog(context, "Error", "Please insert shipment rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||||
|
final _discountFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -48,11 +49,27 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
final weightBox = InputText(
|
final weightBox = InputText(
|
||||||
labelTextKey: 'rate.discount.weight',
|
labelTextKey: 'rate.discount.weight',
|
||||||
iconData: FontAwesomeIcons.weightHanging,
|
iconData: FontAwesomeIcons.weightHanging,
|
||||||
controller: _weightController);
|
controller: _weightController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please inset weight";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
final discountRateBox = InputText(
|
final discountRateBox = InputText(
|
||||||
labelTextKey: 'rate.discount.rate',
|
labelTextKey: 'rate.discount.rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _discountController);
|
controller: _discountController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert discount rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -80,7 +97,9 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
|
key: _discountFormKey,
|
||||||
|
child: Container(
|
||||||
padding: EdgeInsets.all(18),
|
padding: EdgeInsets.all(18),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -100,17 +119,12 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_weightController.text == "") {
|
if (!_discountFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert weight");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_discountController.text == "") {
|
|
||||||
showMsgDialog(context, "Error", "Please insert discount rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late bool _isNew;
|
late bool _isNew;
|
||||||
User? user;
|
User? user;
|
||||||
|
final _receiveFormKey=GlobalKey<FormState>();
|
||||||
TextEditingController _trackingIDCtl = new TextEditingController();
|
TextEditingController _trackingIDCtl = new TextEditingController();
|
||||||
TextEditingController _remarkCtl = new TextEditingController();
|
TextEditingController _remarkCtl = new TextEditingController();
|
||||||
MultiImgController _multiImgController = MultiImgController();
|
MultiImgController _multiImgController = MultiImgController();
|
||||||
@@ -93,6 +94,14 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
iconData: MaterialCommunityIcons.barcode_scan,
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
labelTextKey: "receiving.tracking.id",
|
labelTextKey: "receiving.tracking.id",
|
||||||
controller: _trackingIDCtl,
|
controller: _trackingIDCtl,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "invalid tracking ID";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
)),
|
)),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: _scan,
|
onTap: _scan,
|
||||||
@@ -159,6 +168,8 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||||
|
child: Form(
|
||||||
|
key: _receiveFormKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
trackingIDBox,
|
trackingIDBox,
|
||||||
@@ -184,6 +195,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +228,11 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
Package _p =
|
Package _p =
|
||||||
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
|
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
|
||||||
|
|
||||||
if (_p.trackingID == null || _p.trackingID == "") {
|
// if (_p.trackingID == null || _p.trackingID == "") {
|
||||||
showMsgDialog(context, "Error", "Invalid tracking ID!");
|
// showMsgDialog(context, "Error", "Invalid tracking ID!");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if (!_receiveFormKey.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:fcs/domain/entities/package.dart';
|
import 'package:fcs/domain/entities/package.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/util.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';
|
||||||
@@ -11,12 +10,13 @@ import 'receiving_info.dart';
|
|||||||
typedef CallbackPackageSelect(Package package);
|
typedef CallbackPackageSelect(Package package);
|
||||||
|
|
||||||
class ReceivingListRow extends StatelessWidget {
|
class ReceivingListRow extends StatelessWidget {
|
||||||
final Package? package;
|
final Package package;
|
||||||
final CallbackPackageSelect? callbackPackageSelect;
|
final CallbackPackageSelect? callbackPackageSelect;
|
||||||
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");
|
||||||
|
|
||||||
ReceivingListRow({Key? key, this.package, this.callbackPackageSelect})
|
ReceivingListRow(
|
||||||
|
{Key? key, required this.package, this.callbackPackageSelect})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -24,7 +24,7 @@ class ReceivingListRow extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (callbackPackageSelect != null) {
|
if (callbackPackageSelect != null) {
|
||||||
callbackPackageSelect!(package!);
|
callbackPackageSelect!(package);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
@@ -39,31 +39,26 @@ class ReceivingListRow extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: new Padding(
|
child: new Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Icon(MaterialCommunityIcons.inbox_arrow_down,
|
||||||
padding: EdgeInsets.all(5.0),
|
color: primaryColor),
|
||||||
child: Icon(
|
|
||||||
MaterialCommunityIcons.inbox_arrow_down,
|
|
||||||
color: primaryColor,
|
|
||||||
)),
|
|
||||||
new Expanded(
|
new Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
child: new Column(
|
child: new Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
new Text(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
package.id == null ? '' : package.trackingID!,
|
||||||
child: new Text(
|
|
||||||
package!.id == null ? '' : package!.trackingID!,
|
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.market == null ? '' : package!.market!,
|
package.market == null ? '' : package.market!,
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -71,23 +66,26 @@ class ReceivingListRow extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(package.status ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(3.0),
|
padding: const EdgeInsets.only(top: 5),
|
||||||
child: getStatus(package!.status??""),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: new Text(
|
child: new Text(
|
||||||
package!.currentStatusDate != null
|
package.currentStatusDate != null
|
||||||
? dateFormat.format(package!.currentStatusDate!)
|
? dateFormat.format(package.currentStatusDate!)
|
||||||
: '',
|
: '',
|
||||||
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
|
style: new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,174 +0,0 @@
|
|||||||
import 'package:fcs/domain/vo/term.dart';
|
|
||||||
import 'package:fcs/helpers/theme.dart';
|
|
||||||
import 'package:fcs/pages/main/util.dart';
|
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
// import 'package:zefyrka/zefyrka.dart';
|
|
||||||
// import 'package:zefyr/zefyr.dart';
|
|
||||||
|
|
||||||
typedef void ProfileCallback();
|
|
||||||
|
|
||||||
class TermEdit extends StatefulWidget {
|
|
||||||
final Term? term;
|
|
||||||
TermEdit({required this.term});
|
|
||||||
@override
|
|
||||||
_TermEditState createState() => _TermEditState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TermEditState extends State<TermEdit> {
|
|
||||||
/// Allows to control the editor and the document.
|
|
||||||
// late ZefyrController _controllerEng;
|
|
||||||
// late ZefyrController _controllerMm;
|
|
||||||
|
|
||||||
/// Zefyr editor like any other input field requires a focus node.
|
|
||||||
late FocusNode _focusNodeEng;
|
|
||||||
late FocusNode _focusNodeMm;
|
|
||||||
bool _isLoading = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_isLoading = false;
|
|
||||||
|
|
||||||
// Here we must load the document and pass it to Zefyr controller.
|
|
||||||
// _controllerEng = ZefyrController(_loadDocument(widget.term!.termEng ?? ""));
|
|
||||||
// _controllerMm = ZefyrController(_loadDocument(widget.term!.termMm ?? ""));
|
|
||||||
_focusNodeEng = FocusNode();
|
|
||||||
_focusNodeMm = FocusNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Loads the document to be edited in Zefyr.
|
|
||||||
// NotusDocument _loadDocument(String data) {
|
|
||||||
// late NotusDocument doc;
|
|
||||||
// try {
|
|
||||||
// doc = NotusDocument.fromJson(jsonDecode(data));
|
|
||||||
// } catch (e) {}
|
|
||||||
// if (doc == null) {
|
|
||||||
// doc = NotusDocument();
|
|
||||||
// }
|
|
||||||
// return doc;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final savebtn =
|
|
||||||
fcsButton(context, getLocalString(context, "btn.save"), callack: _save);
|
|
||||||
|
|
||||||
return DefaultTabController(
|
|
||||||
length: 2,
|
|
||||||
child: LocalProgress(
|
|
||||||
inAsyncCall: _isLoading,
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: LocalLargeTitle(
|
|
||||||
context,
|
|
||||||
"term",
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
leading: IconButton(
|
|
||||||
icon: Icon(CupertinoIcons.back, color: primaryColor, size: 25),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
shadowColor: Colors.transparent,
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: _unfocus,
|
|
||||||
icon: Icon(Icons.check, color: primaryColor))
|
|
||||||
],
|
|
||||||
bottom: TabBar.secondary(
|
|
||||||
indicatorColor: primaryColor,
|
|
||||||
onTap: (index) {
|
|
||||||
if (index == 0) {
|
|
||||||
_focusNodeEng = new FocusNode();
|
|
||||||
FocusScope.of(context).requestFocus(_focusNodeEng);
|
|
||||||
} else {
|
|
||||||
_focusNodeMm = new FocusNode();
|
|
||||||
FocusScope.of(context).requestFocus(_focusNodeMm);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tabs: [
|
|
||||||
Tab(
|
|
||||||
icon: Image.asset(
|
|
||||||
'icons/flags/png/us.png',
|
|
||||||
package: 'country_icons',
|
|
||||||
fit: BoxFit.fitWidth,
|
|
||||||
width: 25,
|
|
||||||
)),
|
|
||||||
Tab(
|
|
||||||
icon: Image.asset(
|
|
||||||
'icons/flags/png/mm.png',
|
|
||||||
package: 'country_icons',
|
|
||||||
fit: BoxFit.fitWidth,
|
|
||||||
width: 25,
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: ListView(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height - 200,
|
|
||||||
child: TabBarView(
|
|
||||||
children: [
|
|
||||||
const SizedBox(),
|
|
||||||
const SizedBox(),
|
|
||||||
// textEditor(_controllerEng, _focusNodeEng),
|
|
||||||
// textEditor(_controllerMm, _focusNodeMm),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
savebtn,
|
|
||||||
const SizedBox(height: 20)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Widget textEditor(ZefyrController controller, FocusNode focusNode) {
|
|
||||||
// return ListView(
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// height: MediaQuery.of(context).size.height - 200,
|
|
||||||
// child: ZefyrEditor(
|
|
||||||
// autofocus: false,
|
|
||||||
// padding: EdgeInsets.all(16),
|
|
||||||
// controller: controller,
|
|
||||||
// focusNode: focusNode,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height: 10,
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
_unfocus() {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
_save() async {
|
|
||||||
setState(() {
|
|
||||||
_isLoading = true;
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
// final contentsEng = jsonEncode(_controllerEng.document);
|
|
||||||
// final contentsMm = jsonEncode(_controllerMm.document);
|
|
||||||
// // print('contents => $contentsEng');
|
|
||||||
// TermModel termModel = Provider.of<TermModel>(context, listen: false);
|
|
||||||
// await termModel.saveTerm(Term(termEng: contentsEng, termMm: contentsMm));
|
|
||||||
} catch (e) {
|
|
||||||
showMsgDialog(context, "Error", e.toString());
|
|
||||||
} finally {
|
|
||||||
_isLoading = false;
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
213
lib/pages/term/term_editor.dart
Normal file
213
lib/pages/term/term_editor.dart
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
|
import '../../domain/vo/term.dart';
|
||||||
|
import '../main/util.dart';
|
||||||
|
import '../widgets/local_text.dart';
|
||||||
|
|
||||||
|
class TermEditor extends StatefulWidget {
|
||||||
|
final Term term;
|
||||||
|
const TermEditor({super.key, required this.term});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<TermEditor> createState() => _TermEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TermEditorState extends State<TermEditor> {
|
||||||
|
int selectedIndex = 0;
|
||||||
|
final List<bool> _selectedIcon = <bool>[true, false];
|
||||||
|
List<Widget> icons = <Widget>[
|
||||||
|
const Icon(Icons.edit),
|
||||||
|
const Icon(Icons.preview_outlined),
|
||||||
|
];
|
||||||
|
bool isEdit = true;
|
||||||
|
TextEditingController mmController = TextEditingController();
|
||||||
|
TextEditingController enController = TextEditingController();
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
enController.text = widget.term.termEng ?? "";
|
||||||
|
mmController.text = widget.term.termMm ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
enController.dispose();
|
||||||
|
mmController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final toggleBtn = ToggleButtons(
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
onPressed: (int index) {
|
||||||
|
setState(() {
|
||||||
|
for (int i = 0; i < _selectedIcon.length; i++) {
|
||||||
|
_selectedIcon[i] = !_selectedIcon[i];
|
||||||
|
isEdit = (_selectedIcon[0] == true) ? true : false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||||
|
borderColor: primaryColor.withOpacity(0.3),
|
||||||
|
selectedBorderColor: Colors.white,
|
||||||
|
fillColor: primaryColor,
|
||||||
|
color: primaryColor,
|
||||||
|
isSelected: _selectedIcon,
|
||||||
|
constraints: const BoxConstraints(minHeight: 20, minWidth: 40),
|
||||||
|
children: icons,
|
||||||
|
);
|
||||||
|
|
||||||
|
final savebtn = Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: fcsButton(context, getLocalString(context, "btn.save"),
|
||||||
|
callack: _save),
|
||||||
|
);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: DefaultTabController(
|
||||||
|
length: 2,
|
||||||
|
initialIndex: selectedIndex,
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
|
centerTitle: true,
|
||||||
|
leading: IconButton(
|
||||||
|
splashRadius: 25,
|
||||||
|
icon: const Icon(CupertinoIcons.back,
|
||||||
|
color: primaryColor, size: 25),
|
||||||
|
onPressed: () => Navigator.pop(context)),
|
||||||
|
shadowColor: Colors.transparent,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
title:
|
||||||
|
LocalText(context, 'term', fontSize: 20, color: primaryColor),
|
||||||
|
bottom: TabBar.secondary(
|
||||||
|
indicatorColor: primaryColor,
|
||||||
|
labelColor: primaryColor,
|
||||||
|
labelStyle:
|
||||||
|
const TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
|
||||||
|
unselectedLabelColor: Colors.grey,
|
||||||
|
unselectedLabelStyle:
|
||||||
|
const TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
|
||||||
|
onTap: (index) {
|
||||||
|
selectedIndex = index;
|
||||||
|
},
|
||||||
|
tabs: [Tab(text: "English"), Tab(text: "Myanmar")]),
|
||||||
|
actions: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 20), child: toggleBtn)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
child: ScrollConfiguration(
|
||||||
|
behavior: const ScrollBehavior().copyWith(overscroll: false),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height - 210,
|
||||||
|
child: TabBarView(
|
||||||
|
children: [
|
||||||
|
isEdit
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.all(15),
|
||||||
|
child: TextField(
|
||||||
|
autofocus: true,
|
||||||
|
controller: enController,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15, color: Colors.black87),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none),
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
maxLines: null,
|
||||||
|
readOnly: isEdit ? false : true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 15, bottom: 15),
|
||||||
|
child: Markdown(
|
||||||
|
shrinkWrap: true,
|
||||||
|
softLineBreak: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
data: enController.text
|
||||||
|
.replaceAll("\\n", '\n'),
|
||||||
|
styleSheet: MarkdownStyleSheet.fromTheme(
|
||||||
|
ThemeData(
|
||||||
|
textTheme: const TextTheme(
|
||||||
|
bodyMedium: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: Colors.black87))))),
|
||||||
|
),
|
||||||
|
isEdit
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.all(15),
|
||||||
|
child: TextField(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.black87),
|
||||||
|
autofocus: true,
|
||||||
|
controller: mmController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none),
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
maxLines: null,
|
||||||
|
readOnly: isEdit ? false : true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 15, bottom: 15),
|
||||||
|
child: Markdown(
|
||||||
|
shrinkWrap: true,
|
||||||
|
softLineBreak: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
data: mmController.text
|
||||||
|
.replaceAll("\\n", '\n'),
|
||||||
|
styleSheet: MarkdownStyleSheet.fromTheme(
|
||||||
|
ThemeData(
|
||||||
|
textTheme: const TextTheme(
|
||||||
|
bodyMedium: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.black87))))),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
savebtn,
|
||||||
|
const SizedBox(height: 20)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_save() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
// final contentsEng = jsonEncode(_controllerEng.document);
|
||||||
|
// final contentsMm = jsonEncode(_controllerMm.document);
|
||||||
|
// // print('contents => $contentsEng');
|
||||||
|
// TermModel termModel = Provider.of<TermModel>(context, listen: false);
|
||||||
|
// await termModel.saveTerm(Term(termEng: contentsEng, termMm: contentsMm));
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
_isLoading = false;
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,52 +2,28 @@ import 'package:fcs/domain/entities/setting.dart';
|
|||||||
import 'package:fcs/domain/vo/term.dart';
|
import 'package:fcs/domain/vo/term.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
import 'package:fcs/pages/term/term_edit.dart';
|
|
||||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
// import 'package:zefyrka/zefyrka.dart';
|
|
||||||
|
|
||||||
typedef void ProfileCallback();
|
import '../main/model/language_model.dart';
|
||||||
|
import 'term_editor.dart';
|
||||||
|
|
||||||
class TermPage extends StatefulWidget {
|
class TermPage extends StatefulWidget {
|
||||||
const TermPage({
|
const TermPage({Key? key}) : super(key: key);
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
@override
|
@override
|
||||||
_TermPageState createState() => _TermPageState();
|
_TermPageState createState() => _TermPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TermPageState extends State<TermPage> {
|
class _TermPageState extends State<TermPage> {
|
||||||
// late ZefyrController _controller;
|
|
||||||
// late FocusNode _focusNode;
|
|
||||||
// late NotusDocument document = new NotusDocument();
|
|
||||||
bool isLoading = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
// _focusNode = FocusNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NotusDocument _loadDocument(Setting? setting) {
|
|
||||||
// bool isEng = Provider.of<LanguageModel>(context).isEng;
|
|
||||||
// String? term = isEng ? (setting!.termsEng ?? "") : (setting!.termsMm ?? "");
|
|
||||||
// late NotusDocument doc;
|
|
||||||
// try {
|
|
||||||
// doc = NotusDocument.fromJson(jsonDecode(term));
|
|
||||||
// } catch (e) {}
|
|
||||||
// if (doc == null) {
|
|
||||||
// doc = NotusDocument();
|
|
||||||
// }
|
|
||||||
// return doc;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||||
Setting? setting = Provider.of<MainModel>(context).setting;
|
Setting? setting = Provider.of<MainModel>(context).setting;
|
||||||
bool isEditable = context.select((MainModel m) => m.termEditable());
|
bool isEditable = context.select((MainModel m) => m.termEditable());
|
||||||
|
String? term = isEng ? (setting!.termsEng ?? "") : (setting!.termsMm ?? "");
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
@@ -58,20 +34,25 @@ class _TermPageState extends State<TermPage> {
|
|||||||
actions: isEditable
|
actions: isEditable
|
||||||
? [
|
? [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () {
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
TermEdit(term: Term.fromSetting(setting!)),
|
TermEditor(term: Term.fromSetting(setting)),
|
||||||
)),
|
));
|
||||||
|
},
|
||||||
icon: Icon(Icons.edit, color: primaryColor))
|
icon: Icon(Icons.edit, color: primaryColor))
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
),
|
),
|
||||||
// body: ZefyrEditor(
|
body: Markdown(
|
||||||
// padding: EdgeInsets.all(16),
|
shrinkWrap: true,
|
||||||
// controller: ZefyrController(_loadDocument(setting)),
|
softLineBreak: true,
|
||||||
// focusNode: _focusNode,
|
physics: const BouncingScrollPhysics(),
|
||||||
// ),
|
data: term.replaceAll("\\n", '\n'),
|
||||||
|
styleSheet: MarkdownStyleSheet.fromTheme(ThemeData(
|
||||||
|
textTheme: TextTheme(
|
||||||
|
bodyMedium: TextStyle(
|
||||||
|
fontSize: isEng ? 15 : 14, color: Colors.black87))))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class InputDate extends StatelessWidget {
|
|||||||
final TextInputType? textInputType;
|
final TextInputType? textInputType;
|
||||||
final bool autoFocus;
|
final bool autoFocus;
|
||||||
final String dateFormatString;
|
final String dateFormatString;
|
||||||
|
final AutovalidateMode? autovalidateMode;
|
||||||
|
|
||||||
const InputDate(
|
const InputDate(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
@@ -23,6 +24,7 @@ class InputDate extends StatelessWidget {
|
|||||||
required this.iconData,
|
required this.iconData,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.autovalidateMode,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
@@ -126,7 +128,8 @@ class InputDate extends StatelessWidget {
|
|||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: borderColor ?? dangerColor, width: 1.0)),
|
color: borderColor ?? dangerColor, width: 1.0)),
|
||||||
),
|
),
|
||||||
validator: validator),
|
validator: validator,
|
||||||
|
autovalidateMode: autovalidateMode,),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class InputText extends StatelessWidget {
|
|||||||
final IconData? iconData;
|
final IconData? iconData;
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
final FormFieldValidator<String>? validator;
|
final FormFieldValidator<String>? validator;
|
||||||
|
final AutovalidateMode? autovalidateMode;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
final bool withBorder;
|
final bool withBorder;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
@@ -26,6 +27,7 @@ class InputText extends StatelessWidget {
|
|||||||
this.iconData,
|
this.iconData,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.autovalidateMode,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
@@ -114,7 +116,8 @@ class InputText extends StatelessWidget {
|
|||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: borderColor ?? dangerColor, width: 1.0)),
|
color: borderColor ?? dangerColor, width: 1.0)),
|
||||||
),
|
),
|
||||||
validator: validator),
|
validator: validator,
|
||||||
|
autovalidateMode: autovalidateMode,),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ dependencies:
|
|||||||
open_file: ^3.3.2
|
open_file: ^3.3.2
|
||||||
pdf: ^3.10.8
|
pdf: ^3.10.8
|
||||||
qr_flutter: ^4.1.0
|
qr_flutter: ^4.1.0
|
||||||
|
flutter_markdown: ^0.6.20+1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user