Merge branch 'master' of tzw/fcs into master
This commit is contained in:
@@ -54,20 +54,13 @@ class Setting {
|
||||
emailAddress: map['email_address'],
|
||||
facebookLink: map['facebook_link'],
|
||||
about: map['about'],
|
||||
termsEng: map['terms_eng'],
|
||||
termsMm: map['terms_mm'],
|
||||
termsEng: map['terms_eng_markdown'],
|
||||
termsMm: map['terms_mm_markdown'],
|
||||
shipmentTypes: List.from(map['shipment_types']),
|
||||
courierWebsite: map['courier_website'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'terms_eng': termsEng,
|
||||
'terms_mm': termsMm,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Setting{supportBuildNum:$supportBuildNum,about:$about}';
|
||||
|
||||
@@ -38,7 +38,7 @@ Future<void> generateCartonPdf(Carton carton) async {
|
||||
height: 50,
|
||||
color: PdfColor.fromHex("#000000"),
|
||||
barcode: pw.Barcode.qrCode(),
|
||||
data: carton.cartonNumber!),
|
||||
data: carton.cartonNumber ?? ""),
|
||||
pw.Padding(
|
||||
padding: const pw.EdgeInsets.all(5),
|
||||
child: pw.Column(
|
||||
|
||||
@@ -26,21 +26,24 @@ class PrintQrCodePage extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
QrImageView(
|
||||
data: 'This is a simple QR code',
|
||||
version: QrVersions.auto,
|
||||
size: 100,
|
||||
gapless: true,
|
||||
),
|
||||
data: carton.cartonNumber ?? "",
|
||||
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")),
|
||||
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")),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: labelColor,
|
||||
fontFamily: "Roboto")),
|
||||
)
|
||||
],
|
||||
)
|
||||
@@ -54,7 +57,7 @@ class PrintQrCodePage extends StatelessWidget {
|
||||
color: primaryColor,
|
||||
iconData: Icons.print_outlined,
|
||||
callBack: () {
|
||||
generateCartonPdf(carton);
|
||||
generateCartonPdf(carton);
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ class CartonListRow extends StatelessWidget {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
padding: EdgeInsets.only(left: 0),
|
||||
child: Icon(
|
||||
MaterialCommunityIcons.package,
|
||||
color: primaryColor,
|
||||
@@ -42,7 +42,7 @@ class CartonListRow extends StatelessWidget {
|
||||
),
|
||||
new Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0),
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
child: Row(
|
||||
children: [
|
||||
new Column(
|
||||
@@ -98,7 +98,7 @@ class CartonListRow extends StatelessWidget {
|
||||
new Text(
|
||||
"${box.cartonWeight.toStringAsFixed(2)} lb",
|
||||
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;
|
||||
late String dialCode;
|
||||
final _inviteFormKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -34,9 +35,17 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final nameBox = InputText(
|
||||
labelTextKey: 'customer.name',
|
||||
iconData: Icons.person,
|
||||
controller: _nameController);
|
||||
labelTextKey: 'customer.name',
|
||||
iconData: Icons.person,
|
||||
controller: _nameController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please insert name";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -56,73 +65,88 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
||||
}
|
||||
},
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
nameBox,
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
color: primaryColor,
|
||||
body: Form(
|
||||
key: _inviteFormKey,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
nameBox,
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(color: Colors.grey.shade400, width: 1),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0))),
|
||||
child: CountryCodePicker(
|
||||
onChanged: _countryChange,
|
||||
initialSelection: dialCode,
|
||||
countryFilter: ['mm', 'us'],
|
||||
showCountryOnly: false,
|
||||
showOnlyCountryWhenClosed: false,
|
||||
alignLeft: false,
|
||||
textStyle: TextStyle(fontSize: 16, color: Colors.black87),
|
||||
searchDecoration: InputDecoration(
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.black, width: 1.0))),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(color: Colors.grey.shade400, width: 1),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(12.0))),
|
||||
child: CountryCodePicker(
|
||||
onChanged: _countryChange,
|
||||
initialSelection: dialCode,
|
||||
countryFilter: ['mm', 'us'],
|
||||
showCountryOnly: false,
|
||||
showOnlyCountryWhenClosed: false,
|
||||
alignLeft: false,
|
||||
textStyle:
|
||||
TextStyle(fontSize: 16, color: Colors.black87),
|
||||
searchDecoration: InputDecoration(
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black, width: 1.0))),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: TextFormField(
|
||||
controller: _phoneController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
keyboardType: TextInputType.phone,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: getLocalString(context, "customer.phone"),
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, color: Colors.grey),
|
||||
filled: true,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey, width: 1.0)),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: TextFormField(
|
||||
controller: _phoneController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
keyboardType: TextInputType.phone,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText:
|
||||
getLocalString(context, "customer.phone"),
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, color: Colors.grey),
|
||||
filled: true,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
fcsButton(context, getLocalString(context, "invite.btn"),
|
||||
callack: _invite),
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
fcsButton(context, getLocalString(context, "invite.btn"),
|
||||
callack: _invite),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -138,9 +162,9 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
||||
_invite() async {
|
||||
String userName = _nameController.text;
|
||||
String phoneNumber = dialCode + _phoneController.text;
|
||||
if (userName == "" || phoneNumber == "") {
|
||||
showMsgDialog(context, "Error", "Invalid name or phone number");
|
||||
return;
|
||||
|
||||
if (!_inviteFormKey.currentState!.validate()) {
|
||||
return null;
|
||||
}
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
@@ -9,8 +8,8 @@ import 'package:intl/intl.dart';
|
||||
import 'delivery_info.dart';
|
||||
|
||||
class DeliveryListRow extends StatelessWidget {
|
||||
final Carton? box;
|
||||
DeliveryListRow({Key? key, this.box}) : super(key: key);
|
||||
final Carton box;
|
||||
DeliveryListRow({Key? key, required this.box}) : super(key: key);
|
||||
|
||||
final double dotSize = 15.0;
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
@@ -19,11 +18,10 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (box != null)
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box!)),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box)),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
@@ -31,38 +29,32 @@ class DeliveryListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 10),
|
||||
child: Icon(
|
||||
MaterialCommunityIcons.truck_fast,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
Icon(MaterialCommunityIcons.truck_fast,
|
||||
color: primaryColor, size: 30),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
box?.cartonNumber ?? "",
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
box.cartonNumber ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
box?.userName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
box.userName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -70,19 +62,21 @@ class DeliveryListRow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(box.status ?? "",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(box?.status ?? ''),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${box?.actualWeight.toString() ?? ''} lb",
|
||||
"${box.actualWeight.toString()} lb",
|
||||
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 {
|
||||
final OnSelect? onSelect;
|
||||
final Discount? discount;
|
||||
DiscountListRow({Key? key, this.discount, this.onSelect}) : super(key: key);
|
||||
final Discount discount;
|
||||
DiscountListRow({Key? key, required this.discount, this.onSelect})
|
||||
: super(key: key);
|
||||
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
|
||||
@@ -17,9 +18,7 @@ class DiscountListRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (onSelect != null && discount != null) {
|
||||
onSelect!(discount!);
|
||||
}
|
||||
onSelect!(discount);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
@@ -27,38 +26,31 @@ class DiscountListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 10),
|
||||
child: Icon(
|
||||
Entypo.price_ribbon,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
Icon(Entypo.price_ribbon, color: primaryColor, size: 30),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
discount?.code ?? "",
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
discount.code ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
discount?.customerName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
discount.customerName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -66,17 +58,17 @@ class DiscountListRow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(discount.status ?? ''),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Text(discount?.status ?? ''),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 5,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${discount?.amount.toStringAsFixed(2) ?? ''}",
|
||||
"${discount.amount.toStringAsFixed(2)}",
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
@@ -121,6 +121,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
labelTextKey: "FCSshipment.number",
|
||||
iconData: Ionicons.ios_airplane,
|
||||
controller: _shipmentNumberController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return "Enter shipment number";
|
||||
@@ -132,6 +133,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
labelTextKey: "FCSshipment.cutoff_date",
|
||||
iconData: Icons.date_range,
|
||||
controller: _cutoffDateController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return "Select cutoff date";
|
||||
@@ -143,6 +145,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
labelTextKey: "FCSshipment.ETA",
|
||||
iconData: Icons.date_range,
|
||||
controller: _arrivalDateController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return "Select ETA date";
|
||||
|
||||
@@ -24,20 +24,17 @@ class FcsShipmentListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Icon(
|
||||
Ionicons.ios_airplane,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
Icon(
|
||||
Ionicons.ios_airplane,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
new Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0),
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/package_info.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -11,14 +10,14 @@ typedef CallbackPackageSelect(Package package);
|
||||
|
||||
class PackageListRow extends StatelessWidget {
|
||||
final bool isCustomer;
|
||||
final Package? package;
|
||||
final Package package;
|
||||
final CallbackPackageSelect? callbackPackageSelect;
|
||||
final double dotSize = 15.0;
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
|
||||
PackageListRow(
|
||||
{Key? key,
|
||||
this.package,
|
||||
required this.package,
|
||||
this.callbackPackageSelect,
|
||||
this.isCustomer = false})
|
||||
: super(key: key);
|
||||
@@ -28,7 +27,7 @@ class PackageListRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (callbackPackageSelect != null) {
|
||||
callbackPackageSelect!(package!);
|
||||
callbackPackageSelect!(package);
|
||||
return;
|
||||
}
|
||||
Navigator.push(
|
||||
@@ -48,36 +47,33 @@ class PackageListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Icon(Octicons.package, color: primaryColor),
|
||||
SizedBox(width: 8),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.id == null
|
||||
? ''
|
||||
: package!.trackingID!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
package.id == null ? '' : package.trackingID!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.market == null
|
||||
? ''
|
||||
: package!.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
package.market == null
|
||||
? ''
|
||||
: package.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -85,19 +81,21 @@ class PackageListRow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(package.status ?? "",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: getStatus(package!.status??""),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
package!.currentStatusDate != null
|
||||
? dateFormat.format(package!.currentStatusDate!)
|
||||
package.currentStatusDate != null
|
||||
? dateFormat.format(package.currentStatusDate!)
|
||||
: '',
|
||||
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/pages/pickup/pickup_info.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/progress.dart';
|
||||
import 'package:fcs/pagination/paginator_listview.dart';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/entities/pickup.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/pickup/pickup_info.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -37,51 +36,53 @@ class PickupListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 10),
|
||||
child: Icon(
|
||||
SimpleLineIcons.direction,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
Icon(
|
||||
SimpleLineIcons.direction,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
pickup?.pickupNumber ?? '',
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
pickup!.pickupDate != null
|
||||
? dateFormat.format(pickup!.pickupDate!)
|
||||
: "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
pickup!.pickupDate != null
|
||||
? dateFormat.format(pickup!.pickupDate!)
|
||||
: "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getStatus(pickup!.status ?? ""),
|
||||
],
|
||||
)
|
||||
Text(pickup?.status ?? "",
|
||||
style: TextStyle(
|
||||
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/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
@@ -11,12 +10,13 @@ import 'processing_info.dart';
|
||||
typedef CallbackPackageSelect(Package package);
|
||||
|
||||
class ProcessingListRow extends StatelessWidget {
|
||||
final Package? package;
|
||||
final Package package;
|
||||
final CallbackPackageSelect? callbackPackageSelect;
|
||||
final double dotSize = 15.0;
|
||||
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);
|
||||
|
||||
@override
|
||||
@@ -24,7 +24,7 @@ class ProcessingListRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (callbackPackageSelect != null) {
|
||||
callbackPackageSelect!(package!);
|
||||
callbackPackageSelect!(package);
|
||||
return;
|
||||
}
|
||||
Navigator.push(
|
||||
@@ -39,38 +39,33 @@ class ProcessingListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 10),
|
||||
child: Icon(
|
||||
FontAwesome.dropbox,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
Icon(FontAwesome.dropbox, color: primaryColor, size: 30),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.id == null ? '' : package!.trackingID!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
package.trackingID == null
|
||||
? ''
|
||||
: package.trackingID!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.market == null ? '' : package!.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5.0),
|
||||
child: new Text(
|
||||
package.market == null ? '' : package.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -78,18 +73,20 @@ class ProcessingListRow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(package.status ?? "",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: getStatus(package!.status??""),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
package!.currentStatusDate != null
|
||||
? dateFormat.format(package!.currentStatusDate!)
|
||||
package.currentStatusDate != null
|
||||
? 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;
|
||||
late CargoType _cargo;
|
||||
bool _isNew = false;
|
||||
final _cargoFormKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -47,11 +48,26 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
final typeBox = InputText(
|
||||
labelTextKey: 'cargo.type',
|
||||
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(
|
||||
labelTextKey: 'cargo.rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _rateController);
|
||||
labelTextKey: 'cargo.rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _rateController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please insert rate";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -78,23 +94,26 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
typeBox,
|
||||
rateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
body: Form(
|
||||
key: _cargoFormKey,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
typeBox,
|
||||
rateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -102,8 +121,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
}
|
||||
|
||||
_save() async {
|
||||
if (_rateController.text == "") {
|
||||
showMsgDialog(context, "Error", "Please insert rate");
|
||||
if (!_cargoFormKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
|
||||
@@ -26,6 +26,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
bool _isLoading = false;
|
||||
CargoType _custom = new CargoType();
|
||||
bool _isNew = false;
|
||||
final _customFormKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -50,16 +51,39 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
final productBox = InputText(
|
||||
labelTextKey: 'rate.cutom.product_type',
|
||||
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(
|
||||
labelTextKey: 'rate.custom.fee',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _feeController);
|
||||
labelTextKey: 'rate.custom.fee',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _feeController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please insert fee";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
final shipmentRateBox = InputText(
|
||||
labelTextKey: 'rate.custom.shipment_rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _shipmentRateController);
|
||||
labelTextKey: 'rate.custom.shipment_rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _shipmentRateController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please insert shipment rate";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -86,24 +110,27 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
productBox,
|
||||
feeBox,
|
||||
shipmentRateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
body: Form(
|
||||
key: _customFormKey,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
productBox,
|
||||
feeBox,
|
||||
shipmentRateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -111,13 +138,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
}
|
||||
|
||||
_save() async {
|
||||
if (_feeController.text == "") {
|
||||
showMsgDialog(context, "Error", "Please insert fee");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_shipmentRateController.text == "") {
|
||||
showMsgDialog(context, "Error", "Please insert shipment rate");
|
||||
if (!_customFormKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
bool _isLoading = false;
|
||||
bool _isNew = false;
|
||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||
final _discountFormKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -46,13 +47,29 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final weightBox = InputText(
|
||||
labelTextKey: 'rate.discount.weight',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
controller: _weightController);
|
||||
labelTextKey: 'rate.discount.weight',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
controller: _weightController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please inset weight";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
final discountRateBox = InputText(
|
||||
labelTextKey: 'rate.discount.rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _discountController);
|
||||
labelTextKey: 'rate.discount.rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _discountController,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please insert discount rate";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -80,23 +97,26 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
weightBox,
|
||||
discountRateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
body: Form(
|
||||
key: _discountFormKey,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
weightBox,
|
||||
discountRateBox,
|
||||
SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
fcsButton(context, getLocalString(context, "btn.save"),
|
||||
callack: _save),
|
||||
SizedBox(height: 10)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -104,13 +124,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
}
|
||||
|
||||
_save() async {
|
||||
if (_weightController.text == "") {
|
||||
showMsgDialog(context, "Error", "Please insert weight");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_discountController.text == "") {
|
||||
showMsgDialog(context, "Error", "Please insert discount rate");
|
||||
if (!_discountFormKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
bool _isLoading = false;
|
||||
late bool _isNew;
|
||||
User? user;
|
||||
final _receiveFormKey=GlobalKey<FormState>();
|
||||
TextEditingController _trackingIDCtl = new TextEditingController();
|
||||
TextEditingController _remarkCtl = new TextEditingController();
|
||||
MultiImgController _multiImgController = MultiImgController();
|
||||
@@ -93,6 +94,14 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
iconData: MaterialCommunityIcons.barcode_scan,
|
||||
labelTextKey: "receiving.tracking.id",
|
||||
controller: _trackingIDCtl,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: (value){
|
||||
if(value==null || value.isEmpty){
|
||||
return "invalid tracking ID";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
)),
|
||||
InkWell(
|
||||
onTap: _scan,
|
||||
@@ -159,29 +168,32 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
trackingIDBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
remarkBox,
|
||||
Divider(),
|
||||
img,
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
fcsIDBox,
|
||||
namebox,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
_isNew ? createButton : updateButton,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
child: Form(
|
||||
key: _receiveFormKey,
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
trackingIDBox,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
remarkBox,
|
||||
Divider(),
|
||||
img,
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
fcsIDBox,
|
||||
namebox,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
_isNew ? createButton : updateButton,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
@@ -216,8 +228,11 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
Package _p =
|
||||
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
|
||||
|
||||
if (_p.trackingID == null || _p.trackingID == "") {
|
||||
showMsgDialog(context, "Error", "Invalid tracking ID!");
|
||||
// if (_p.trackingID == null || _p.trackingID == "") {
|
||||
// showMsgDialog(context, "Error", "Invalid tracking ID!");
|
||||
// return;
|
||||
// }
|
||||
if (!_receiveFormKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
@@ -11,12 +10,13 @@ import 'receiving_info.dart';
|
||||
typedef CallbackPackageSelect(Package package);
|
||||
|
||||
class ReceivingListRow extends StatelessWidget {
|
||||
final Package? package;
|
||||
final Package package;
|
||||
final CallbackPackageSelect? callbackPackageSelect;
|
||||
final double dotSize = 15.0;
|
||||
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);
|
||||
|
||||
@override
|
||||
@@ -24,7 +24,7 @@ class ReceivingListRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (callbackPackageSelect != null) {
|
||||
callbackPackageSelect!(package!);
|
||||
callbackPackageSelect!(package);
|
||||
return;
|
||||
}
|
||||
Navigator.push(
|
||||
@@ -39,36 +39,32 @@ class ReceivingListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
child: Icon(
|
||||
MaterialCommunityIcons.inbox_arrow_down,
|
||||
color: primaryColor,
|
||||
)),
|
||||
Icon(MaterialCommunityIcons.inbox_arrow_down,
|
||||
color: primaryColor),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.id == null ? '' : package!.trackingID!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
package.id == null ? '' : package.trackingID!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
package!.market == null ? '' : package!.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
package.market == null ? '' : package.market!,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -76,18 +72,20 @@ class ReceivingListRow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(package.status ?? "",
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: getStatus(package!.status??""),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: new Text(
|
||||
package!.currentStatusDate != null
|
||||
? dateFormat.format(package!.currentStatusDate!)
|
||||
package.currentStatusDate != null
|
||||
? 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/helpers/theme.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:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.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 {
|
||||
const TermPage({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
const TermPage({Key? key}) : super(key: key);
|
||||
@override
|
||||
_TermPageState createState() => _TermPageState();
|
||||
}
|
||||
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||
Setting? setting = Provider.of<MainModel>(context).setting;
|
||||
bool isEditable = context.select((MainModel m) => m.termEditable());
|
||||
String? term = isEng ? (setting!.termsEng ?? "") : (setting!.termsMm ?? "");
|
||||
|
||||
return Scaffold(
|
||||
appBar: LocalAppBar(
|
||||
@@ -58,20 +34,25 @@ class _TermPageState extends State<TermPage> {
|
||||
actions: isEditable
|
||||
? [
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
TermEdit(term: Term.fromSetting(setting!)),
|
||||
)),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
TermEditor(term: Term.fromSetting(setting)),
|
||||
));
|
||||
},
|
||||
icon: Icon(Icons.edit, color: primaryColor))
|
||||
]
|
||||
: [],
|
||||
),
|
||||
// body: ZefyrEditor(
|
||||
// padding: EdgeInsets.all(16),
|
||||
// controller: ZefyrController(_loadDocument(setting)),
|
||||
// focusNode: _focusNode,
|
||||
// ),
|
||||
body: Markdown(
|
||||
shrinkWrap: true,
|
||||
softLineBreak: true,
|
||||
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 bool autoFocus;
|
||||
final String dateFormatString;
|
||||
final AutovalidateMode? autovalidateMode;
|
||||
|
||||
const InputDate(
|
||||
{Key? key,
|
||||
@@ -23,6 +24,7 @@ class InputDate extends StatelessWidget {
|
||||
required this.iconData,
|
||||
required this.controller,
|
||||
this.validator,
|
||||
this.autovalidateMode,
|
||||
this.maxLines = 1,
|
||||
this.withBorder = false,
|
||||
this.borderColor,
|
||||
@@ -126,7 +128,8 @@ class InputDate extends StatelessWidget {
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? dangerColor, width: 1.0)),
|
||||
),
|
||||
validator: validator),
|
||||
validator: validator,
|
||||
autovalidateMode: autovalidateMode,),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ class InputText extends StatelessWidget {
|
||||
final IconData? iconData;
|
||||
final TextEditingController? controller;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final AutovalidateMode? autovalidateMode;
|
||||
final int maxLines;
|
||||
final bool withBorder;
|
||||
final Color? borderColor;
|
||||
@@ -26,6 +27,7 @@ class InputText extends StatelessWidget {
|
||||
this.iconData,
|
||||
this.controller,
|
||||
this.validator,
|
||||
this.autovalidateMode,
|
||||
this.maxLines = 1,
|
||||
this.withBorder = false,
|
||||
this.borderColor,
|
||||
@@ -114,7 +116,8 @@ class InputText extends StatelessWidget {
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? dangerColor, width: 1.0)),
|
||||
),
|
||||
validator: validator),
|
||||
validator: validator,
|
||||
autovalidateMode: autovalidateMode,),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ dependencies:
|
||||
open_file: ^3.3.2
|
||||
pdf: ^3.10.8
|
||||
qr_flutter: ^4.1.0
|
||||
flutter_markdown: ^0.6.20+1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user