update
This commit is contained in:
@@ -6,14 +6,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
|
||||
class AppTranslations {
|
||||
Locale locale;
|
||||
static Map<dynamic, dynamic> _localisedValues;
|
||||
late Locale locale;
|
||||
static late Map<dynamic, dynamic> _localisedValues;
|
||||
|
||||
AppTranslations(Locale locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
static AppTranslations of(BuildContext context) {
|
||||
static AppTranslations? of(BuildContext context) {
|
||||
return Localizations.of<AppTranslations>(context, AppTranslations);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class AppTranslations {
|
||||
|
||||
get currentLanguage => locale.languageCode;
|
||||
|
||||
String text(String key, {List<String> translationVariables}) {
|
||||
String text(String key, {List<String>? translationVariables}) {
|
||||
String value = _localisedValues[key];
|
||||
if (value == null) {
|
||||
return "$key not found";
|
||||
|
||||
@@ -15,7 +15,7 @@ class AppTranslationsDelegate extends LocalizationsDelegate<AppTranslations> {
|
||||
|
||||
@override
|
||||
Future<AppTranslations> load(Locale locale) {
|
||||
return AppTranslations.load(newLocale ?? locale);
|
||||
return AppTranslations.load(newLocale);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -23,5 +23,5 @@ class Translation {
|
||||
supportedLanguagesCodes.map<Locale>((language) => Locale(language, ""));
|
||||
|
||||
//function to be invoked when changing the language
|
||||
LocaleChangeCallback? onLocaleChanged;
|
||||
late LocaleChangeCallback onLocaleChanged;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/vo/contact.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/contact/model/contact_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
@@ -14,7 +13,7 @@ import 'package:provider/provider.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
class ContactEditor extends StatefulWidget {
|
||||
final Contact contact;
|
||||
final Contact? contact;
|
||||
const ContactEditor({this.contact});
|
||||
@override
|
||||
_ContactEditorState createState() => _ContactEditorState();
|
||||
@@ -29,22 +28,23 @@ class _ContactEditorState extends State<ContactEditor> {
|
||||
TextEditingController _facebook = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
bool isNew;
|
||||
bool isNew = false;
|
||||
|
||||
Contact? _contact;
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.contact != null) _contact = widget.contact!;
|
||||
super.initState();
|
||||
if (widget.contact != null) {
|
||||
isNew = false;
|
||||
_usaPhone.text = widget.contact.usaContactNumber;
|
||||
_mmPhone.text = widget.contact.mmContactNumber;
|
||||
_usaAddress.text = widget.contact.usaAddress;
|
||||
_mmAddress.text = widget.contact.mmAddress;
|
||||
_email.text = widget.contact.emailAddress;
|
||||
_facebook.text = widget.contact.facebookLink;
|
||||
} else {
|
||||
isNew = true;
|
||||
}
|
||||
isNew = widget.contact == null;
|
||||
}
|
||||
|
||||
initContact() {
|
||||
_usaPhone.text = _contact?.usaContactNumber ?? '';
|
||||
_mmPhone.text = _contact?.mmContactNumber ?? '';
|
||||
_usaAddress.text = _contact?.usaAddress ?? '';
|
||||
_mmAddress.text = _contact?.mmAddress ?? '';
|
||||
_email.text = _contact?.emailAddress ?? '';
|
||||
_facebook.text = _contact?.facebookLink ?? '';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,14 +136,17 @@ class _ContactEditorState extends State<ContactEditor> {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
widget.contact.usaContactNumber = _usaPhone.text;
|
||||
widget.contact.mmContactNumber = _mmPhone.text;
|
||||
widget.contact.usaAddress = _usaAddress.text;
|
||||
widget.contact.mmAddress = _mmAddress.text;
|
||||
widget.contact.emailAddress = _email.text;
|
||||
widget.contact.facebookLink = _facebook.text;
|
||||
var contactModel = Provider.of<ContactModel>(context, listen: false);
|
||||
await contactModel.saveContact(widget.contact);
|
||||
_contact?.usaContactNumber = _usaPhone.text;
|
||||
_contact?.mmContactNumber = _mmPhone.text;
|
||||
_contact?.usaAddress = _usaAddress.text;
|
||||
_contact?.mmAddress = _mmAddress.text;
|
||||
_contact?.emailAddress = _email.text;
|
||||
_contact?.facebookLink = _facebook.text;
|
||||
if (this._contact != null) {
|
||||
var contactModel = Provider.of<ContactModel>(context, listen: false);
|
||||
await contactModel.saveContact(_contact!);
|
||||
}
|
||||
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:fcs/domain/entities/setting.dart';
|
||||
import 'package:fcs/domain/vo/contact.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/contact/contact_editor.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
|
||||
@@ -7,14 +7,14 @@ Widget itemTitle(BuildContext context, String textKey) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, top: 25, bottom: 5),
|
||||
child: Text(
|
||||
AppTranslations.of(context).text(textKey),
|
||||
AppTranslations.of(context)!.text(textKey),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18, color: Colors.black),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget subItemTitle(BuildContext context, String textKey, {IconData iconData}) {
|
||||
Widget subItemTitle(BuildContext context, String textKey, {IconData? iconData}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 0, top: 0, bottom: 0),
|
||||
child: Row(
|
||||
@@ -25,7 +25,7 @@ Widget subItemTitle(BuildContext context, String textKey, {IconData iconData}) {
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
AppTranslations.of(context).text(textKey),
|
||||
AppTranslations.of(context)!.text(textKey),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700, fontSize: 15, color: primaryColor),
|
||||
),
|
||||
@@ -34,8 +34,8 @@ Widget subItemTitle(BuildContext context, String textKey, {IconData iconData}) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactItem(BuildContext context, String text, IconData iconData,
|
||||
{Function() onTap, String labelKey}) {
|
||||
Widget contactItem(BuildContext context, String? text, IconData iconData,
|
||||
{Function()? onTap, String? labelKey}) {
|
||||
return Material(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, bottom: 10, right: 18),
|
||||
|
||||
@@ -22,14 +22,13 @@ import 'package:fcs/pages/widgets/local_title.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
class DeliveryInfo extends StatefulWidget {
|
||||
final Carton box;
|
||||
final Carton? box;
|
||||
DeliveryInfo({this.box});
|
||||
|
||||
@override
|
||||
@@ -38,8 +37,8 @@ class DeliveryInfo extends StatefulWidget {
|
||||
|
||||
class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
bool _isLoading = false;
|
||||
Carton _box;
|
||||
String _selectedCartonType;
|
||||
late Carton _box;
|
||||
late String _selectedCartonType;
|
||||
List<Package> _packages = [];
|
||||
List<Carton> _mixBoxes = [];
|
||||
Carton _selectedShipmentBox = new Carton();
|
||||
@@ -51,16 +50,17 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
double volumetricRatio = 0;
|
||||
double shipmentWeight = 0;
|
||||
|
||||
bool isMixBox;
|
||||
bool isFromShipments;
|
||||
bool isFromPackages;
|
||||
bool isSmallBag;
|
||||
bool isEdiable;
|
||||
late bool isMixBox;
|
||||
late bool isFromShipments;
|
||||
late bool isFromPackages;
|
||||
late bool isSmallBag;
|
||||
late bool isEdiable;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_box = widget.box;
|
||||
if(widget.box != null)
|
||||
_box = widget.box!;
|
||||
_selectedCartonType = _box.cartonType;
|
||||
|
||||
//for shipment weight
|
||||
@@ -143,13 +143,13 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
iconData: Ionicons.ios_airplane,
|
||||
);
|
||||
final fcsIDBox = DisplayText(
|
||||
text: _box.fcsID == null ? "" : _box.fcsID,
|
||||
text: _box.fcsID,
|
||||
labelTextKey: "box.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
);
|
||||
|
||||
final customerNameBox = DisplayText(
|
||||
text: _box.userName == null ? "" : _box.userName,
|
||||
text: _box.userName,
|
||||
labelTextKey: "box.name",
|
||||
iconData: Icons.person,
|
||||
);
|
||||
@@ -173,13 +173,11 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Text(
|
||||
_selectedShipmentBox.shipmentNumber == null
|
||||
? ""
|
||||
: _selectedShipmentBox.shipmentNumber,
|
||||
_selectedShipmentBox.shipmentNumber,
|
||||
style: textStyle,
|
||||
)),
|
||||
new Text(
|
||||
_selectedShipmentBox.desc == null ? "" : _selectedShipmentBox.desc,
|
||||
_selectedShipmentBox.desc,
|
||||
style: textStyle,
|
||||
),
|
||||
],
|
||||
@@ -216,7 +214,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(0) : "",
|
||||
text: shipmentWeight.toStringAsFixed(0) : "",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
@@ -302,7 +300,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
|
||||
});
|
||||
try {
|
||||
var deliveryModel = Provider.of<DeliveryModel>(context, listen: false);
|
||||
await deliveryModel.deliver(widget.box);
|
||||
await deliveryModel.deliver(this._box);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -3,14 +3,13 @@ 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_icons/flutter_icons.dart';
|
||||
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, this.box}) : super(key: key);
|
||||
|
||||
final double dotSize = 15.0;
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
@@ -19,10 +18,11 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box)),
|
||||
);
|
||||
if (box != null)
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => DeliveryInfo(box: box!)),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
@@ -48,7 +48,7 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
box.cartonNumber ?? "",
|
||||
box?.cartonNumber ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
@@ -56,7 +56,7 @@ class DeliveryListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
box.userName ?? "",
|
||||
box?.userName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
@@ -72,14 +72,14 @@ class DeliveryListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(box.status == null ? "" : box.status),
|
||||
child: getStatus(box?.status ?? ''),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${box.actualWeight?.toString() ?? ''} lb",
|
||||
"${box?.actualWeight.toString() ?? ''} lb",
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
@@ -7,13 +7,12 @@ import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DeliveryAddressEditor extends StatefulWidget {
|
||||
final DeliveryAddress deliveryAddress;
|
||||
final User user;
|
||||
final DeliveryAddress? deliveryAddress;
|
||||
final User? user;
|
||||
DeliveryAddressEditor({this.deliveryAddress, this.user});
|
||||
|
||||
@override
|
||||
@@ -38,7 +37,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
super.initState();
|
||||
if (widget.deliveryAddress != null) {
|
||||
_isNew = false;
|
||||
_deliveryAddress = widget.deliveryAddress;
|
||||
_deliveryAddress = widget.deliveryAddress!;
|
||||
_nameController.text = _deliveryAddress.fullName;
|
||||
_address1Controller.text = _deliveryAddress.addressLine1;
|
||||
_address2Controller.text = _deliveryAddress.addressLine2;
|
||||
@@ -198,7 +197,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
return;
|
||||
}
|
||||
if (widget.user != null) {
|
||||
deliveryAddress.userID = widget.user.id;
|
||||
deliveryAddress.userID = widget.user!.id;
|
||||
}
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
@@ -224,7 +223,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
return;
|
||||
}
|
||||
if (widget.user != null) {
|
||||
deliveryAddress.userID = widget.user.id;
|
||||
deliveryAddress.userID = widget.user!.id;
|
||||
}
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
@@ -255,7 +254,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
DeliveryAddressModel deliveryAddressModel =
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
if (widget.user != null) {
|
||||
_deliveryAddress.userID = widget.user.id;
|
||||
_deliveryAddress.userID = widget.user!.id;
|
||||
}
|
||||
await deliveryAddressModel.deleteDeliveryAddress(_deliveryAddress);
|
||||
Navigator.pop(context, true);
|
||||
@@ -278,7 +277,7 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
_stateController.text != "Yangon";
|
||||
} else {
|
||||
DeliveryAddress deliveryAddress = _getPayload();
|
||||
return widget.deliveryAddress.isChangedForEdit(deliveryAddress);
|
||||
return this._deliveryAddress.isChangedForEdit(deliveryAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ import 'model/delivery_address_model.dart';
|
||||
|
||||
class DeliveryAddressList extends StatefulWidget {
|
||||
final bool isAdminCreation;
|
||||
final DeliveryAddress deliveryAddress;
|
||||
final DeliveryAddress? deliveryAddress;
|
||||
const DeliveryAddressList(
|
||||
{Key key, this.isAdminCreation = false, this.deliveryAddress})
|
||||
{Key? key, this.isAdminCreation = false, this.deliveryAddress})
|
||||
: super(key: key);
|
||||
@override
|
||||
_DeliveryAddressListState createState() => _DeliveryAddressListState();
|
||||
@@ -85,7 +85,7 @@ class _DeliveryAddressListState extends State<DeliveryAddressList> {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Icon(Icons.check,
|
||||
color: widget.isAdminCreation
|
||||
? widget.deliveryAddress.id == deliveryAddress.id
|
||||
? widget.deliveryAddress?.id == deliveryAddress.id
|
||||
? primaryColor
|
||||
: Colors.black26
|
||||
: deliveryAddress.isDefault
|
||||
|
||||
@@ -3,15 +3,14 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
|
||||
typedef SelectionCallback(DeliveryAddress deliveryAddress);
|
||||
|
||||
class DeliveryAddressRow extends StatelessWidget {
|
||||
final DeliveryAddress deliveryAddress;
|
||||
final SelectionCallback selectionCallback;
|
||||
final SelectionCallback? selectionCallback;
|
||||
const DeliveryAddressRow(
|
||||
{Key key, this.deliveryAddress, this.selectionCallback})
|
||||
{Key? key, required this.deliveryAddress, this.selectionCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@@ -19,7 +18,7 @@ class DeliveryAddressRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: selectionCallback == null
|
||||
? null
|
||||
: () => this.selectionCallback(deliveryAddress),
|
||||
: () => this.selectionCallback!(deliveryAddress),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -54,8 +53,8 @@ class DeliveryAddressRow extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget line(BuildContext context, String text,
|
||||
{IconData iconData, Color color, double fontSize}) {
|
||||
Widget line(BuildContext context, String? text,
|
||||
{IconData? iconData, Color? color, double? fontSize}) {
|
||||
return Row(
|
||||
children: [
|
||||
iconData == null
|
||||
@@ -69,7 +68,7 @@ class DeliveryAddressRow extends StatelessWidget {
|
||||
context,
|
||||
text ?? "",
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color,
|
||||
color: color ?? Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/discount/model/discount_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/user_search/user_serach.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DiscountEditor extends StatefulWidget {
|
||||
final Discount discount;
|
||||
final Discount? discount;
|
||||
|
||||
const DiscountEditor({Key key, this.discount}) : super(key: key);
|
||||
const DiscountEditor({Key? key, this.discount}) : super(key: key);
|
||||
@override
|
||||
_DiscountEditorState createState() => _DiscountEditorState();
|
||||
}
|
||||
@@ -38,12 +35,12 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.discount != null) {
|
||||
_discount = widget.discount;
|
||||
_discount = widget.discount!;
|
||||
_codeController.text = _discount.code;
|
||||
_amountController.text = _discount.amount.toStringAsFixed(2);
|
||||
_statusController.text = _discount.status;
|
||||
customerName = widget.discount.customerName;
|
||||
customerId = widget.discount.customerId;
|
||||
customerName = _discount.customerName;
|
||||
customerId = _discount.customerId;
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
@@ -71,7 +68,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: customerName != null ? customerName : "",
|
||||
text: customerName,
|
||||
labelTextKey: "discount.name",
|
||||
iconData: Feather.user,
|
||||
)),
|
||||
@@ -93,7 +90,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("discount.form"),
|
||||
AppTranslations.of(context)!.text("discount.form"),
|
||||
),
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back),
|
||||
@@ -162,7 +159,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
if (_isNew) {
|
||||
await discountModel.addDiscount(_discount);
|
||||
} else {
|
||||
_discount.id = widget.discount.id;
|
||||
_discount.id = this._discount.id;
|
||||
await discountModel.updateDiscount(_discount);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
@@ -186,7 +183,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
});
|
||||
try {
|
||||
var discountModel = Provider.of<DiscountModel>(context, listen: false);
|
||||
await discountModel.deleteDiscount(widget.discount);
|
||||
await discountModel.deleteDiscount(_discount);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -208,7 +205,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
|
||||
customerName: customerName,
|
||||
customerId: customerId,
|
||||
amount: double.parse(_amountController.text));
|
||||
return widget.discount.isChangedForEdit(_discount);
|
||||
return widget.discount!.isChangedForEdit(_discount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'discount_editor.dart';
|
||||
class DiscountList extends StatefulWidget {
|
||||
final bool selectionMode;
|
||||
|
||||
const DiscountList({Key key, this.selectionMode = false}) : super(key: key);
|
||||
const DiscountList({Key? key, this.selectionMode = false}) : super(key: key);
|
||||
@override
|
||||
_DiscountListState createState() => _DiscountListState();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class _DiscountListState extends State<DiscountList> {
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("discount.title"),
|
||||
AppTranslations.of(context)!.text("discount.title"),
|
||||
),
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back),
|
||||
|
||||
@@ -5,15 +5,14 @@ import 'package:fcs/pages/discount/discount_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
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 OnSelect? onSelect;
|
||||
final Discount? discount;
|
||||
DiscountListRow({Key? key, this.discount, this.onSelect}) : super(key: key);
|
||||
|
||||
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||
|
||||
@@ -21,8 +20,8 @@ class DiscountListRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (onSelect != null) {
|
||||
onSelect(discount);
|
||||
if (onSelect != null && discount != null) {
|
||||
onSelect!(discount!);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -49,7 +48,7 @@ class DiscountListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
discount.code ?? "",
|
||||
discount?.code ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
@@ -57,7 +56,7 @@ class DiscountListRow extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
discount.customerName ?? "",
|
||||
discount?.customerName ?? "",
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
@@ -73,14 +72,14 @@ class DiscountListRow extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Text(discount.status),
|
||||
child: Text(discount?.status ?? ''),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
"${discount.amount.toStringAsFixed(2) ?? ''}",
|
||||
"${discount?.amount.toStringAsFixed(2) ?? ''}",
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
|
||||
@@ -11,13 +11,13 @@ import 'package:logging/logging.dart';
|
||||
class DiscountModel extends BaseModel {
|
||||
final log = Logger('DiscountModel');
|
||||
|
||||
StreamSubscription<QuerySnapshot> listener;
|
||||
StreamSubscription<QuerySnapshot>? listener;
|
||||
|
||||
List<Discount> _discounts = [];
|
||||
List<Discount> get discounts =>
|
||||
_selectedIndex == 1 ? _discounts : List<Discount>.from(_used.values);
|
||||
|
||||
Paginator _used;
|
||||
late Paginator _used;
|
||||
bool isLoading = false;
|
||||
int _selectedIndex = 1;
|
||||
set selectedIndex(int index) {
|
||||
@@ -25,14 +25,14 @@ class DiscountModel extends BaseModel {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
get selectedIndex => _selectedIndex;
|
||||
int get selectedIndex => _selectedIndex;
|
||||
|
||||
initData() {
|
||||
_selectedIndex = 1;
|
||||
_load();
|
||||
|
||||
if (_used != null) _used.close();
|
||||
_used = _getUsed();
|
||||
if (_getUsed() != null) _used = _getUsed()!;
|
||||
_used.load();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class DiscountModel extends BaseModel {
|
||||
}
|
||||
|
||||
_load() {
|
||||
if (listener != null) listener.cancel();
|
||||
if (listener != null) listener!.cancel();
|
||||
try {
|
||||
listener = Firestore.instance
|
||||
.collection("/$discounts_collection")
|
||||
@@ -60,7 +60,7 @@ class DiscountModel extends BaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
Paginator _getUsed() {
|
||||
Paginator? _getUsed() {
|
||||
if (user == null || !user.hasFcsShipments()) return null;
|
||||
|
||||
var pageQuery = Firestore.instance
|
||||
@@ -73,7 +73,7 @@ class DiscountModel extends BaseModel {
|
||||
return paginator;
|
||||
}
|
||||
|
||||
Future<List<Discount>> getDiscount(String userID) async {
|
||||
Future<List<Discount>?> getDiscount(String userID) async {
|
||||
String path = "/$discounts_collection";
|
||||
try {
|
||||
var q = Firestore.instance
|
||||
@@ -113,7 +113,7 @@ class DiscountModel extends BaseModel {
|
||||
|
||||
@override
|
||||
logout() async {
|
||||
if (listener != null) await listener.cancel();
|
||||
if (listener != null) await listener!.cancel();
|
||||
if (_used != null) _used.close();
|
||||
|
||||
_discounts = [];
|
||||
|
||||
@@ -13,14 +13,14 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class FAQDetailPage extends StatefulWidget {
|
||||
final FAQ faq;
|
||||
const FAQDetailPage({this.faq});
|
||||
const FAQDetailPage({required this.faq});
|
||||
@override
|
||||
_FAQDetailPageState createState() => _FAQDetailPageState();
|
||||
}
|
||||
|
||||
class _FAQDetailPageState extends State<FAQDetailPage> {
|
||||
bool _isLoading = false;
|
||||
FAQ faq;
|
||||
FAQ faq = new FAQ();
|
||||
|
||||
intState() {
|
||||
super.initState();
|
||||
|
||||
@@ -10,13 +10,12 @@ 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:flutter_icons/flutter_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
const info = "Select additional page";
|
||||
|
||||
class FAQEditor extends StatefulWidget {
|
||||
final FAQ faq;
|
||||
final FAQ? faq;
|
||||
const FAQEditor({this.faq});
|
||||
@override
|
||||
_FAQEditorState createState() => _FAQEditorState();
|
||||
@@ -35,20 +34,22 @@ class _FAQEditorState extends State<FAQEditor> {
|
||||
bool _isLoading = false;
|
||||
bool _isNew = false;
|
||||
String _pageLink = info;
|
||||
FAQ _faq = new FAQ();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isNew = widget.faq == null;
|
||||
if (widget.faq != null) {
|
||||
_sn.text = widget.faq.sn.toString();
|
||||
_engQ.text = widget.faq.questionEng;
|
||||
_mmQ.text = widget.faq.questionMm;
|
||||
_engA.text = widget.faq.answerEng;
|
||||
_mmA.text = widget.faq.answerMm;
|
||||
_pageLabelEng.text = widget.faq.pageLinkLabelEng;
|
||||
_pageLabelMm.text = widget.faq.pageLinkLabelMm;
|
||||
_pageLink = widget.faq.pageLink;
|
||||
_faq = widget.faq!;
|
||||
_sn.text = _faq.sn.toString();
|
||||
_engQ.text = _faq.questionEng;
|
||||
_mmQ.text = _faq.questionMm;
|
||||
_engA.text = _faq.answerEng;
|
||||
_mmA.text = _faq.answerMm;
|
||||
_pageLabelEng.text = _faq.pageLinkLabelEng;
|
||||
_pageLabelMm.text = _faq.pageLinkLabelMm;
|
||||
_pageLink = _faq.pageLink;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +90,8 @@ class _FAQEditorState extends State<FAQEditor> {
|
||||
height: 2,
|
||||
color: primaryColor,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
onChanged: (String? newValue) {
|
||||
if(newValue != null)
|
||||
setState(() {
|
||||
_pageLink = newValue;
|
||||
});
|
||||
@@ -211,7 +213,7 @@ class _FAQEditorState extends State<FAQEditor> {
|
||||
if (_isNew) {
|
||||
await faqModel.addFAQ(_faq);
|
||||
} else {
|
||||
_faq.id = widget.faq.id;
|
||||
_faq.id = this._faq.id;
|
||||
await faqModel.updateFAQ(_faq);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
@@ -234,7 +236,7 @@ class _FAQEditorState extends State<FAQEditor> {
|
||||
});
|
||||
try {
|
||||
FAQModel faqModel = Provider.of<FAQModel>(context, listen: false);
|
||||
await faqModel.deleteFAQ(widget.faq);
|
||||
await faqModel.deleteFAQ(this._faq);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/faq.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/buying_instruction/buying_online.dart';
|
||||
import 'package:fcs/pages/faq/faq_edit_page.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/payment_methods/payment_method_page.dart';
|
||||
import 'package:fcs/pages/rates/shipment_rates.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_expansion_tile.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -26,8 +24,8 @@ class FAQListPage extends StatefulWidget {
|
||||
|
||||
class _FAQListPageState extends State<FAQListPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
AnimationController _controller;
|
||||
Animation<double> _iconTurns;
|
||||
AnimationController? _controller;
|
||||
Animation<double>? _iconTurns;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -35,7 +33,7 @@ class _FAQListPageState extends State<FAQListPage>
|
||||
_controller = AnimationController(duration: _kExpand, vsync: this);
|
||||
var _halfTween = Tween<double>(begin: 0.0, end: 0.5);
|
||||
var _easeInTween = CurveTween(curve: Curves.easeIn);
|
||||
_iconTurns = _controller.drive(_halfTween.chain(_easeInTween));
|
||||
_iconTurns = _controller?.drive(_halfTween.chain(_easeInTween));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -139,7 +137,7 @@ class _FAQListPageState extends State<FAQListPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pageLink(String linkPage, String text) {
|
||||
Widget _pageLink(String? linkPage, String? text) {
|
||||
return linkPage == null || linkPage == "" || text == null || text == ""
|
||||
? Container()
|
||||
: Row(
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/transalation.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/signin/signin_page.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -27,9 +26,9 @@ class _InitialLanguageSelectionPageState
|
||||
languagesList[1]: languageCodesList[1],
|
||||
};
|
||||
|
||||
String selectedLanguage;
|
||||
int selectedIndex;
|
||||
bool _isLoading;
|
||||
String selectedLanguage = 'en';
|
||||
late int selectedIndex;
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -103,7 +102,7 @@ class _InitialLanguageSelectionPageState
|
||||
: BoxDecoration(
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: Colors.grey[300]),
|
||||
BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
@@ -134,7 +133,7 @@ class _InitialLanguageSelectionPageState
|
||||
child: Radio(
|
||||
value: key,
|
||||
groupValue: selectedIndex,
|
||||
onChanged: (int i) =>
|
||||
onChanged: (int? i) =>
|
||||
_select(key, language),
|
||||
activeColor: primaryColor,
|
||||
),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
@@ -76,7 +74,8 @@ class _ProfileCurrencyEditState extends State<ProfileCurrencyEdit> {
|
||||
activeColor: primaryColor,
|
||||
value: Currency.USD,
|
||||
groupValue: _currency,
|
||||
onChanged: (Currency value) {
|
||||
onChanged: (Currency? value) {
|
||||
if(value != null)
|
||||
setState(() {
|
||||
_currency = value;
|
||||
});
|
||||
@@ -94,7 +93,8 @@ class _ProfileCurrencyEditState extends State<ProfileCurrencyEdit> {
|
||||
activeColor: primaryColor,
|
||||
value: Currency.MMK,
|
||||
groupValue: _currency,
|
||||
onChanged: (Currency value) {
|
||||
onChanged: (Currency? value) {
|
||||
if(value != null)
|
||||
setState(() {
|
||||
_currency = value;
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ class _ProfileEditState extends State<ProfileEdit> {
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
decoration: new InputDecoration(
|
||||
labelText: AppTranslations.of(context).text("profile.name"),
|
||||
labelText: AppTranslations.of(context)!.text("profile.name"),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/domain/vo/privilege.dart';
|
||||
import 'package:fcs/localization/transalation.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
@@ -11,7 +9,6 @@ import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/profile/profile_currency_edit.dart';
|
||||
import 'package:fcs/pages/profile/profile_edit.dart';
|
||||
import 'package:fcs/pages/staff/model/staff_model.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||
@@ -20,7 +17,6 @@ import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
@@ -35,7 +31,7 @@ class Profile extends StatefulWidget {
|
||||
class _ProfileState extends State<Profile> {
|
||||
GlobalKey key = GlobalKey();
|
||||
bool _isLoading = false;
|
||||
String selectedLanguage;
|
||||
String? selectedLanguage ;
|
||||
TextEditingController bizNameController = new TextEditingController();
|
||||
|
||||
static final List<String> languagesList = Translation().supportedLanguages;
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:provider/provider.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CargoEditor extends StatefulWidget {
|
||||
final CargoType cargo;
|
||||
final CargoType? cargo;
|
||||
CargoEditor({this.cargo});
|
||||
|
||||
@override
|
||||
@@ -23,14 +23,14 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
TextEditingController _rateController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
CargoType _cargo;
|
||||
late CargoType _cargo;
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.cargo != null) {
|
||||
_cargo = widget.cargo;
|
||||
_cargo = widget.cargo!;
|
||||
_descController.text = _cargo.name;
|
||||
_rateController.text = _cargo.rate.toStringAsFixed(2);
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
},
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("cargo.form.title")),
|
||||
title: Text(AppTranslations.of(context)!.text("cargo.form.title")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
@@ -114,7 +114,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addCargoType(_cargo);
|
||||
} else {
|
||||
_cargo.id = widget.cargo.id;
|
||||
_cargo.id = this._cargo.id;
|
||||
await shipmentRateModel.updateCargoType(_cargo);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
@@ -138,7 +138,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteCargoType(widget.cargo.id);
|
||||
await shipmentRateModel.deleteCargoType(this._cargo.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -155,7 +155,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
} else {
|
||||
CargoType _cargo = CargoType(
|
||||
name: _descController.text, rate: double.parse(_rateController.text));
|
||||
return widget.cargo.isChangedForEdit(_cargo);
|
||||
return this._cargo.isChangedForEdit(_cargo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'cargo_editor.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CargoTypeList extends StatefulWidget {
|
||||
const CargoTypeList({Key key}) : super(key: key);
|
||||
const CargoTypeList({Key? key}) : super(key: key);
|
||||
@override
|
||||
_CargoTypeListState createState() => _CargoTypeListState();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CustomEditor extends StatefulWidget {
|
||||
final CargoType custom;
|
||||
final CargoType? custom;
|
||||
CustomEditor({this.custom});
|
||||
|
||||
@override
|
||||
@@ -32,7 +32,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.custom != null) {
|
||||
_custom = widget.custom;
|
||||
_custom = widget.custom!;
|
||||
_productController.text = _custom.name;
|
||||
_feeController.text = _custom.customDutyFee.toStringAsFixed(2);
|
||||
_shipmentRateController.text =
|
||||
@@ -83,7 +83,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title:
|
||||
Text(AppTranslations.of(context).text("rate.custom.form.title")),
|
||||
Text(AppTranslations.of(context)!.text("rate.custom.form.title")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
@@ -129,7 +129,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addCustomDuty(_customduty);
|
||||
} else {
|
||||
_customduty.id = widget.custom.id;
|
||||
_customduty.id = this._custom.id;
|
||||
await shipmentRateModel.updateCustomDuty(_customduty);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
@@ -154,7 +154,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel.deleteCustomDuty(widget.custom.id);
|
||||
await shipmentRateModel.deleteCustomDuty(this._custom.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -175,7 +175,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
name: _productController.text,
|
||||
customDutyFee: double.parse(_feeController.text),
|
||||
rate: double.parse(_shipmentRateController.text));
|
||||
return widget.custom.isChangedForEditCustomDuty(_customduty);
|
||||
return this._custom.isChangedForEditCustomDuty(_customduty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -14,8 +9,8 @@ import 'package:provider/provider.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CustomList extends StatefulWidget {
|
||||
final bool selected;
|
||||
const CustomList({Key key, this.selected}) : super(key: key);
|
||||
final bool? selected;
|
||||
const CustomList({Key? key, this.selected}) : super(key: key);
|
||||
@override
|
||||
_CustomListState createState() => _CustomListState();
|
||||
}
|
||||
@@ -28,7 +23,7 @@ class _CustomListState extends State<CustomList> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.selected != null) {
|
||||
_selected = widget.selected;
|
||||
_selected = widget.selected!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,13 @@ import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
|
||||
typedef SelectionCallback(CustomDuty custom);
|
||||
|
||||
class CustomRow extends StatelessWidget {
|
||||
final CustomDuty custom;
|
||||
final SelectionCallback selectionCallback;
|
||||
const CustomRow({Key key, this.custom, this.selectionCallback})
|
||||
final SelectionCallback? selectionCallback;
|
||||
const CustomRow({Key? key, required this.custom, this.selectionCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@@ -19,7 +18,7 @@ class CustomRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: selectionCallback == null
|
||||
? null
|
||||
: () => this.selectionCallback(custom),
|
||||
: () => this.selectionCallback!(custom),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -40,8 +39,8 @@ class CustomRow extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget line(BuildContext context, String text,
|
||||
{IconData iconData, Color color, double fontSize}) {
|
||||
Widget line(BuildContext context, String? text,
|
||||
{IconData? iconData, Color? color, double? fontSize}) {
|
||||
return Row(
|
||||
children: [
|
||||
iconData == null
|
||||
@@ -55,7 +54,7 @@ class CustomRow extends StatelessWidget {
|
||||
context,
|
||||
text ?? "",
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color,
|
||||
color: color ?? Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||
import 'package:fcs/pages/rates/discount_by_weight_editor.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.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:provider/provider.dart';
|
||||
|
||||
import 'custom_row.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class DiscountByWeightList extends StatefulWidget {
|
||||
const DiscountByWeightList({Key key}) : super(key: key);
|
||||
const DiscountByWeightList({Key? key}) : super(key: key);
|
||||
@override
|
||||
_DiscountByWeightListState createState() => _DiscountByWeightListState();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DiscountByWeightEditor extends StatefulWidget {
|
||||
final DiscountByWeight discountByWeight;
|
||||
final DiscountByWeight? discountByWeight;
|
||||
DiscountByWeightEditor({this.discountByWeight});
|
||||
|
||||
@override
|
||||
@@ -23,14 +23,14 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
TextEditingController _discountController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
bool _isNew;
|
||||
bool _isNew = false;
|
||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.discountByWeight != null) {
|
||||
_discountByWeight = widget.discountByWeight;
|
||||
_discountByWeight = widget.discountByWeight!;
|
||||
_weightController.text = _discountByWeight.weight.toStringAsFixed(2);
|
||||
_discountController.text = _discountByWeight.discount.toString();
|
||||
_isNew = false;
|
||||
@@ -73,7 +73,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
},
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("discount.new")),
|
||||
title: Text(AppTranslations.of(context)!.text("discount.new")),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
@@ -117,7 +117,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addDiscountByWeight(_discount);
|
||||
} else {
|
||||
_discount.id = widget.discountByWeight.id;
|
||||
_discount.id = this._discountByWeight.id;
|
||||
await shipmentRateModel.updateDiscountByWeight(_discount);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
@@ -143,7 +143,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
await shipmentRateModel
|
||||
.deleteDiscountByWeight(widget.discountByWeight.id);
|
||||
.deleteDiscountByWeight(this._discountByWeight.id);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -161,7 +161,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
DiscountByWeight _discount = DiscountByWeight(
|
||||
weight: double.parse(_weightController.text),
|
||||
discount: double.parse(_discountController.text));
|
||||
return widget.discountByWeight.isChangedForEdit(_discount);
|
||||
return this._discountByWeight.isChangedForEdit(_discount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/rate.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
@@ -12,7 +11,6 @@ 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:flutter_icons/flutter_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ShipmentRatesCal extends StatefulWidget {
|
||||
@@ -24,7 +22,7 @@ class ShipmentRatesCal extends StatefulWidget {
|
||||
|
||||
class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
bool _isLoading = false;
|
||||
CargoType _cargoType;
|
||||
late CargoType _cargoType;
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/domain/entities/rate.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -14,8 +10,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../main/util.dart';
|
||||
import 'cargo_editor.dart';
|
||||
import 'custom_editor.dart';
|
||||
|
||||
class ShipmentRatesEdit extends StatefulWidget {
|
||||
ShipmentRatesEdit();
|
||||
@@ -32,7 +26,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
TextEditingController _diffDiscountWeight = new TextEditingController();
|
||||
TextEditingController _diffWeightRate = new TextEditingController();
|
||||
|
||||
Rate rate;
|
||||
late Rate rate;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -99,7 +93,7 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
},
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("rate.edit.title")),
|
||||
title: Text(AppTranslations.of(context)!.text("rate.edit.title")),
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(18),
|
||||
|
||||
@@ -16,7 +16,7 @@ class RequestInvitationPage extends StatefulWidget {
|
||||
|
||||
class _RequestInvitationPageState extends State<RequestInvitationPage> {
|
||||
bool _isLoading = false;
|
||||
TextEditingController nameCtl;
|
||||
TextEditingController nameCtl = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:fcs/domain/entities/auth_result.dart';
|
||||
import 'package:fcs/domain/entities/auth_status.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/signin/signin_logic.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -23,9 +22,9 @@ class SigninPage extends StatefulWidget {
|
||||
|
||||
class _SigninPageState extends State<SigninPage> {
|
||||
bool _isLoading = false;
|
||||
String dialCode;
|
||||
late String dialCode;
|
||||
|
||||
TextEditingController phonenumberCtl;
|
||||
TextEditingController phonenumberCtl = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -82,7 +81,7 @@ class _SigninPageState extends State<SigninPage> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey[400], width: 1),
|
||||
border: Border.all(color: Colors.grey.shade400, width: 1),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0))),
|
||||
child: CountryCodePicker(
|
||||
onChanged: _countryChange,
|
||||
@@ -152,7 +151,7 @@ class _SigninPageState extends State<SigninPage> {
|
||||
|
||||
_countryChange(CountryCode countryCode) {
|
||||
setState(() {
|
||||
dialCode = countryCode.dialCode;
|
||||
dialCode = countryCode.dialCode ?? '+95';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class SignupPage extends StatefulWidget {
|
||||
|
||||
class _SignupPageState extends State<SignupPage> {
|
||||
bool _isLoading = false;
|
||||
TextEditingController nameCtl;
|
||||
TextEditingController nameCtl = new TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -18,18 +18,19 @@ const resend_count_sec = 30;
|
||||
|
||||
class SmsCodePage extends StatefulWidget {
|
||||
final String phoneNumber;
|
||||
const SmsCodePage({Key key, this.phoneNumber}) : super(key: key);
|
||||
const SmsCodePage({Key? key, required this.phoneNumber}) : super(key: key);
|
||||
@override
|
||||
_SmsCodePageState createState() => _SmsCodePageState();
|
||||
}
|
||||
|
||||
class _SmsCodePageState extends State<SmsCodePage> {
|
||||
bool _isLoading = false;
|
||||
String pin;
|
||||
bool allNumberEntered;
|
||||
Timer _timer;
|
||||
int _start = resend_count_sec;
|
||||
bool canResend = false;
|
||||
int _start = resend_count_sec;
|
||||
|
||||
late String pin;
|
||||
late bool allNumberEntered;
|
||||
late Timer _timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -116,7 +117,7 @@ class _SmsCodePageState extends State<SmsCodePage> {
|
||||
pinLength: 6,
|
||||
decoration: BoxLooseDecoration(
|
||||
strokeColorBuilder: PinListenColorBuilder(
|
||||
primaryColor, Colors.grey[400])),
|
||||
primaryColor, Colors.grey.shade400)),
|
||||
textInputAction: TextInputAction.done,
|
||||
autoFocus: true,
|
||||
onChanged: _pinChange,
|
||||
@@ -133,13 +134,13 @@ class _SmsCodePageState extends State<SmsCodePage> {
|
||||
child: LocalText(context, 'sms.resend',
|
||||
fontSize: 16,
|
||||
color:
|
||||
canResend ? primaryColor : Colors.grey[400]),
|
||||
canResend ? primaryColor : Colors.grey.shade400),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
side: BorderSide(
|
||||
color: canResend
|
||||
? primaryColor
|
||||
: Colors.grey[400])),
|
||||
: Colors.grey.shade400)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: allNumberEntered ? _verify : null,
|
||||
|
||||
Reference in New Issue
Block a user