add fcs shipment apis

This commit is contained in:
Sai Naw Wun
2020-10-08 03:32:52 +06:30
parent ad1999f5c9
commit 6105b45cb8
23 changed files with 442 additions and 531 deletions

View File

@@ -243,9 +243,9 @@
"FCS Shipment Start ================================================================":"", "FCS Shipment Start ================================================================":"",
"FCSshipment.title":"FCS Shipments", "FCSshipment.title":"FCS Shipments",
"FCSshipment.list.title":"FCS SHIPMENTS", "FCSshipment.list.title":"FCS Shipments",
"FCSshipment.add":"New FCS shipment", "FCSshipment.add":"New FCS shipment",
"FCSshipment.form.title":"FCS SHIPMENT", "FCSshipment.form.title":"FCS Shipment",
"FCSshipment.number":"FCS Shipment Number", "FCSshipment.number":"FCS Shipment Number",
"FCSshipment.cutoff_date":"Cutoff Date", "FCSshipment.cutoff_date":"Cutoff Date",
"FCSshipment.ETA":"ETA", "FCSshipment.ETA":"ETA",

View File

@@ -6,6 +6,7 @@ const privilege_collection = "privileges";
const markets_collection = "markets"; const markets_collection = "markets";
const packages_collection = "packages"; const packages_collection = "packages";
const messages_collection = "messages"; const messages_collection = "messages";
const fcs_shipment_collection = "fcs_shipments";
const user_requested_status = "requested"; const user_requested_status = "requested";
const user_invited_status = "invited"; const user_invited_status = "invited";
@@ -20,38 +21,7 @@ const page_buying_instructions = "buying_instructions";
const message_type_package = "t_p"; const message_type_package = "t_p";
const message_type_profile = "t_profile"; const message_type_profile = "t_profile";
////////////////////////////// // Fcs shipment status
const fcs_shipment_confirmed_status = "confirmed";
const ok_doc_id = "ok"; const fcs_shipment_shipped_status = "shipped";
const fcs_shipment_delivered_status = "delivered";
const biz_collection = "bizs";
const product_collection = "products";
const user_level_collection = "user_levels";
const storage_collection = "storages";
const buyer_collection = "buyers";
const buying_pos = "buying_pos";
const selling_pos = "selling_pos";
const inventory_takings = "inventory_takings";
const inventory_lines = "inventory_lines";
const pds_collection = "pds";
const pos_collection = "pos";
const dos_collection = "dos";
const notification_collection = "notifications";
const log_collection = "logs";
const report_collection = "reports";
const po_product_collection = "po_products";
const device_collection = "devices";
const do_po_lines_collection = "do_po_lines";
const reports_collection = "reports";
const announcement_collection = "announcements";
const report_user_collection = "report_users";
const po_files_path = "/ok/po";
const reg_files_path = "/ok/reg";
const do_files_path = "/ok/do";
const sign_files_path = "/ok/sign";
const bank_images_path = "/ok/banks";
const po_approved_status = "approved";
const po_closed_status = "closed";
const do_approved_status = "approved";

View File

@@ -1,31 +0,0 @@
class BankAccount {
int index;
String bankName;
String bankLogo;
String accountName;
String accountNumber;
BankAccount(
{this.index,
this.bankName,
this.bankLogo,
this.accountName,
this.accountNumber});
BankAccount.fromMap(int index, Map<String, dynamic> json) {
this.index = index;
bankName = json['bank_name'];
bankLogo = json['bank_logo'];
accountName = json['account_name'];
accountNumber = json['account_number'];
}
Map<String, dynamic> toMap() {
return {
"index": index,
'bank_name': bankName,
'bank_logo': bankLogo,
'account_name': accountName,
'account_number': accountNumber,
};
}
}

View File

@@ -1,6 +1,9 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import '../constants.dart';
class FcsShipment { class FcsShipment {
String id; String id;
DateTime shipDate;
String shipmentNumber; String shipmentNumber;
DateTime cutoffDate; DateTime cutoffDate;
String shipType; String shipType;
@@ -10,10 +13,8 @@ class FcsShipment {
String port; String port;
String destination; String destination;
String status; String status;
String remark; FcsShipment({
FcsShipment( this.id,
{this.id,
this.shipDate,
this.shipmentNumber, this.shipmentNumber,
this.cutoffDate, this.cutoffDate,
this.shipType, this.shipType,
@@ -23,12 +24,30 @@ class FcsShipment {
this.consignee, this.consignee,
this.port, this.port,
this.destination, this.destination,
this.remark}); });
factory FcsShipment.fromMap(Map<String, dynamic> map, String docID) {
var _cutoffDate = (map['cutoff_date'] as Timestamp);
var _arrivalDate = (map['arrival_date'] as Timestamp);
var _departureDate = (map['departure_date'] as Timestamp);
return FcsShipment(
id: docID,
cutoffDate: _cutoffDate != null ? _cutoffDate.toDate() : null,
arrivalDate: _arrivalDate != null ? _arrivalDate.toDate() : null,
departureDate: _departureDate != null ? _departureDate.toDate() : null,
shipmentNumber: map['shipment_number'],
shipType: map['shipment_type'],
status: map['status'],
consignee: map['consignee'],
port: map['port'],
destination: map['destination'],
);
}
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
"id": id, "id": id,
'shipment_date': shipDate?.toUtc()?.toIso8601String(),
'shipment_number': shipmentNumber, 'shipment_number': shipmentNumber,
'cutoff_date': cutoffDate?.toUtc()?.toIso8601String(), 'cutoff_date': cutoffDate?.toUtc()?.toIso8601String(),
'shipment_type': shipType, 'shipment_type': shipType,
@@ -38,7 +57,10 @@ class FcsShipment {
'port': port, 'port': port,
'destination': destination, 'destination': destination,
'status': status, 'status': status,
'remark': remark,
}; };
} }
bool isConfirmed() {
return status == fcs_shipment_confirmed_status;
}
} }

View File

@@ -1,7 +1,3 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'bank_account.dart';
List<Day> dayLists = [ List<Day> dayLists = [
Day(id: 1, name: 'Sun'), Day(id: 1, name: 'Sun'),
Day(id: 2, name: 'Mon'), Day(id: 2, name: 'Mon'),
@@ -26,61 +22,12 @@ class Setting {
String appUrl; String appUrl;
final String termsEng; final String termsEng;
final String termsMm; final String termsMm;
String about;
final String okEnergyId; List<String> shipmentTypes;
final String about;
int poExpireInHours;
int doExpireInHours;
int poOpenAt;
int poCloseAt;
List<int> poCloseOn;
int latestDeliveryDay;
int firstStorageChargeIn;
int firstStorageCharge;
int secondStorageChargeIn;
int secondStorageCharge;
int deliveryStartWaitMin;
String reportURL;
String helpVersion;
String helpURL;
List<String> phones; Setting({
String deliveryPhone; this.supportBuildNum,
String address;
String website;
DateTime priceLastUpdate;
String bankAccountInfo;
List<BankAccount> bankAccounts;
String get getPoOpenAt => poOpenAt > 12
? (poOpenAt - 12).toString() + "PM"
: poOpenAt.toString() + "AM";
String get getPoCloseAt => poCloseAt > 12
? (poCloseAt - 12).toString() + "PM"
: poCloseAt.toString() + "AM";
String get getPoCloseOn => poCloseOn.fold(
"", (p, e) => p + (p == "" ? "" : ", ") + dayLists[e - 1].name);
String get getPoOpenOn => dayLists.fold(
"",
(p, e) =>
p +
(p == "" ? "" : poCloseOn.contains(e.id) ? "" : ", ") +
(poCloseOn.contains(e.id) ? "" : e.name));
bool get isPOClose {
DateTime now = DateTime.now();
// dart starts from monday width starting index one
// server starts from sunday with starting index one
var day = (now.weekday + 1) == 8 ? 1 : now.weekday + 1;
return poCloseOn.contains(day) ||
(now.hour < poOpenAt || now.hour >= poCloseAt);
}
Setting(
{this.supportBuildNum,
this.usaAddress, this.usaAddress,
this.mmAddress, this.mmAddress,
this.usaContactNumber, this.usaContactNumber,
@@ -92,41 +39,10 @@ class Setting {
this.termsEng, this.termsEng,
this.termsMm, this.termsMm,
this.about, this.about,
this.okEnergyId, this.shipmentTypes,
this.poExpireInHours, });
this.doExpireInHours,
this.poOpenAt,
this.poCloseAt,
this.poCloseOn,
this.latestDeliveryDay,
this.firstStorageCharge,
this.firstStorageChargeIn,
this.secondStorageCharge,
this.secondStorageChargeIn,
this.deliveryStartWaitMin,
this.reportURL,
this.helpVersion,
this.helpURL,
this.phones,
this.website,
this.priceLastUpdate,
this.bankAccountInfo,
this.bankAccounts,
this.deliveryPhone,
this.address});
factory Setting.fromMap(Map<String, dynamic> map) { factory Setting.fromMap(Map<String, dynamic> map) {
var ts = (map['price_last_update'] as Timestamp);
var list = (map['bank_accounts'] as List);
List<BankAccount> bankAccounts = [];
if (list != null) {
list.asMap().forEach((index, item) {
bankAccounts
.add(BankAccount.fromMap(index, item.cast<String, dynamic>()));
});
}
return Setting( return Setting(
supportBuildNum: map['support_build_number'], supportBuildNum: map['support_build_number'],
inviteRequired: map['invite_required'], inviteRequired: map['invite_required'],
@@ -140,26 +56,8 @@ class Setting {
about: map['about'], about: map['about'],
termsEng: map['terms_eng'], termsEng: map['terms_eng'],
termsMm: map['terms_mm'], termsMm: map['terms_mm'],
priceLastUpdate: ts?.toDate(), shipmentTypes: List.from(map['shipment_types']),
okEnergyId: map['ok_energy_id'], );
poExpireInHours: map['po_expire_hours'],
doExpireInHours: map['do_expire_hours'],
poOpenAt: map['po_open_at'],
poCloseAt: map['po_close_at'],
latestDeliveryDay: map['latest_delivery_days'],
firstStorageChargeIn: map['first_storage_charge_in'],
firstStorageCharge: map['first_storage_charge'],
secondStorageChargeIn: map['second_storage_charge_in'],
secondStorageCharge: map['second_storage_charge'],
deliveryStartWaitMin: map['delivery_start_wait_min'],
reportURL: map['report_url'],
helpVersion: map['help_version'],
helpURL: map['help_url'],
deliveryPhone: map['delivery_phone'],
address: map['address'],
website: map['website'],
bankAccountInfo: map['bank_account_info'],
bankAccounts: bankAccounts);
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
@@ -169,13 +67,9 @@ class Setting {
}; };
} }
String helpFileName() {
return "help-v$helpVersion.zip";
}
@override @override
String toString() { String toString() {
return 'Setting{supportBuildNum:$supportBuildNum,about:$about,okEnergyId:$okEnergyId}'; return 'Setting{supportBuildNum:$supportBuildNum,about:$about}';
} }
} }

View File

@@ -9,9 +9,9 @@ void main() {
Config( Config(
flavor: Flavor.DEV, flavor: Flavor.DEV,
color: Colors.blue, color: Colors.blue,
reportURL: "http://192.168.100.11:8080", reportURL: "http://192.168.43.88:8080",
reportProjectID: "fcs-dev", reportProjectID: "fcs-dev",
apiURL: "http://192.168.100.11:7777", apiURL: "http://192.168.43.88:7777",
level: Level.ALL); level: Level.ALL);
runApp(App()); runApp(App());
} }

View File

@@ -28,7 +28,7 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
final phoneNumberBox = DisplayText( final phoneNumberBox = DisplayText(
text: mainModel.user.phone, text: mainModel.user.phone,
labelText: getLocalString(context, "contact.phone"), labelTextKey: getLocalString(context, "contact.phone"),
iconData: Icons.location_on, iconData: Icons.location_on,
); );
final nameBox = Center( final nameBox = Center(
@@ -38,12 +38,12 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
)); ));
final fcsIdBox = DisplayText( final fcsIdBox = DisplayText(
text: mainModel.user.fcsID, text: mainModel.user.fcsID,
labelText: getLocalString(context, "customer.fcs.id"), labelTextKey: getLocalString(context, "customer.fcs.id"),
icon: FcsIDIcon(), icon: FcsIDIcon(),
); );
final shippingAddressBox = DisplayText( final shippingAddressBox = DisplayText(
text: mainModel.setting.usaAddress, text: mainModel.setting.usaAddress,
labelText: getLocalString(context, "profile.usa.shipping.address"), labelTextKey: getLocalString(context, "profile.usa.shipping.address"),
iconData: Icons.location_on, iconData: Icons.location_on,
); );
final instructionBox = Container( final instructionBox = Container(

View File

@@ -32,7 +32,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: widget.customer.phoneNumber, text: widget.customer.phoneNumber,
labelText: getLocalString(context, "customer.phone"), labelTextKey: getLocalString(context, "customer.phone"),
iconData: Icons.phone, iconData: Icons.phone,
)), )),
IconButton( IconButton(
@@ -72,12 +72,12 @@ class _CustomerEditorState extends State<CustomerEditor> {
phoneNumberBox, phoneNumberBox,
DisplayText( DisplayText(
text: widget.customer.fcsID, text: widget.customer.fcsID,
labelText: getLocalString(context, "customer.fcs.id"), labelTextKey: getLocalString(context, "customer.fcs.id"),
icon: FcsIDIcon(), icon: FcsIDIcon(),
), ),
DisplayText( DisplayText(
text: widget.customer.status, text: widget.customer.status,
labelText: getLocalString(context, "customer.status"), labelTextKey: getLocalString(context, "customer.status"),
iconData: Icons.add_alarm, iconData: Icons.add_alarm,
), ),
SizedBox( SizedBox(

View File

@@ -31,7 +31,7 @@ class _InvitationEditorState extends State<InvitationEditor> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: widget.customer.phoneNumber, text: widget.customer.phoneNumber,
labelText: getLocalString(context, "customer.phone"), labelTextKey: getLocalString(context, "customer.phone"),
iconData: Icons.phone, iconData: Icons.phone,
)), )),
IconButton( IconButton(

View File

@@ -58,7 +58,7 @@ class _DiscountEditorState extends State<DiscountEditor> {
controller: _amountController); controller: _amountController);
final statusBox = DisplayText( final statusBox = DisplayText(
text: _statusController.text, text: _statusController.text,
labelText: getLocalString(context, "discount.status"), labelTextKey: getLocalString(context, "discount.status"),
iconData: Icons.av_timer, iconData: Icons.av_timer,
); );

View File

@@ -5,18 +5,17 @@ import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
import 'package:fcs/pages/main/model/language_model.dart'; import 'package:fcs/pages/main/model/language_model.dart';
import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/model/main_model.dart';
import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/input_date.dart';
import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/input_text.dart';
import 'package:fcs/pages/widgets/label_widgets.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/popupmenu.dart'; import 'package:fcs/pages/widgets/popupmenu.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import '../main/util.dart'; import '../main/util.dart';
class FcsShipmentEditor extends StatefulWidget { class FcsShipmentEditor extends StatefulWidget {
@@ -37,22 +36,28 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
TextEditingController _portController = new TextEditingController(); TextEditingController _portController = new TextEditingController();
TextEditingController _destinationController = new TextEditingController(); TextEditingController _destinationController = new TextEditingController();
TextEditingController _statusController = new TextEditingController(); TextEditingController _statusController = new TextEditingController();
TextEditingController _remarkController = new TextEditingController();
FcsShipment _shipment = new FcsShipment(); FcsShipment _shipment = new FcsShipment();
bool _isLoading = false; bool _isLoading = false;
String _currentShipment; String _currentShipmentType;
bool _isNew = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_isNew = widget.shipment == null;
if (widget.shipment != null) { if (widget.shipment != null) {
_shipment = widget.shipment; _shipment = widget.shipment;
_shipmentNumberController.text = _shipment.shipmentNumber; _shipmentNumberController.text = _shipment.shipmentNumber;
_cutoffDateController.text = dateFormatter.format(_shipment.cutoffDate);
_arrivalDateController.text = dateFormatter.format(_shipment.arrivalDate); _arrivalDateController.text = dateFormatter.format(_shipment.arrivalDate);
_departureDateControler.text = _departureDateControler.text =
dateFormatter.format(_shipment.departureDate); dateFormatter.format(_shipment.departureDate);
_statusController.text = _shipment.status; _statusController.text = _shipment.status;
_currentShipmentType = _shipment.shipType;
_consigneeController.text = _shipment.consignee;
_portController.text = _shipment.port;
_destinationController.text = _shipment.destination;
} }
} }
@@ -61,76 +66,21 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
super.dispose(); super.dispose();
} }
Widget showShipmentNumber(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 10),
child: Row(
children: <Widget>[
Icon(Icons.text_rotation_none),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: labeledText(
context, _shipmentNumberController.text, "shipment.number"),
),
],
),
);
}
Widget showShipmentTypes(
BuildContext context, FcsShipmentModel shipmentModel) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Icon(MaterialCommunityIcons.box_shadow),
SizedBox(
width: 10,
),
new Flexible(
child: Container(
width: 200.0,
child: DropdownButton<String>(
value: _currentShipment,
isExpanded: true,
hint: Text(
'Select shipment type',
),
onChanged: changedDropDown,
items: shipmentModel.shipmentType
.map<DropdownMenuItem<String>>((String shipment) {
return new DropdownMenuItem<String>(
value: shipment,
child: new Text(shipment,
style:
new TextStyle(color: Colors.black87, fontSize: 17)),
);
}).toList(),
),
),
),
],
);
}
void changedDropDown(selected) {
setState(() {
_currentShipment = selected;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var shipmentModel = Provider.of<FcsShipmentModel>(context);
var languageModel = Provider.of<LanguageModel>(context); var languageModel = Provider.of<LanguageModel>(context);
var mainModel = Provider.of<MainModel>(context);
final createBtn = fcsButton( final createBtn = fcsButton(
context, context,
getLocalString(context, "FCSshipment.create"), getLocalString(context, "FCSshipment.create"),
callack: _create,
); );
final updateBtn = fcsButton( final updateBtn = fcsButton(
context, context,
getLocalString(context, "FCSshipment.update"), getLocalString(context, "FCSshipment.update"),
callack: _update,
); );
return LocalProgress( return LocalProgress(
@@ -150,111 +100,74 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
color: primaryColor, color: primaryColor,
fontSize: 18, fontSize: 18,
), ),
actions: [menuPopWidget(context)], actions: _isNew ? [] : [menuPopWidget(context)],
), ),
body: Card( body: Padding(
child: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
// _showCustomerData(mainModel.customer), InputText(
widget.shipment == null
? InputText(
labelTextKey: "FCSshipment.number", labelTextKey: "FCSshipment.number",
iconData: Ionicons.ios_airplane, iconData: Ionicons.ios_airplane,
controller: _shipmentNumberController, controller: _shipmentNumberController,
) ),
: DisplayText( InputDate(
iconData: Ionicons.ios_airplane,
labelText: "FCSshipment.number",
text: _shipmentNumberController.text),
widget.shipment == null
? InputText(
labelTextKey: "FCSshipment.cutoff_date", labelTextKey: "FCSshipment.cutoff_date",
iconData: Icons.date_range, iconData: Icons.date_range,
controller: _cutoffDateController, controller: _cutoffDateController,
) ),
: Container(), InputDate(
InputText(
labelTextKey: "FCSshipment.ETA", labelTextKey: "FCSshipment.ETA",
iconData: Icons.date_range, iconData: Icons.date_range,
controller: _arrivalDateController, controller: _arrivalDateController,
), ),
InputDate(
InputText(
labelTextKey: "FCSshipment.departure_date", labelTextKey: "FCSshipment.departure_date",
iconData: Icons.date_range, iconData: Icons.date_range,
controller: _departureDateControler, controller: _departureDateControler,
), ),
widget.shipment == null DropdownButtonFormField(
? DropdownButtonFormField( value: _currentShipmentType == "" ? null : _currentShipmentType,
decoration: InputDecoration( decoration: InputDecoration(
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: primaryColor)),
fillColor: Colors.white, fillColor: Colors.white,
labelStyle: languageModel.isEng labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
? labelStyle
: labelStyleMM,
labelText: AppTranslations.of(context) labelText: AppTranslations.of(context)
.text('FCSshipment.shipment_type'), .text('FCSshipment.shipment_type'),
icon: Icon(Ionicons.ios_airplane, icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
color: primaryColor)), items: mainModel.setting.shipmentTypes
items: shipmentModel.shipmentType .map((e) => DropdownMenuItem(child: Text(e), value: e))
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
.toList(), .toList(),
onChanged: (selected) => { onChanged: (selected) => {
setState(() { setState(() {
_currentShipment = selected; _currentShipmentType = selected;
}) })
}, },
) ),
: Container(), InputText(
widget.shipment == null
? InputText(
labelTextKey: 'FCSshipment.consignee', labelTextKey: 'FCSshipment.consignee',
iconData: Icons.work, iconData: Icons.work,
controller: _consigneeController) controller: _consigneeController),
: Container(), InputText(
widget.shipment == null
? InputText(
labelTextKey: 'FCSshipment.port_of_loading', labelTextKey: 'FCSshipment.port_of_loading',
iconData: FontAwesomeIcons.ship, iconData: FontAwesomeIcons.ship,
controller: _portController) controller: _portController),
: Container(), InputText(
widget.shipment == null
? InputText(
labelTextKey: 'FCSshipment.final_destination', labelTextKey: 'FCSshipment.final_destination',
iconData: MaterialCommunityIcons.location_enter, iconData: MaterialCommunityIcons.location_enter,
controller: _destinationController) controller: _destinationController),
: Container(), _isNew
widget.shipment == null
? Container() ? Container()
: Container( : Container(
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: DisplayText( child: DisplayText(
text: _statusController.text, text: _statusController.text,
iconData: Icons.av_timer, iconData: Icons.av_timer,
labelText: 'FCSshipment.status', labelTextKey: 'FCSshipment.status',
)), )),
_isNew ? createBtn : updateBtn,
widget.shipment == null
? Container()
: InputText(
labelTextKey: 'FCSshipment.remark',
iconData: MaterialCommunityIcons.note,
controller: _remarkController),
]),
)),
widget.shipment == null ? createBtn : updateBtn,
SizedBox(height: 15) SizedBox(height: 15)
], ]),
),
), ),
), ),
); );
@@ -312,4 +225,96 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
}).toList(); }).toList();
}); });
} }
FcsShipment _getPayload() {
FcsShipment fcsShipment = FcsShipment();
fcsShipment.id = _shipment.id;
fcsShipment.shipmentNumber = _shipmentNumberController.text;
fcsShipment.shipType = _currentShipmentType;
fcsShipment.consignee = _consigneeController.text;
fcsShipment.port = _portController.text;
fcsShipment.destination = _destinationController.text;
try {
var cutoffDate = _cutoffDateController.text;
var arrivalDate = _arrivalDateController.text;
var depDate = _departureDateControler.text;
fcsShipment.cutoffDate =
cutoffDate == "" ? null : dateFormatter.parse(cutoffDate);
fcsShipment.arrivalDate =
arrivalDate == "" ? null : dateFormatter.parse(arrivalDate);
fcsShipment.departureDate =
depDate == "" ? null : dateFormatter.parse(depDate);
} catch (e) {
showMsgDialog(context, "Error", e.toString()); // shold never happen
}
return fcsShipment;
}
Future<bool> _validate(FcsShipment fcsShipment) async {
if (fcsShipment.shipmentNumber == "") {
await showMsgDialog(context, "Error", "Invalid shipment number!");
return false;
}
if (fcsShipment.shipType == null) {
await showMsgDialog(context, "Error", "Invalid shipment type!");
return false;
}
if (fcsShipment.cutoffDate == null) {
await showMsgDialog(context, "Error", "Invalid cutoff date!");
return false;
}
if (fcsShipment.arrivalDate == null) {
await showMsgDialog(context, "Error", "Invalid ETA date!");
return false;
}
if (fcsShipment.departureDate == null) {
await showMsgDialog(context, "Error", "Invalid departure date!");
return false;
}
return true;
}
Future<void> _create() async {
FcsShipment fcsShipment = _getPayload();
bool valid = await _validate(fcsShipment);
if (!valid) {
return;
}
setState(() {
_isLoading = true;
});
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
try {
await shipmentModel.create(fcsShipment);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
Future<void> _update() async {
FcsShipment fcsShipment = _getPayload();
bool valid = await _validate(fcsShipment);
if (!valid) {
return;
}
setState(() {
_isLoading = true;
});
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
try {
await shipmentModel.update(fcsShipment);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
} }

View File

@@ -4,6 +4,7 @@ import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -39,22 +40,12 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.close), icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: LocalText(context, 'FCSshipment.list.title', title: LocalText(context, 'FCSshipment.list.title',
color: Colors.white, fontSize: 20), color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
// onPressed: () => showPlacesSearch(context),
),
],
), ),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
onPressed: () { onPressed: () {
@@ -74,10 +65,11 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15), padding: EdgeInsets.only(top: 15),
shrinkWrap: true, shrinkWrap: true,
itemCount: shipmentModel.shipments.length, itemCount: shipmentModel.fcsShipments.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return FcsShipmentListRow( return FcsShipmentListRow(
shipment: shipmentModel.shipments[index]); key: ValueKey(shipmentModel.fcsShipments[index].id),
shipment: shipmentModel.fcsShipments[index]);
}), }),
), ),
], ],

View File

@@ -8,27 +8,10 @@ import 'package:intl/intl.dart';
import 'fcs_shipment_editor.dart'; import 'fcs_shipment_editor.dart';
class FcsShipmentListRow extends StatefulWidget { class FcsShipmentListRow extends StatelessWidget {
final FcsShipment shipment; final FcsShipment shipment;
const FcsShipmentListRow({this.shipment}); final dateFormatter = new DateFormat('dd MMM yyyy');
FcsShipmentListRow({Key key, this.shipment}) : super(key: key);
@override
_FcsShipmentListRowState createState() => _FcsShipmentListRowState();
}
class _FcsShipmentListRowState extends State<FcsShipmentListRow> {
var dateFormatter = new DateFormat('dd MMM yyyy');
final double dotSize = 15.0;
FcsShipment _shipment = new FcsShipment();
@override
void initState() {
super.initState();
if (widget.shipment != null) {
_shipment = widget.shipment;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -37,7 +20,7 @@ class _FcsShipmentListRowState extends State<FcsShipmentListRow> {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.push(BottomUpPageRoute(FcsShipmentEditor(shipment: _shipment))); .push(BottomUpPageRoute(FcsShipmentEditor(shipment: shipment)));
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@@ -61,9 +44,9 @@ class _FcsShipmentListRowState extends State<FcsShipmentListRow> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0), padding: const EdgeInsets.only(left: 8.0),
child: new Text( child: new Text(
_shipment.shipmentNumber == null shipment.shipmentNumber == null
? '' ? ''
: _shipment.shipmentNumber, : shipment.shipmentNumber,
style: new TextStyle( style: new TextStyle(
fontSize: 15.0, color: Colors.black), fontSize: 15.0, color: Colors.black),
), ),
@@ -71,7 +54,7 @@ class _FcsShipmentListRowState extends State<FcsShipmentListRow> {
Padding( Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10), padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text( child: new Text(
dateFormatter.format(_shipment.shipDate), dateFormatter.format(shipment.cutoffDate),
style: new TextStyle( style: new TextStyle(
fontSize: 15.0, color: Colors.grey), fontSize: 15.0, color: Colors.grey),
), ),
@@ -85,7 +68,7 @@ class _FcsShipmentListRowState extends State<FcsShipmentListRow> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
child: getStatus(_shipment.status), child: getStatus(shipment.status),
), ),
], ],
), ),

View File

@@ -1,78 +1,45 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/data/services/services.dart'; import 'package:fcs/data/services/services.dart';
import 'package:fcs/domain/constants.dart';
import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/pages/main/model/base_model.dart'; import 'package:fcs/pages/main/model/base_model.dart';
import 'package:logging/logging.dart';
class FcsShipmentModel extends BaseModel { class FcsShipmentModel extends BaseModel {
List<String> shipmentType = ['Air', 'Ship', 'Cargo Truck']; final log = Logger('FcsShipmentModel');
List<FcsShipment> shipments = [
FcsShipment(
shipDate: DateTime(2020, 4, 23),
shipmentNumber: 'A103B',
status: 'In Progress',
arrivalDate: DateTime(2020, 4, 30),
departureDate: DateTime(2020, 4, 23)),
FcsShipment(
shipDate: DateTime(2020, 4, 2),
shipmentNumber: 'A100A',
status: 'Ready to ship',
arrivalDate: DateTime(2020, 4, 28),
departureDate: DateTime(2020, 4, 15)),
FcsShipment(
shipDate: DateTime(2020, 4, 2),
shipmentNumber: 'A100B',
status: 'Arrived',
arrivalDate: DateTime(2020, 4, 28),
departureDate: DateTime(2020, 4, 15)),
FcsShipment(
shipDate: DateTime(2020, 4, 10),
shipmentNumber: 'A102B',
status: 'Canceled',
arrivalDate: DateTime(2020, 4, 20),
departureDate: DateTime(2020, 4, 10)),
FcsShipment(
shipDate: DateTime(2020, 4, 2),
shipmentNumber: 'A100B',
status: 'Canceled',
arrivalDate: DateTime(2020, 4, 20),
departureDate: DateTime(2020, 4, 23)),
FcsShipment(
shipDate: DateTime(2020, 4, 10),
shipmentNumber: 'A102B',
status: 'Arrived',
arrivalDate: DateTime(2020, 4, 30),
departureDate: DateTime(2020, 4, 20),
)
];
List<FcsShipment> get canceled { StreamSubscription<QuerySnapshot> listener;
List<FcsShipment> _p = List<FcsShipment> fcsShipments = [];
shipments.where((e) => e.status == "Canceled").toList()
..sort((e1, e2) { @override
return e1.shipDate.compareTo(e2.shipDate); void privilegeChanged() {
}); super.privilegeChanged();
return _p; _loadFcsShipments();
} }
List<FcsShipment> get completed { Future<void> _loadFcsShipments() async {
return shipments.where((e) => e.status == "Arrived").toList() if (user == null) return;
..sort((e1, e2) { String path = "/$fcs_shipment_collection/";
return e1.shipDate.compareTo(e2.shipDate); if (listener != null) listener.cancel();
fcsShipments = [];
try {
listener = Firestore.instance
.collection("$path")
.snapshots()
.listen((QuerySnapshot snapshot) {
fcsShipments.clear();
fcsShipments = snapshot.documents.map((documentSnapshot) {
var s = FcsShipment.fromMap(
documentSnapshot.data, documentSnapshot.documentID);
return s;
}).toList();
notifyListeners();
}); });
} catch (e) {
log.warning("Error!! $e");
} }
List<FcsShipment> get upcoming {
List<FcsShipment> _shipments = shipments
.where((e) =>
e.status == "In Progress" ||
e.status == "Ready to ship" ||
e.status == "Processed" ||
e.status == "Rescheduled")
.toList();
_shipments.sort((e1, e2) {
return e1.shipDate.compareTo(e2.shipDate);
});
return _shipments;
} }
void initUser(user) { void initUser(user) {
@@ -81,6 +48,14 @@ class FcsShipmentModel extends BaseModel {
@override @override
logout() async { logout() async {
shipments = []; fcsShipments = [];
}
Future<void> create(FcsShipment fcsShipment) {
return Services.instance.fcsShipmentService.createFcsShipment(fcsShipment);
}
Future<void> update(FcsShipment fcsShipment) {
return Services.instance.fcsShipmentService.updateFcsShipment(fcsShipment);
} }
} }

View File

@@ -220,8 +220,9 @@ class _HomePageState extends State<HomePage> {
final fcsShipmentBtn = TaskButton("FCSshipment.title", final fcsShipmentBtn = TaskButton("FCSshipment.title",
icon: Ionicons.ios_airplane, icon: Ionicons.ios_airplane,
btnCallback: () => btnCallback: () => Navigator.of(context).push<void>(CupertinoPageRoute(
Navigator.of(context).push(BottomUpPageRoute(FcsShipmentList()))); builder: (context) => FcsShipmentList(),
)));
final notiBtnOrg = final notiBtnOrg =
TaskButton("message.btn", icon: Icons.message, btnCallback: () { TaskButton("message.btn", icon: Icons.message, btnCallback: () {

View File

@@ -52,17 +52,17 @@ class _PackageEditorPageState extends State<PackageEditorPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final trackingIdBox = DisplayText( final trackingIdBox = DisplayText(
text: _package.trackingID, text: _package.trackingID,
labelText: getLocalString(context, "package.tracking.id"), labelTextKey: "package.tracking.id",
iconData: MaterialCommunityIcons.barcode_scan, iconData: MaterialCommunityIcons.barcode_scan,
); );
final statusBox = DisplayText( final statusBox = DisplayText(
text: _package.currentStatus, text: _package.currentStatus,
labelText: getLocalString(context, "package.edit.status"), labelTextKey: "package.edit.status",
iconData: AntDesign.exclamationcircleo, iconData: AntDesign.exclamationcircleo,
); );
final customerNameBox = DisplayText( final customerNameBox = DisplayText(
text: _package.userName, text: _package.userName,
labelText: getLocalString(context, "package.create.name"), labelTextKey: "package.create.name",
iconData: Icons.perm_identity, iconData: Icons.perm_identity,
); );
final completeProcessingBtn = fcsButton( final completeProcessingBtn = fcsButton(

View File

@@ -58,32 +58,32 @@ class _PackageInfoState extends State<PackageInfo> {
final trackingIdBox = DisplayText( final trackingIdBox = DisplayText(
text: _package.trackingID, text: _package.trackingID,
labelText: getLocalString(context, "package.tracking.id"), labelTextKey: "package.tracking.id",
iconData: MaterialCommunityIcons.barcode_scan, iconData: MaterialCommunityIcons.barcode_scan,
); );
final customerNameBox = DisplayText( final customerNameBox = DisplayText(
text: _package.userName, text: _package.userName,
labelText: getLocalString(context, "package.create.name"), labelTextKey: "package.create.name",
iconData: Icons.perm_identity, iconData: Icons.perm_identity,
); );
final statusBox = DisplayText( final statusBox = DisplayText(
text: _package.currentStatus, text: _package.currentStatus,
labelText: getLocalString(context, "package.edit.status"), labelTextKey: "package.edit.status",
iconData: AntDesign.exclamationcircleo, iconData: AntDesign.exclamationcircleo,
); );
final marketBox = DisplayText( final marketBox = DisplayText(
text: _package.market ?? "-", text: _package.market ?? "-",
labelText: getLocalString(context, "package.create.market"), labelTextKey: "package.create.market",
iconData: Icons.store, iconData: Icons.store,
); );
final descBox = DisplayText( final descBox = DisplayText(
text: _package.desc ?? "-", text: _package.desc ?? "-",
labelText: getLocalString(context, "package.edit.desc"), labelTextKey: "package.edit.desc",
iconData: MaterialCommunityIcons.message_text_outline, iconData: MaterialCommunityIcons.message_text_outline,
); );
final remarkBox = DisplayText( final remarkBox = DisplayText(
text: _package.remark ?? "-", text: _package.remark ?? "-",
labelText: getLocalString(context, "package.edit.remark"), labelTextKey: "package.edit.remark",
iconData: Entypo.new_message, iconData: Entypo.new_message,
); );
final img = MultiImageFile( final img = MultiImageFile(

View File

@@ -41,7 +41,7 @@ class _PackageNewState extends State<PackageNew> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: user != null ? user.fcsID : "", text: user != null ? user.fcsID : "",
labelText: getLocalString(context, "package.create.fcs.id"), labelTextKey: "package.create.fcs.id",
icon: FcsIDIcon(), icon: FcsIDIcon(),
)), )),
IconButton( IconButton(
@@ -55,12 +55,12 @@ class _PackageNewState extends State<PackageNew> {
); );
final namebox = DisplayText( final namebox = DisplayText(
text: user != null ? user.name : "", text: user != null ? user.name : "",
labelText: getLocalString(context, "package.create.name"), labelTextKey: "package.create.name",
iconData: Icons.person, iconData: Icons.person,
); );
final phoneNumberBox = DisplayText( final phoneNumberBox = DisplayText(
text: user != null ? user.phoneNumber : "", text: user != null ? user.phoneNumber : "",
labelText: getLocalString(context, "package.create.phone"), labelTextKey: "package.create.phone",
iconData: Icons.phone, iconData: Icons.phone,
); );
final createButton = fcsButton( final createButton = fcsButton(

View File

@@ -132,7 +132,7 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: text, text: text,
labelText: getLocalString(context, labelKey), labelTextKey: getLocalString(context, labelKey),
iconData: iconData, iconData: iconData,
), ),
), ),

View File

@@ -60,13 +60,13 @@ class _ProfileState extends State<Profile> {
} }
final namebox = DisplayText( final namebox = DisplayText(
text: mainModel.user.name, text: mainModel.user.name,
labelText: getLocalString(context, "profile.name"), labelTextKey: getLocalString(context, "profile.name"),
iconData: Icons.person, iconData: Icons.person,
); );
final phonenumberbox = DisplayText( final phonenumberbox = DisplayText(
text: mainModel.user.phone, text: mainModel.user.phone,
labelText: getLocalString(context, "profile.phone"), labelTextKey: getLocalString(context, "profile.phone"),
iconData: Icons.phone, iconData: Icons.phone,
); );
final fcsIDBox = Row( final fcsIDBox = Row(
@@ -74,7 +74,7 @@ class _ProfileState extends State<Profile> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: mainModel.user.fcsID, text: mainModel.user.fcsID,
labelText: getLocalString(context, "customer.fcs.id"), labelTextKey: getLocalString(context, "customer.fcs.id"),
icon: FcsIDIcon(), icon: FcsIDIcon(),
), ),
), ),
@@ -90,7 +90,8 @@ class _ProfileState extends State<Profile> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: mainModel.setting.usaAddress, text: mainModel.setting.usaAddress,
labelText: getLocalString(context, "profile.usa.shipping.address"), labelTextKey:
getLocalString(context, "profile.usa.shipping.address"),
iconData: Icons.location_on, iconData: Icons.location_on,
), ),
), ),
@@ -158,7 +159,7 @@ class _ProfileState extends State<Profile> {
usaShippingAddressBox, usaShippingAddressBox,
DisplayText( DisplayText(
text: mainModel.user.status, text: mainModel.user.status,
labelText: getLocalString(context, "customer.status"), labelTextKey: getLocalString(context, "customer.status"),
iconData: Icons.add_alarm, iconData: Icons.add_alarm,
), ),
// getShippingAddressList(context), // getShippingAddressList(context),

View File

@@ -128,7 +128,7 @@ class _StaffEditorState extends State<StaffEditor> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final namebox = DisplayText( final namebox = DisplayText(
text: user.name, text: user.name,
labelText: getLocalString(context, "customer.name"), labelTextKey: getLocalString(context, "customer.name"),
iconData: Icons.person, iconData: Icons.person,
); );
var phoneNumberBox = Row( var phoneNumberBox = Row(
@@ -136,7 +136,7 @@ class _StaffEditorState extends State<StaffEditor> {
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: user.phoneNumber, text: user.phoneNumber,
labelText: getLocalString(context, "customer.phone"), labelTextKey: getLocalString(context, "customer.phone"),
iconData: Icons.phone, iconData: Icons.phone,
)), )),
isNew isNew

View File

@@ -7,7 +7,7 @@ import 'package:provider/provider.dart';
class DisplayText extends StatelessWidget { class DisplayText extends StatelessWidget {
final String text; final String text;
final String labelText; final String labelTextKey;
final IconData iconData; final IconData iconData;
final int maxLines; final int maxLines;
final bool withBorder; final bool withBorder;
@@ -17,7 +17,7 @@ class DisplayText extends StatelessWidget {
const DisplayText({ const DisplayText({
Key key, Key key,
this.text, this.text,
this.labelText, this.labelTextKey,
this.iconData, this.iconData,
this.maxLines = 1, this.maxLines = 1,
this.withBorder = false, this.withBorder = false,
@@ -57,10 +57,10 @@ class DisplayText extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
labelText == null labelTextKey == null
? Container() ? Container()
: Text( : Text(
AppTranslations.of(context).text(labelText), AppTranslations.of(context).text(labelTextKey),
style: labelStyle, style: labelStyle,
), ),
Text( Text(

View File

@@ -0,0 +1,99 @@
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
class InputDate extends StatelessWidget {
final String labelTextKey;
final IconData iconData;
final TextEditingController controller;
final FormFieldValidator<String> validator;
final int maxLines;
final bool withBorder;
final Color borderColor;
final TextInputType textInputType;
final bool autoFocus;
final String dateFormatString;
const InputDate(
{Key key,
this.labelTextKey,
this.iconData,
this.controller,
this.validator,
this.maxLines = 1,
this.withBorder = false,
this.borderColor,
this.autoFocus = false,
this.dateFormatString = "dd MMM yyyy",
this.textInputType})
: super(key: key);
@override
Widget build(BuildContext context) {
var languageModel = Provider.of<LanguageModel>(context);
return Padding(
padding: const EdgeInsets.only(top: 15.0, bottom: 5),
child: TextFormField(
readOnly: true,
onTap: () async {
var dateFormatter = new DateFormat(dateFormatString);
FocusScope.of(context).unfocus();
var initialDate = DateTime.now();
if (controller != null) {
try {
initialDate = dateFormatter.parse(controller.text);
} catch (e) {} // ignore error
}
var d = await showDatePicker(
context: context,
firstDate: DateTime(0),
lastDate: DateTime(2025),
initialDate: initialDate,
);
if (d != null && controller != null) {
controller.text = dateFormatter.format(d);
}
},
controller: controller,
autofocus: autoFocus,
cursorColor: primaryColor,
style: textStyle,
maxLines: maxLines,
keyboardType: textInputType,
decoration: new InputDecoration(
// hintText: '',
hintStyle: TextStyle(
height: 1.5,
),
labelText: labelTextKey == null
? null
: AppTranslations.of(context).text(labelTextKey),
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
icon: iconData == null
? null
: Icon(
iconData,
color: primaryColor,
),
enabledBorder: withBorder
? OutlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0),
)
: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0)),
focusedBorder: withBorder
? OutlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0),
)
: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0)),
),
validator: validator),
);
}
}