add markdown for term
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),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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))))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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