add faq
This commit is contained in:
BIN
assets/fonts/Myanmar3_2018.ttf
Normal file
BIN
assets/fonts/Myanmar3_2018.ttf
Normal file
Binary file not shown.
@@ -41,6 +41,8 @@
|
|||||||
"faq.edit.mm":"Myanmar",
|
"faq.edit.mm":"Myanmar",
|
||||||
"faq.edit.question":"Question",
|
"faq.edit.question":"Question",
|
||||||
"faq.edit.answer":"Answer",
|
"faq.edit.answer":"Answer",
|
||||||
|
"faq.edit.sn":"S/N",
|
||||||
|
"faq.edit.delete.confirm":"Delete this FAQ?",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
"faq.edit.mm":"မြန်မာ",
|
"faq.edit.mm":"မြန်မာ",
|
||||||
"faq.edit.question":"မေးခွန်း",
|
"faq.edit.question":"မေးခွန်း",
|
||||||
"faq.edit.answer":"အဖြေ",
|
"faq.edit.answer":"အဖြေ",
|
||||||
|
"faq.edit.sn":"S/N",
|
||||||
|
"faq.edit.delete.confirm":"Delete this FAQ?",
|
||||||
|
|
||||||
"btn.save":"သိမ်းဆည်းရန်",
|
"btn.save":"သိမ်းဆည်းရန်",
|
||||||
"btn.approve":"အတည်ပြုရန်",
|
"btn.approve":"အတည်ပြုရန်",
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import 'package:fcs/fcs/common/helpers/theme.dart';
|
|||||||
import 'package:fcs/fcs/common/localization/app_translations_delegate.dart';
|
import 'package:fcs/fcs/common/localization/app_translations_delegate.dart';
|
||||||
import 'package:fcs/fcs/common/localization/transalation.dart';
|
import 'package:fcs/fcs/common/localization/transalation.dart';
|
||||||
import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart';
|
import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/term/model/term_model.dart';
|
import 'package:fcs/fcs/common/pages/term/model/term_model.dart';
|
||||||
import 'package:fcs/fcs/common/services/services.dart';
|
import 'package:fcs/fcs/common/services/services.dart';
|
||||||
@@ -31,7 +33,6 @@ import 'package:fcs/fcs/common/pages/model/main_model.dart' as fcs;
|
|||||||
|
|
||||||
import 'model/announcement_model.dart';
|
import 'model/announcement_model.dart';
|
||||||
import 'model/chart_model.dart';
|
import 'model/chart_model.dart';
|
||||||
import 'model/customer_model.dart';
|
|
||||||
import 'model/device_model.dart';
|
import 'model/device_model.dart';
|
||||||
import 'model/do_model.dart';
|
import 'model/do_model.dart';
|
||||||
import 'model/employee_model.dart';
|
import 'model/employee_model.dart';
|
||||||
@@ -60,6 +61,7 @@ class _AppState extends State<App> {
|
|||||||
final ContactModel contactModel =new ContactModel();
|
final ContactModel contactModel =new ContactModel();
|
||||||
final TermModel termModel=new TermModel();
|
final TermModel termModel=new TermModel();
|
||||||
final MainModel mainModel = new MainModel();
|
final MainModel mainModel = new MainModel();
|
||||||
|
final FAQModel faqModel = new FAQModel();
|
||||||
|
|
||||||
final UserModel userModel = new UserModel();
|
final UserModel userModel = new UserModel();
|
||||||
final ProductModel productModel = new ProductModel();
|
final ProductModel productModel = new ProductModel();
|
||||||
@@ -130,7 +132,6 @@ class _AppState extends State<App> {
|
|||||||
..addModel(messageModel)
|
..addModel(messageModel)
|
||||||
..addModel(shipmentRateModel)
|
..addModel(shipmentRateModel)
|
||||||
..addModel(invoiceModel)
|
..addModel(invoiceModel)
|
||||||
..addModel(customerModel)
|
|
||||||
..addModel(discountModel);
|
..addModel(discountModel);
|
||||||
this.mainModel.init();
|
this.mainModel.init();
|
||||||
|
|
||||||
@@ -249,6 +250,7 @@ class _AppState extends State<App> {
|
|||||||
ChangeNotifierProvider.value(value: mainModel2),
|
ChangeNotifierProvider.value(value: mainModel2),
|
||||||
ChangeNotifierProvider.value(value: contactModel),
|
ChangeNotifierProvider.value(value: contactModel),
|
||||||
ChangeNotifierProvider.value(value: termModel),
|
ChangeNotifierProvider.value(value: termModel),
|
||||||
|
ChangeNotifierProvider.value(value: faqModel),
|
||||||
],
|
],
|
||||||
child: Consumer<LanguageModel>(
|
child: Consumer<LanguageModel>(
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
|
|||||||
@@ -109,6 +109,13 @@ class AuthFb {
|
|||||||
user.hasSignup =
|
user.hasSignup =
|
||||||
idToken.claims.containsKey("signup") && idToken.claims["signup"];
|
idToken.claims.containsKey("signup") && idToken.claims["signup"];
|
||||||
user.phoneNumber = firebaseUser.phoneNumber;
|
user.phoneNumber = firebaseUser.phoneNumber;
|
||||||
|
|
||||||
|
// add privileges
|
||||||
|
String privileges = idToken.claims["privileges"];
|
||||||
|
if (privileges != null && privileges != "") {
|
||||||
|
user.privileges = privileges.split(":").toList();
|
||||||
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
lib/fcs/common/domain/entities/customer.dart
Normal file
36
lib/fcs/common/domain/entities/customer.dart
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
class Customer {
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
String phoneNumber;
|
||||||
|
String status;
|
||||||
|
|
||||||
|
Customer({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.status,
|
||||||
|
this.phoneNumber,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Customer.fromMap(Map<String, dynamic> map, String docID) {
|
||||||
|
return Customer(
|
||||||
|
id: docID,
|
||||||
|
name: map['user_name'],
|
||||||
|
phoneNumber: map['phone_number'],
|
||||||
|
status: map['status'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'user_name': name,
|
||||||
|
'phone_number': phoneNumber,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Customer{name: $name, phoneNumber: $phoneNumber,statis:$status}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
class FAQ {
|
class FAQ {
|
||||||
String id;
|
String id;
|
||||||
|
int sn;
|
||||||
String questionEng;
|
String questionEng;
|
||||||
String questionMm;
|
String questionMm;
|
||||||
String answerEng;
|
String answerEng;
|
||||||
@@ -8,20 +9,40 @@ class FAQ {
|
|||||||
String question(bool isEng) => isEng ? questionEng : questionMm;
|
String question(bool isEng) => isEng ? questionEng : questionMm;
|
||||||
String answer(bool isEng) => isEng ? answerEng : answerMm;
|
String answer(bool isEng) => isEng ? answerEng : answerMm;
|
||||||
|
|
||||||
Map<String, String> images;
|
Map<String, String> imageUrls;
|
||||||
FAQ({this.id,this.questionEng,this.questionMm,this.answerEng,this.answerMm,this.images});
|
FAQ(
|
||||||
|
{this.id,
|
||||||
|
this.sn,
|
||||||
|
this.questionEng,
|
||||||
|
this.questionMm,
|
||||||
|
this.answerEng,
|
||||||
|
this.answerMm,
|
||||||
|
this.imageUrls});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
'id': id,
|
||||||
|
'sn':sn,
|
||||||
'question_eng': questionEng,
|
'question_eng': questionEng,
|
||||||
'answer_eng': answerEng,
|
'answer_eng': answerEng,
|
||||||
'question_mm': questionMm,
|
'question_mm': questionMm,
|
||||||
'answer_mm': answerMm,
|
'answer_mm': answerMm,
|
||||||
'images': images,
|
'images': imageUrls,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
factory FAQ.fromMap(Map<String, dynamic> map, String id) {
|
||||||
|
return FAQ(
|
||||||
|
id: id,
|
||||||
|
sn: map['sn'],
|
||||||
|
questionEng: map['question_eng'],
|
||||||
|
answerEng: map['answer_eng'],
|
||||||
|
questionMm: map['question_mm'],
|
||||||
|
answerMm: map['answer_mm'],
|
||||||
|
imageUrls: Map.from(map['images'] ?? Map<String, String>()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'FAQ{id: $id, questionEng: $questionEng,questionMm:$questionMm}';
|
return 'FAQ{id: $id, questionEng: $questionEng,questionMm:$questionMm}';
|
||||||
|
|||||||
72
lib/fcs/common/domain/entities/role.dart
Normal file
72
lib/fcs/common/domain/entities/role.dart
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
class Role {
|
||||||
|
String roleID;
|
||||||
|
String roleName;
|
||||||
|
String privileges;
|
||||||
|
Role({this.roleName, this.roleID, this.privileges});
|
||||||
|
|
||||||
|
Role.fromJson(Map<String, dynamic> json) {
|
||||||
|
roleName = json['role_name'];
|
||||||
|
roleID = json['role_id'];
|
||||||
|
privileges = json['privileges'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Parser {
|
||||||
|
String status;
|
||||||
|
String message;
|
||||||
|
Role data;
|
||||||
|
Parser({this.status, this.message, this.data});
|
||||||
|
|
||||||
|
Parser.fromJson(Map<String, dynamic> json) {
|
||||||
|
status = json['status'];
|
||||||
|
message = json['message'];
|
||||||
|
if (json['status'] == 'Ok') {
|
||||||
|
data = Role.fromJson(json['data']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StatusParser {
|
||||||
|
String status;
|
||||||
|
String message;
|
||||||
|
StatusParser(this.status, this.message);
|
||||||
|
|
||||||
|
StatusParser.fromJson(Map<String, dynamic> json) {
|
||||||
|
status = json['status'];
|
||||||
|
message = json['message'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Privilege {
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
String desc;
|
||||||
|
bool sysAdminOnly = true;
|
||||||
|
bool isChecked = false;
|
||||||
|
|
||||||
|
Privilege({this.id, this.name, this.desc, this.isChecked, this.sysAdminOnly});
|
||||||
|
|
||||||
|
factory Privilege.fromMap(Map<String, dynamic> map, String docID) {
|
||||||
|
return Privilege(
|
||||||
|
id: docID,
|
||||||
|
name: map['name'],
|
||||||
|
desc: map['desc'],
|
||||||
|
sysAdminOnly: map['sys_admin_only']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserLevel {
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
int level;
|
||||||
|
UserLevel({this.id, this.name, this.level});
|
||||||
|
|
||||||
|
factory UserLevel.fromMap(Map<String, dynamic> map, String docID) {
|
||||||
|
return UserLevel(
|
||||||
|
id: docID,
|
||||||
|
name: map['name'],
|
||||||
|
level: map['level']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,283 +1,70 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
String id;
|
String id;
|
||||||
String name;
|
String name;
|
||||||
String phoneNumber;
|
String phoneNumber;
|
||||||
bool hasSignup;
|
bool hasSignup;
|
||||||
|
List<String> privileges = [];
|
||||||
|
|
||||||
String fcsID;
|
String fcsID;
|
||||||
String shippingAddress;
|
|
||||||
String deliveryAddress;
|
|
||||||
String get phone => phoneNumber != null && phoneNumber.startsWith("959")
|
String get phone => phoneNumber != null && phoneNumber.startsWith("959")
|
||||||
? "0${phoneNumber.substring(2)}"
|
? "0${phoneNumber.substring(2)}"
|
||||||
: phoneNumber;
|
: phoneNumber;
|
||||||
|
|
||||||
List<String> claimPrivileges = [];
|
User({
|
||||||
|
this.id,
|
||||||
final String dateofBirth;
|
|
||||||
final String gender;
|
|
||||||
final String status;
|
|
||||||
final bool disable;
|
|
||||||
bool registeredBuyer;
|
|
||||||
List<String> privilegeIds;
|
|
||||||
String roleName;
|
|
||||||
String roleID;
|
|
||||||
bool agreeTerms;
|
|
||||||
String bizID;
|
|
||||||
String accountID;
|
|
||||||
String email;
|
|
||||||
bool isBlock;
|
|
||||||
int userLevel;
|
|
||||||
String userLevelID;
|
|
||||||
|
|
||||||
String frontUrl;
|
|
||||||
String backUrl;
|
|
||||||
String selfieUrl;
|
|
||||||
|
|
||||||
DateTime lastActiveTime;
|
|
||||||
String device;
|
|
||||||
|
|
||||||
String primaryDeviceID;
|
|
||||||
String primaryDeviceName;
|
|
||||||
|
|
||||||
String pin;
|
|
||||||
|
|
||||||
String get getname => this.name;
|
|
||||||
String get getphonenumber => this.phoneNumber;
|
|
||||||
String get getdateofBirth => this.dateofBirth;
|
|
||||||
bool get getdisable => this.disable;
|
|
||||||
|
|
||||||
Future<void> setFirebaseUser(FirebaseUser firebaseUser) async {
|
|
||||||
IdTokenResult idToken = await firebaseUser.getIdToken(refresh: true);
|
|
||||||
String privileges = idToken.claims["privileges"];
|
|
||||||
if (privileges == null || privileges == "") return;
|
|
||||||
this.claimPrivileges = privileges.split(":").toList();
|
|
||||||
|
|
||||||
this.accountID = idToken.claims["account_id"];
|
|
||||||
this.bizID = idToken.claims["biz_id"];
|
|
||||||
}
|
|
||||||
|
|
||||||
User(
|
|
||||||
{this.id,
|
|
||||||
this.name,
|
this.name,
|
||||||
this.gender,
|
|
||||||
this.phoneNumber,
|
this.phoneNumber,
|
||||||
this.fcsID,
|
this.fcsID,
|
||||||
this.shippingAddress,
|
});
|
||||||
this.deliveryAddress,
|
|
||||||
this.dateofBirth,
|
|
||||||
this.roleName,
|
|
||||||
this.roleID,
|
|
||||||
this.privilegeIds,
|
|
||||||
this.email,
|
|
||||||
this.disable,
|
|
||||||
this.status,
|
|
||||||
this.frontUrl,
|
|
||||||
this.backUrl,
|
|
||||||
this.selfieUrl,
|
|
||||||
this.registeredBuyer,
|
|
||||||
this.agreeTerms,
|
|
||||||
this.lastActiveTime,
|
|
||||||
this.device,
|
|
||||||
this.primaryDeviceID,
|
|
||||||
this.primaryDeviceName,
|
|
||||||
this.isBlock,
|
|
||||||
this.userLevel,
|
|
||||||
this.userLevelID,
|
|
||||||
this.pin});
|
|
||||||
|
|
||||||
factory User.fromJson(Map<String, dynamic> json) {
|
factory User.fromJson(Map<String, dynamic> json) {
|
||||||
return User(
|
return User(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
name: json['user_name'],
|
name: json['user_name'],
|
||||||
phoneNumber: json['phone_number'],
|
phoneNumber: json['phone_number'],
|
||||||
dateofBirth: json['dob'],
|
);
|
||||||
gender: json['gender'],
|
|
||||||
frontUrl: json['front_url'],
|
|
||||||
backUrl: json['back_url'],
|
|
||||||
selfieUrl: json['selfie_url'],
|
|
||||||
status: json['status'],
|
|
||||||
agreeTerms: json['agree_terms'],
|
|
||||||
disable: json['disable'],
|
|
||||||
registeredBuyer: json['registered_buyer'],
|
|
||||||
privilegeIds: json['privileges'],
|
|
||||||
email: json['email'],
|
|
||||||
isBlock: json['black_list'],
|
|
||||||
userLevel: json['user_level'],
|
|
||||||
userLevelID: json['user_level_id'],
|
|
||||||
pin: json['pin']);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory User.fromUserJson(Map<String, dynamic> json) {
|
|
||||||
DateTime parsedDate = DateTime.parse(json['last_active_time']);
|
|
||||||
|
|
||||||
return User(
|
|
||||||
id: json['id'],
|
|
||||||
name: json['user_name'],
|
|
||||||
phoneNumber: json['phone_number'],
|
|
||||||
dateofBirth: json['dob'],
|
|
||||||
roleName: json['role_name'],
|
|
||||||
roleID: json['role_id'],
|
|
||||||
disable: json['disable'],
|
|
||||||
gender: json['gender'],
|
|
||||||
status: json['status'],
|
|
||||||
lastActiveTime: parsedDate == null ? null : parsedDate,
|
|
||||||
device: json['last_active_device'],
|
|
||||||
email: json['email'],
|
|
||||||
primaryDeviceID: json['primary_device_id'],
|
|
||||||
primaryDeviceName: json['primary_device_name'],
|
|
||||||
userLevel: json['user_level'],
|
|
||||||
userLevelID: json['user_level_id'],
|
|
||||||
pin: json['pin']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'user_name': name,
|
'user_name': name,
|
||||||
'gender': gender,
|
|
||||||
'phone_number': phoneNumber,
|
'phone_number': phoneNumber,
|
||||||
'dob': dateofBirth,
|
|
||||||
'roleName': roleName,
|
|
||||||
'roleId': roleID,
|
|
||||||
'disable': disable,
|
|
||||||
'status': status,
|
|
||||||
'registered_buyer': registeredBuyer,
|
|
||||||
'agree_terms': agreeTerms,
|
|
||||||
'front_url': frontUrl,
|
|
||||||
'back_url': backUrl,
|
|
||||||
'selfie_url': selfieUrl,
|
|
||||||
'email': email,
|
|
||||||
'black_list': isBlock,
|
|
||||||
'user_level': userLevel,
|
|
||||||
'user_level_id': userLevelID,
|
|
||||||
'pin': pin,
|
|
||||||
'privileges': privilegeIds,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
'user_name': name,
|
'user_name': name,
|
||||||
'phone_number': phoneNumber,
|
'phone_number': phoneNumber,
|
||||||
'dob': dateofBirth,
|
|
||||||
'role_name': roleName,
|
|
||||||
'role_id': roleID,
|
|
||||||
'disable': disable,
|
|
||||||
'gender': gender,
|
|
||||||
'status': status,
|
|
||||||
'email': email,
|
|
||||||
'black_list': isBlock,
|
|
||||||
'user_level': userLevel,
|
|
||||||
'user_level_id': userLevelID,
|
|
||||||
'pin': pin
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
factory User.fromMap(Map<String, dynamic> map, String docID) {
|
factory User.fromMap(Map<String, dynamic> map, String docID) {
|
||||||
var activeTime = (map['last_active_time'] as Timestamp);
|
|
||||||
return User(
|
return User(
|
||||||
id: docID,
|
id: docID,
|
||||||
name: map['user_name'],
|
name: map['user_name'],
|
||||||
phoneNumber: map['phone_number'],
|
phoneNumber: map['phone_number'],
|
||||||
privilegeIds:
|
);
|
||||||
map['privileges'] == null ? [] : map['privileges'].cast<String>(),
|
|
||||||
dateofBirth: map['dob'],
|
|
||||||
roleName: map['role_name'],
|
|
||||||
roleID: map['role_id'],
|
|
||||||
disable: map['disable'],
|
|
||||||
gender: map['gender'],
|
|
||||||
status: map['status'],
|
|
||||||
registeredBuyer: map['registered_buyer'],
|
|
||||||
agreeTerms: map['agree_terms'] == null ? false : map['agree_terms'],
|
|
||||||
lastActiveTime: activeTime == null ? null : activeTime.toDate(),
|
|
||||||
device: map['last_active_device'],
|
|
||||||
email: map['email'],
|
|
||||||
primaryDeviceID: map['primary_device_id'],
|
|
||||||
primaryDeviceName: map['primary_device_name'],
|
|
||||||
isBlock: map['black_list'],
|
|
||||||
userLevel: map['user_level'],
|
|
||||||
userLevelID: map['user_level_id'],
|
|
||||||
pin: map['pin']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBlockUser() {
|
bool isCustomer() {
|
||||||
return this.isBlock == true;
|
return privileges == null || privileges.length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPrimaryDevice() {
|
bool hasSysAdmin() {
|
||||||
return this.primaryDeviceID != null && this.primaryDeviceID != '';
|
return privileges != null ? privileges.contains('sa') : false;
|
||||||
}
|
|
||||||
|
|
||||||
bool isRegisteredBuyer() {
|
|
||||||
return this.registeredBuyer != null && this.registeredBuyer;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSysAdmin() {
|
|
||||||
return claimPrivileges != null
|
|
||||||
? claimPrivileges.contains('sys_admin')
|
|
||||||
: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSysSupport() {
|
|
||||||
return claimPrivileges != null
|
|
||||||
? claimPrivileges.contains('sys_support')
|
|
||||||
: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBizAdmin() {
|
|
||||||
return claimPrivileges != null ? claimPrivileges.contains('ba') : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBuyer() {
|
|
||||||
return claimPrivileges == null || claimPrivileges.length == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEmail() {
|
|
||||||
return email != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasAccount() {
|
|
||||||
return isOwner() ||
|
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('a') : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasDelivery() {
|
|
||||||
return isOwner() ||
|
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('d') : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasBuyer() {
|
|
||||||
return isOwner() ||
|
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('b') : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isOwner() {
|
|
||||||
return claimPrivileges != null ? claimPrivileges.contains('o') : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isOwnerAndAbove() {
|
|
||||||
return isOwner() || isBizAdmin() || isSysAdmin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasAdmin() {
|
bool hasAdmin() {
|
||||||
return isOwner() ||
|
return privileges != null ? privileges.contains('admin') : false;
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('admin') : false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasDO() {
|
bool hasMaintenance() {
|
||||||
return isOwner() ||
|
return privileges != null ? privileges.contains('mt') : false;
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('do') : false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasPO() {
|
bool hasCustomers() {
|
||||||
return isOwner() ||
|
return privileges != null ? privileges.contains('c') : false;
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('po') : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasInventory() {
|
|
||||||
return isOwner() ||
|
|
||||||
(claimPrivileges != null ? claimPrivileges.contains('inv') : false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ const TextStyle labelStyleMM = TextStyle(
|
|||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontFamily: "MyanmarUnicode");
|
height: 1,
|
||||||
|
fontFamily: "Myanmar3");
|
||||||
const TextStyle subMenuStyle =
|
const TextStyle subMenuStyle =
|
||||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500);
|
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500);
|
||||||
const TextStyle subMenuStyleMM =
|
const TextStyle subMenuStyleMM =
|
||||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500,
|
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500,
|
||||||
fontFamily: "MyanmarUnicode");
|
fontFamily: "Myanmar3");
|
||||||
|
|
||||||
const TextStyle welcomeLabelStyle =
|
const TextStyle welcomeLabelStyle =
|
||||||
TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500);
|
TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500);
|
||||||
@@ -53,13 +54,13 @@ TextStyle newLabelStyleMM(
|
|||||||
color: color == null ? secondaryColor : color,
|
color: color == null ? secondaryColor : color,
|
||||||
fontWeight: fontWeight == null ? FontWeight.w500 : fontWeight,
|
fontWeight: fontWeight == null ? FontWeight.w500 : fontWeight,
|
||||||
decoration: underline ? TextDecoration.underline : TextDecoration.none,
|
decoration: underline ? TextDecoration.underline : TextDecoration.none,
|
||||||
fontFamily: "MyanmarUnicode");
|
fontFamily: "Myanmar3");
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextStyle photoLabelStyle =
|
const TextStyle photoLabelStyle =
|
||||||
TextStyle(color: Colors.black, fontSize: 13.0);
|
TextStyle(color: Colors.black, fontSize: 13.0);
|
||||||
const TextStyle photoLabelStyleMM = TextStyle(
|
const TextStyle photoLabelStyleMM = TextStyle(
|
||||||
color: Colors.black, fontSize: 13.0, fontFamily: "MyanmarUnicode");
|
color: Colors.black, fontSize: 13.0, fontFamily: "Myanmar3");
|
||||||
const TextStyle textStyle =
|
const TextStyle textStyle =
|
||||||
TextStyle(fontSize: 14, color: Colors.black87, fontWeight: FontWeight.w500);
|
TextStyle(fontSize: 14, color: Colors.black87, fontWeight: FontWeight.w500);
|
||||||
const TextStyle textStyleOdd = TextStyle(
|
const TextStyle textStyleOdd = TextStyle(
|
||||||
|
|||||||
@@ -75,11 +75,8 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: CupertinoPageScaffold(
|
child: Scaffold(
|
||||||
child: NestedScrollView(
|
body: CustomScrollView(slivers: [
|
||||||
headerSliverBuilder:
|
|
||||||
(BuildContext context, bool innerBoxIsScrolled) {
|
|
||||||
return <Widget>[
|
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -90,14 +87,13 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
expandedHeight: 150.0,
|
expandedHeight: 150.0,
|
||||||
floating: true,
|
floating: false,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
titlePadding: EdgeInsets.symmetric(vertical: 10),
|
titlePadding: EdgeInsets.symmetric(vertical: 10),
|
||||||
title: Text(
|
title:
|
||||||
AppTranslations.of(context)
|
Text(AppTranslations.of(context).text('contact.edit.title'),
|
||||||
.text('contact.edit.title'),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
)),
|
)),
|
||||||
@@ -111,15 +107,12 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
SliverList(
|
||||||
},
|
delegate: SliverChildListDelegate([
|
||||||
body: Material(
|
Padding(
|
||||||
child: Form(
|
padding: const EdgeInsets.only(left:18.0,right:18),
|
||||||
key: _formKey,
|
child: Column(
|
||||||
child: ListView(
|
children: [
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
|
||||||
children: <Widget>[
|
|
||||||
itemTitle(context, "contact.callus"),
|
itemTitle(context, "contact.callus"),
|
||||||
usaPhoneBox,
|
usaPhoneBox,
|
||||||
mmPhoneBox,
|
mmPhoneBox,
|
||||||
@@ -136,7 +129,10 @@ class _ContactEditorState extends State<ContactEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))));
|
]),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
_submit() async {
|
_submit() async {
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ class _ContactPageState extends State<ContactPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Setting setting = Provider.of<MainModel>(context).setting;
|
Setting setting = Provider.of<MainModel>(context).setting;
|
||||||
|
bool isEditable = context.select((MainModel m) => m.contactEditable());
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: NestedScrollView(
|
body: CustomScrollView(slivers: [
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
|
||||||
return <Widget>[
|
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -36,7 +36,7 @@ class _ContactPageState extends State<ContactPage> {
|
|||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
expandedHeight: 150.0,
|
expandedHeight: 150.0,
|
||||||
floating: true,
|
floating: false,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -46,7 +46,8 @@ class _ContactPageState extends State<ContactPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: isEditable
|
||||||
|
? [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
@@ -58,12 +59,11 @@ class _ContactPageState extends State<ContactPage> {
|
|||||||
CupertinoIcons.pen,
|
CupertinoIcons.pen,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
))
|
))
|
||||||
],
|
]
|
||||||
|
: [],
|
||||||
),
|
),
|
||||||
];
|
SliverList(
|
||||||
},
|
delegate: SliverChildListDelegate([
|
||||||
body: ListView(
|
|
||||||
children: <Widget>[
|
|
||||||
itemTitle(context, "contact.callus"),
|
itemTitle(context, "contact.callus"),
|
||||||
contactItem(context, setting.usaContactNumber, CupertinoIcons.phone,
|
contactItem(context, setting.usaContactNumber, CupertinoIcons.phone,
|
||||||
onTap: () => _call(setting.usaContactNumber),
|
onTap: () => _call(setting.usaContactNumber),
|
||||||
@@ -106,9 +106,8 @@ class _ContactPageState extends State<ContactPage> {
|
|||||||
onTap: () => _opencontactItem(setting.facebookLink),
|
onTap: () => _opencontactItem(setting.facebookLink),
|
||||||
labelKey: "contact.facebook",
|
labelKey: "contact.facebook",
|
||||||
),
|
),
|
||||||
],
|
]))
|
||||||
),
|
]),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
363
lib/fcs/common/pages/customers/customer_editor.dart
Normal file
363
lib/fcs/common/pages/customers/customer_editor.dart
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
import 'package:fcs/fcs/common/domain/entities/customer.dart';
|
||||||
|
import 'package:fcs/fcs/common/domain/entities/role.dart';
|
||||||
|
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
||||||
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/util.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
|
|
||||||
|
typedef void FindCallBack();
|
||||||
|
|
||||||
|
class CustomerEditor extends StatefulWidget {
|
||||||
|
final Customer customer;
|
||||||
|
const CustomerEditor({this.customer});
|
||||||
|
@override
|
||||||
|
_CustomerEditorState createState() => _CustomerEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomerEditorState extends State<CustomerEditor> {
|
||||||
|
TextEditingController _name = new TextEditingController();
|
||||||
|
TextEditingController _phone = new TextEditingController();
|
||||||
|
TextEditingController _phoneInput = new TextEditingController();
|
||||||
|
TextEditingController _status = new TextEditingController();
|
||||||
|
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
bool _isLoading = false;
|
||||||
|
String currentBizId;
|
||||||
|
bool isSend = false;
|
||||||
|
User user;
|
||||||
|
User selectedUser;
|
||||||
|
List<Privilege> privileges = [
|
||||||
|
Privilege(name: 'Manage shipment'),
|
||||||
|
Privilege(name: 'Manage pickups'),
|
||||||
|
Privilege(name: 'Manage packages'),
|
||||||
|
Privilege(name: 'Manage deliveries'),
|
||||||
|
Privilege(name: 'Admin')
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
// privileges = Provider.of<UserModel>(context, listen: false).privileges;
|
||||||
|
if (widget.customer != null) {
|
||||||
|
_name.text = widget.customer.name;
|
||||||
|
_phone.text = widget.customer.phoneNumber;
|
||||||
|
_status.text = widget.customer.status;
|
||||||
|
// privileges.forEach((p) => widget.employee.privilegeIds.contains(p.id)
|
||||||
|
// ? p.isChecked = true
|
||||||
|
// : p.isChecked = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> showprivilegeList(BuildContext context) {
|
||||||
|
return privileges.map((p) {
|
||||||
|
return new ListTile(
|
||||||
|
title: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Checkbox(
|
||||||
|
value: p.isChecked == null ? false : p.isChecked,
|
||||||
|
activeColor: primaryColor,
|
||||||
|
onChanged: (bool value) {
|
||||||
|
setState(() {
|
||||||
|
p.isChecked = value;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
p.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Container(
|
||||||
|
// width: MediaQuery.of(context).size.width * 0.5,
|
||||||
|
// child: new Text(
|
||||||
|
// userModel.getPrivileges[index].desc,
|
||||||
|
// style:
|
||||||
|
// TextStyle(fontSize: 12.0, color: Colors.grey[600]),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget phoneInputbox(BuildContext context, FindCallBack findCallBack) {
|
||||||
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(top: 10),
|
||||||
|
child: Stack(
|
||||||
|
alignment: const Alignment(1.2, 1.0),
|
||||||
|
children: <Widget>[
|
||||||
|
TextFormField(
|
||||||
|
controller: _phoneInput,
|
||||||
|
autofocus: false,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
style: textStyle,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: AppTranslations.of(context).text('employee.phone'),
|
||||||
|
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new FlatButton(
|
||||||
|
onPressed: () {
|
||||||
|
this.isSend = true;
|
||||||
|
findCallBack();
|
||||||
|
},
|
||||||
|
child: new Icon(
|
||||||
|
Icons.search,
|
||||||
|
size: 25,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final namebox = TextFormField(
|
||||||
|
controller: _name,
|
||||||
|
autofocus: false,
|
||||||
|
readOnly: true,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.person,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final displayPhoneNo = TextFormField(
|
||||||
|
controller: _phone,
|
||||||
|
autofocus: false,
|
||||||
|
readOnly: true,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
var phoneNumberBox = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(child: displayPhoneNo),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => call(context, _phone.text),
|
||||||
|
child: Icon(
|
||||||
|
Icons.open_in_new,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
final statusbox = TextFormField(
|
||||||
|
controller: _status,
|
||||||
|
autofocus: false,
|
||||||
|
readOnly: true,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.av_timer,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final updateButton = Container(
|
||||||
|
padding: EdgeInsets.only(top: 40),
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: primaryColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
),
|
||||||
|
child: ButtonTheme(
|
||||||
|
minWidth: 900.0,
|
||||||
|
height: 100.0,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.update',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final addButton = Container(
|
||||||
|
padding: EdgeInsets.only(top: 40),
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: primaryColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
),
|
||||||
|
child: ButtonTheme(
|
||||||
|
minWidth: 900.0,
|
||||||
|
height: 100.0,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.add',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
"customer.form.title",
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
// actions: <Widget>[
|
||||||
|
// widget.customer == null || !mainModel.showHistoryBtn()
|
||||||
|
// ? Container()
|
||||||
|
// : IconButton(
|
||||||
|
// icon: Icon(Icons.history),
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (context) => DocumentLogPage(
|
||||||
|
// docID: widget.customer.docID)),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||||
|
children: <Widget>[
|
||||||
|
widget.customer == null
|
||||||
|
? phoneInputbox(context, () => _findUser(context))
|
||||||
|
: phoneNumberBox,
|
||||||
|
widget.customer == null
|
||||||
|
? this.isSend ? namebox : Container()
|
||||||
|
: namebox,
|
||||||
|
statusbox,
|
||||||
|
// widget.customer == null ? addButton : updateButton,
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
_add(BuildContext context) async {
|
||||||
|
if (selectedUser == null) return;
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
// var employeeModel = Provider.of<EmployeeModel>(context);
|
||||||
|
// try {
|
||||||
|
// await employeeModel.updatePrivileges(
|
||||||
|
// this.selectedUser.docID, privilegesIDs());
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// } catch (e) {
|
||||||
|
// showMsgDialog(context, "Error", e.toString());
|
||||||
|
// } finally {
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> privilegesIDs() {
|
||||||
|
return this.privileges.where((p) => p.isChecked).map((p) => p.id).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
_save() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
if (widget.customer == null) return;
|
||||||
|
// var employeeModel = Provider.of<EmployeeModel>(context);
|
||||||
|
// try {
|
||||||
|
// await employeeModel.updatePrivileges(
|
||||||
|
// widget.customer.docID, privilegesIDs());
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// } catch (e) {
|
||||||
|
// showMsgDialog(context, "Error", e.toString());
|
||||||
|
// } finally {
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
_findUser(BuildContext context) async {
|
||||||
|
// var userModel = Provider.of<UserModel>(context);
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = true;
|
||||||
|
// });
|
||||||
|
// try {
|
||||||
|
// selectedUser = await userModel.findUser(_phoneInput.text);
|
||||||
|
// setState(() {
|
||||||
|
// isSend = true;
|
||||||
|
// _name.text = selectedUser.name;
|
||||||
|
// if (selectedUser.privilegeIds != null) {
|
||||||
|
// privileges.forEach((p) => selectedUser.privilegeIds.contains(p.id)
|
||||||
|
// ? p.isChecked = true
|
||||||
|
// : p.isChecked = false);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } catch (e) {
|
||||||
|
// showMsgDialog(context, "Error", e.toString());
|
||||||
|
// } finally {
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
142
lib/fcs/common/pages/customers/customer_list.dart
Normal file
142
lib/fcs/common/pages/customers/customer_list.dart
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
import 'package:fcs/fcs/common/domain/entities/customer.dart';
|
||||||
|
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
||||||
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/customers/invitation_page.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/util.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
|
||||||
|
import 'customer_editor.dart';
|
||||||
|
|
||||||
|
class CustomerList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_CustomerListState createState() => _CustomerListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomerListState extends State<CustomerList> {
|
||||||
|
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var customerModel = Provider.of<CustomerModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
iconSize: 30,
|
||||||
|
onPressed: () => {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.list.title',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(BottomUpPageRoute(InvitationPage()));
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(AppTranslations.of(context).text("customer.invite")),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
body: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: customerModel.customers.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
Customer customer = customerModel.customers[index];
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
BottomUpPageRoute(CustomerEditor(customer: customer)));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
child: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Padding(
|
||||||
|
padding: new EdgeInsets.symmetric(
|
||||||
|
horizontal: 32.0 - dotSize / 2),
|
||||||
|
child: Icon(
|
||||||
|
Feather.user,
|
||||||
|
color: primaryColor,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new Expanded(
|
||||||
|
child: new Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
customer.name,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: primaryColor),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
customer.phoneNumber,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10),
|
||||||
|
child: getStatus(customer.status),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
67
lib/fcs/common/pages/customers/invitation_page.dart
Normal file
67
lib/fcs/common/pages/customers/invitation_page.dart
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/util.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
|
class InvitationPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_InvitationPageState createState() => _InvitationPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvitationPageState extends State<InvitationPage> {
|
||||||
|
TextEditingController _nameController = new TextEditingController();
|
||||||
|
TextEditingController _phoneController = new TextEditingController();
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(
|
||||||
|
Icons.close,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: Text(AppTranslations.of(context).text("customer.form.title")),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
padding: EdgeInsets.all(18),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
fcsInput("Name", Icons.person, controller: _nameController),
|
||||||
|
fcsInput("Phone Number", Icons.phone,
|
||||||
|
controller: _phoneController),
|
||||||
|
SizedBox(height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
fcsButton(context, "Invite", callack: () {}),
|
||||||
|
SizedBox(height: 10)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
lib/fcs/common/pages/customers/model/customer_model.dart
Normal file
66
lib/fcs/common/pages/customers/model/customer_model.dart
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import 'package:fcs/fcs/common/domain/entities/customer.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class CustomerModel extends BaseModel {
|
||||||
|
final log = Logger('CustomerModel');
|
||||||
|
|
||||||
|
List<Customer> customers = [
|
||||||
|
Customer(
|
||||||
|
name: 'Ko Nyi',
|
||||||
|
phoneNumber: '+95 9 717273634',
|
||||||
|
status: 'Invited'
|
||||||
|
),
|
||||||
|
Customer(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844',status: 'Signin'),
|
||||||
|
Customer(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: 'Invited'),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void initUser(user) async {
|
||||||
|
super.initUser(user);
|
||||||
|
// _loadCustomer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
logout() async {
|
||||||
|
customers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<void> _loadCustomer() async {
|
||||||
|
// if (!user.isOwnerAndAbove() && !user.hasAccount()) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// Firestore.instance
|
||||||
|
// .collection("/$biz_collection/${setting.okEnergyId}/$user_collection")
|
||||||
|
// .where("is_employee", isEqualTo: true)
|
||||||
|
// .snapshots()
|
||||||
|
// .listen((QuerySnapshot snapshot) {
|
||||||
|
// customers.clear();
|
||||||
|
// customers = snapshot.documents.map((documentSnapshot) {
|
||||||
|
// var user =
|
||||||
|
// User.fromMap(documentSnapshot.data, documentSnapshot.documentID);
|
||||||
|
// return user;
|
||||||
|
// }).toList();
|
||||||
|
// notifyListeners();
|
||||||
|
// }).onError((e) {
|
||||||
|
// log.warning("Error! $e");
|
||||||
|
// });
|
||||||
|
// } catch (e) {
|
||||||
|
// log.warning("Error!! $e");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> updatePrivileges(String userID, List<String> privileges) async {
|
||||||
|
// try {
|
||||||
|
// await request("/employee/privileges", "PUT",
|
||||||
|
// payload: {"id": userID, "privileges": privileges},
|
||||||
|
// token: await getToken());
|
||||||
|
// } catch (e) {
|
||||||
|
// throw Exception(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,84 +1,95 @@
|
|||||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
|
||||||
import 'package:fcs/fcs/common/domain/vo/contact.dart';
|
|
||||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
import 'package:fcs/fcs/common/pages/faq/faq_edit_page.dart';
|
||||||
import 'package:fcs/fcs/common/pages/contact/contact_editor.dart';
|
import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/util.dart';
|
||||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class FAQDetailPage extends StatelessWidget {
|
class FAQDetailPage extends StatefulWidget {
|
||||||
final FAQ faq;
|
final FAQ faq;
|
||||||
|
const FAQDetailPage({this.faq});
|
||||||
|
@override
|
||||||
|
_FAQDetailPageState createState() => _FAQDetailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
const FAQDetailPage({Key key, this.faq}) : super(key: key);
|
class _FAQDetailPageState extends State<FAQDetailPage> {
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Setting setting = Provider.of<MainModel>(context).setting;
|
bool isEditable = context.select((MainModel m) => m.faqEditable());
|
||||||
return Scaffold(
|
return LocalProgress(
|
||||||
body: NestedScrollView(
|
inAsyncCall: _isLoading,
|
||||||
headerSliverBuilder:
|
child: Scaffold(
|
||||||
(BuildContext context, bool innerBoxIsScrolled) {
|
body: CustomScrollView(slivers: [
|
||||||
return <Widget>[
|
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
CupertinoIcons.back,
|
CupertinoIcons.back,
|
||||||
size: 30,
|
color: primaryColor,
|
||||||
|
size: 50,
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: Colors.white,
|
||||||
expandedHeight: 150.0,
|
expandedHeight: 100.0,
|
||||||
floating: true,
|
floating: false,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
titlePadding: EdgeInsets.symmetric(vertical: 10),
|
titlePadding: EdgeInsets.symmetric(vertical: 10),
|
||||||
title: Text(AppTranslations.of(context).text('faq.btn'),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
actions: [
|
actions: isEditable
|
||||||
|
? [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () {
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
showConfirmDialog(context, "faq.edit.delete.confirm",
|
||||||
builder: (context) => ContactEditor(
|
() {
|
||||||
contact: Contact.fromSetting(setting),
|
_delete();
|
||||||
),
|
});
|
||||||
)),
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
CupertinoIcons.delete,
|
CupertinoIcons.delete,
|
||||||
color: Colors.white,
|
color: primaryColor,
|
||||||
|
size: 30,
|
||||||
)),
|
)),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
builder: (context) => ContactEditor(
|
builder: (context) => FAQEditor(faq: widget.faq),
|
||||||
contact: Contact.fromSetting(setting),
|
|
||||||
),
|
|
||||||
)),
|
)),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
CupertinoIcons.pen,
|
CupertinoIcons.pen,
|
||||||
color: Colors.white,
|
color: primaryColor,
|
||||||
))
|
))
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
),
|
||||||
|
SliverList(
|
||||||
|
delegate: SliverChildListDelegate([
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(28.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
getQuestion(context, widget.faq),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
getAnwser(context, widget.faq)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
|
||||||
},
|
|
||||||
body: Padding(
|
|
||||||
padding: const EdgeInsets.only(left:20.0,right:20),
|
|
||||||
child: ListView(
|
|
||||||
children: [getQuestion(context, faq),
|
|
||||||
SizedBox(height: 30,),
|
|
||||||
getAnwser(context, faq)],
|
|
||||||
),
|
),
|
||||||
)));
|
]))
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getQuestion(BuildContext context, FAQ faq) {
|
Widget getQuestion(BuildContext context, FAQ faq) {
|
||||||
@@ -91,7 +102,6 @@ class FAQDetailPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget getAnwser(BuildContext context, FAQ faq) {
|
Widget getAnwser(BuildContext context, FAQ faq) {
|
||||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||||
return TextLocalStyle(
|
return TextLocalStyle(
|
||||||
@@ -102,4 +112,20 @@ class FAQDetailPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_delete() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
FAQModel faqModel = Provider.of<FAQModel>(context, listen: false);
|
||||||
|
await faqModel.deleteFAQ(widget.faq);
|
||||||
|
Navigator.pop(context);
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/faq/widgets.dart';
|
import 'package:fcs/fcs/common/pages/faq/widgets.dart';
|
||||||
import 'package:fcs/fcs/common/pages/util.dart';
|
import 'package:fcs/fcs/common/pages/util.dart';
|
||||||
import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
|
import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
|
||||||
@@ -8,6 +9,7 @@ import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class FAQEditor extends StatefulWidget {
|
class FAQEditor extends StatefulWidget {
|
||||||
final FAQ faq;
|
final FAQ faq;
|
||||||
@@ -17,6 +19,7 @@ class FAQEditor extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FAQEditorState extends State<FAQEditor> {
|
class _FAQEditorState extends State<FAQEditor> {
|
||||||
|
TextEditingController _sn = new TextEditingController();
|
||||||
TextEditingController _engQ = new TextEditingController();
|
TextEditingController _engQ = new TextEditingController();
|
||||||
TextEditingController _mmQ = new TextEditingController();
|
TextEditingController _mmQ = new TextEditingController();
|
||||||
TextEditingController _engA = new TextEditingController();
|
TextEditingController _engA = new TextEditingController();
|
||||||
@@ -25,12 +28,12 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_isNew = widget.faq == null;
|
_isNew = widget.faq == null;
|
||||||
if (widget.faq != null) {
|
if (widget.faq != null) {
|
||||||
|
_sn.text = widget.faq.sn.toString();
|
||||||
_engQ.text = widget.faq.questionEng;
|
_engQ.text = widget.faq.questionEng;
|
||||||
_mmQ.text = widget.faq.questionMm;
|
_mmQ.text = widget.faq.questionMm;
|
||||||
_engA.text = widget.faq.answerEng;
|
_engA.text = widget.faq.answerEng;
|
||||||
@@ -40,22 +43,29 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final usaPhoneBox = InputText(
|
final snBox = InputText(
|
||||||
|
controller: _sn,
|
||||||
|
maxLines: 1,
|
||||||
|
withBorder: true,
|
||||||
|
textInputType: TextInputType.number,
|
||||||
|
);
|
||||||
|
|
||||||
|
final questionEngBox = InputText(
|
||||||
controller: _engQ,
|
controller: _engQ,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
withBorder: true,
|
withBorder: true,
|
||||||
);
|
);
|
||||||
final mmPhoneBox = InputText(
|
final answerEngBox = InputText(
|
||||||
controller: _mmQ,
|
controller: _engA,
|
||||||
maxLines: 5,
|
maxLines: 5,
|
||||||
withBorder: true,
|
withBorder: true,
|
||||||
);
|
);
|
||||||
final usaAddreesBox = InputText(
|
final questionMmBox = InputText(
|
||||||
controller: _engA,
|
controller: _mmQ,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
withBorder: true,
|
withBorder: true,
|
||||||
);
|
);
|
||||||
final mmAddressBox = InputText(
|
final answerMmBox = InputText(
|
||||||
controller: _mmA,
|
controller: _mmA,
|
||||||
maxLines: 5,
|
maxLines: 5,
|
||||||
withBorder: true,
|
withBorder: true,
|
||||||
@@ -63,11 +73,8 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: CupertinoPageScaffold(
|
child: Scaffold(
|
||||||
child: NestedScrollView(
|
body: CustomScrollView(slivers: [
|
||||||
headerSliverBuilder:
|
|
||||||
(BuildContext context, bool innerBoxIsScrolled) {
|
|
||||||
return <Widget>[
|
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -92,47 +99,75 @@ class _FAQEditorState extends State<FAQEditor> {
|
|||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => _submit(),
|
onPressed: () => _save(),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.save,
|
Icons.save,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
SliverList(
|
||||||
},
|
delegate: SliverChildListDelegate([
|
||||||
body: Material(
|
Form(
|
||||||
child: Form(
|
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: Padding(
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||||
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 18.0, left: 0),
|
||||||
|
child: subItemTitle(context, "faq.edit.sn"),
|
||||||
|
),
|
||||||
|
Expanded(child: snBox),
|
||||||
|
],
|
||||||
|
),
|
||||||
Center(child: itemTitle(context, "faq.edit.eng")),
|
Center(child: itemTitle(context, "faq.edit.eng")),
|
||||||
subItemTitle(context, "faq.edit.question",iconData: SimpleLineIcons.question),
|
subItemTitle(context, "faq.edit.question",
|
||||||
usaPhoneBox,
|
iconData: SimpleLineIcons.question),
|
||||||
subItemTitle(context, "faq.edit.answer",iconData: MaterialCommunityIcons.message_reply_text),
|
questionEngBox,
|
||||||
mmPhoneBox,
|
subItemTitle(context, "faq.edit.answer",
|
||||||
|
iconData: MaterialCommunityIcons.message_reply_text),
|
||||||
|
answerEngBox,
|
||||||
Divider(),
|
Divider(),
|
||||||
Center(child: itemTitle(context, "faq.edit.mm")),
|
Center(child: itemTitle(context, "faq.edit.mm")),
|
||||||
subItemTitle(context, "faq.edit.question",iconData: SimpleLineIcons.question),
|
subItemTitle(context, "faq.edit.question",
|
||||||
usaAddreesBox,
|
iconData: SimpleLineIcons.question),
|
||||||
subItemTitle(context, "faq.edit.answer",iconData: MaterialCommunityIcons.message_reply_text),
|
questionMmBox,
|
||||||
mmAddressBox,
|
subItemTitle(context, "faq.edit.answer",
|
||||||
|
iconData: MaterialCommunityIcons.message_reply_text),
|
||||||
|
answerMmBox,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))));
|
),
|
||||||
|
]))
|
||||||
|
])));
|
||||||
}
|
}
|
||||||
|
|
||||||
_submit() async {
|
_save() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
widget.faq.questionEng = _engQ.text;
|
int sn = int.parse(
|
||||||
// var contactModel = Provider.of<ContactModel>(context, listen: false);
|
_sn.text,
|
||||||
// await contactModel.saveContact(widget.contact);
|
onError: (source) => throw Exception("Invalid number"),
|
||||||
|
);
|
||||||
|
FAQModel faqModel = Provider.of<FAQModel>(context, listen: false);
|
||||||
|
FAQ _faq = FAQ(
|
||||||
|
sn: sn,
|
||||||
|
questionEng: _engQ.text,
|
||||||
|
answerEng: _engA.text,
|
||||||
|
questionMm: _mmQ.text,
|
||||||
|
answerMm: _mmA.text);
|
||||||
|
if (_isNew) {
|
||||||
|
await faqModel.addFAQ(_faq);
|
||||||
|
} else {
|
||||||
|
_faq.id = widget.faq.id;
|
||||||
|
await faqModel.updateFAQ(_faq);
|
||||||
|
}
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
|
||||||
import 'package:fcs/fcs/common/domain/vo/contact.dart';
|
|
||||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||||
import 'package:fcs/fcs/common/pages/contact/contact_editor.dart';
|
|
||||||
import 'package:fcs/fcs/common/pages/contact/widgets.dart';
|
|
||||||
import 'package:fcs/fcs/common/pages/faq/faq_detail_page.dart';
|
import 'package:fcs/fcs/common/pages/faq/faq_detail_page.dart';
|
||||||
import 'package:fcs/fcs/common/pages/faq/faq_edit_page.dart';
|
import 'package:fcs/fcs/common/pages/faq/faq_edit_page.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/widget/local_text.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
import 'package:package_info/package_info.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
import 'model/faq_model.dart';
|
||||||
|
|
||||||
class FAQPage extends StatefulWidget {
|
class FAQPage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@@ -24,21 +18,16 @@ class FAQPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FAQPageState extends State<FAQPage> {
|
class _FAQPageState extends State<FAQPage> {
|
||||||
List<FAQ> faqs = [];
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
faqs = [
|
|
||||||
FAQ(questionEng: "Question 1?", answerEng: "Answer 1."),
|
|
||||||
FAQ(questionEng: "Question 2?", answerEng: "Answer 2."),
|
|
||||||
FAQ(questionEng: "Question 3?", answerEng: "Answer 3."),
|
|
||||||
FAQ(questionEng: "Question 4?", answerEng: "Answer 4."),
|
|
||||||
FAQ(questionEng: "Question 5?", answerEng: "Answer 5.")
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
FAQModel faqModel = Provider.of<FAQModel>(context);
|
||||||
|
bool isEditable = context.select((MainModel m) => m.faqEditable());
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
@@ -62,7 +51,7 @@ class _FAQPageState extends State<FAQPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
actions: [
|
actions:isEditable? [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
@@ -73,83 +62,18 @@ class _FAQPageState extends State<FAQPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 35,
|
size: 35,
|
||||||
))
|
))
|
||||||
],
|
]:[],
|
||||||
),
|
),
|
||||||
SliverList(
|
SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) => _faqItem(context, faqs[index]),
|
(context, index) => _faqItem(context, faqModel.faqs[index]),
|
||||||
childCount: faqs.length,
|
childCount: faqModel.faqs.length,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// SliverFillRemaining(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.only(left: 18.0, right: 18),
|
|
||||||
// child: ListView.separated (
|
|
||||||
// separatorBuilder: (_, i) => Divider(),
|
|
||||||
// itemCount: faqs.length,
|
|
||||||
// itemBuilder: (BuildContext ctxt, int index) {
|
|
||||||
// return _faqItem(context, faqs[index]);
|
|
||||||
// }),
|
|
||||||
// )),
|
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build1(BuildContext context) {
|
|
||||||
Setting setting = Provider.of<MainModel>(context).setting;
|
|
||||||
return Scaffold(
|
|
||||||
body: NestedScrollView(
|
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
|
||||||
return <Widget>[
|
|
||||||
SliverAppBar(
|
|
||||||
leading: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
CupertinoIcons.back,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
),
|
|
||||||
backgroundColor: primaryColor,
|
|
||||||
expandedHeight: 150.0,
|
|
||||||
floating: true,
|
|
||||||
pinned: true,
|
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
|
||||||
centerTitle: true,
|
|
||||||
titlePadding: EdgeInsets.symmetric(vertical: 10),
|
|
||||||
title: Text(AppTranslations.of(context).text('faq.title'),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () =>
|
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
|
||||||
builder: (context) => FAQEditor(),
|
|
||||||
)),
|
|
||||||
icon: Icon(
|
|
||||||
CupertinoIcons.add,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 35,
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
body: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 18.0, right: 18),
|
|
||||||
child: ListView.separated(
|
|
||||||
separatorBuilder: (_, i) => Divider(),
|
|
||||||
itemCount: faqs.length,
|
|
||||||
itemBuilder: (BuildContext ctxt, int index) {
|
|
||||||
return _faqItem(context, faqs[index]);
|
|
||||||
}),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _faqItem(BuildContext context, FAQ faq) {
|
Widget _faqItem(BuildContext context, FAQ faq) {
|
||||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||||
return Column(
|
return Column(
|
||||||
@@ -167,16 +91,21 @@ class _FAQPageState extends State<FAQPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TextLocalStyle(
|
Flexible(
|
||||||
|
child: TextLocalStyle(
|
||||||
context,
|
context,
|
||||||
faq.question(isEng),
|
faq.question(isEng),
|
||||||
fontSize: 16,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
Spacer(),
|
),
|
||||||
Icon(
|
// Spacer(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left:18.0),
|
||||||
|
child: Icon(
|
||||||
CupertinoIcons.right_chevron,
|
CupertinoIcons.right_chevron,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
size: 22,
|
size: 22,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||||
import 'package:fcs/fcs/common/services/services.dart';
|
import 'package:fcs/fcs/common/services/services.dart';
|
||||||
@@ -8,10 +9,45 @@ import 'package:logging/logging.dart';
|
|||||||
class FAQModel extends BaseModel {
|
class FAQModel extends BaseModel {
|
||||||
final log = Logger('FAQModel');
|
final log = Logger('FAQModel');
|
||||||
|
|
||||||
|
List<FAQ> faqs = [];
|
||||||
|
|
||||||
|
StreamSubscription<QuerySnapshot> listener;
|
||||||
|
|
||||||
|
FAQModel() {
|
||||||
|
Stream<QuerySnapshot> query = Firestore.instance
|
||||||
|
.collection("/faqs")
|
||||||
|
.orderBy("sn", descending: false)
|
||||||
|
.snapshots();
|
||||||
|
if (listener != null) {
|
||||||
|
listener.cancel();
|
||||||
|
}
|
||||||
|
listener = query.listen((snaps) {
|
||||||
|
faqs.clear();
|
||||||
|
snaps.documents.forEach((d) {
|
||||||
|
faqs.add(FAQ.fromMap(d.data, d.documentID));
|
||||||
|
});
|
||||||
|
notifyListeners();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> addFAQ(FAQ faq) async {
|
Future<void> addFAQ(FAQ faq) async {
|
||||||
await request("/faq", "POST",
|
await request("/faqs", "POST",
|
||||||
payload: faq.toMap(), token: await Services.instance.authService.getToken());
|
payload: faq.toMap(),
|
||||||
|
token: await Services.instance.authService.getToken());
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateFAQ(FAQ faq) async {
|
||||||
|
await request("/faqs", "PUT",
|
||||||
|
payload: faq.toMap(),
|
||||||
|
token: await Services.instance.authService.getToken());
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteFAQ(FAQ faq) async {
|
||||||
|
await request("/faqs", "DELETE",
|
||||||
|
payload: faq.toMap(),
|
||||||
|
token: await Services.instance.authService.getToken());
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:fcs/fcs/common/localization/transalation.dart';
|
import 'package:fcs/fcs/common/localization/transalation.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/customers/customer_list.dart';
|
||||||
import 'package:fcs/fcs/common/pages/faq/faq_page.dart';
|
import 'package:fcs/fcs/common/pages/faq/faq_page.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||||
@@ -25,7 +26,6 @@ import 'package:logging/logging.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../../../pages/buying_online.dart';
|
import '../../../pages/buying_online.dart';
|
||||||
import '../../../pages/customer_list.dart';
|
|
||||||
import '../../../pages/fcs_profile_page.dart';
|
import '../../../pages/fcs_profile_page.dart';
|
||||||
import '../../../pages/invoice/invoce_list.dart';
|
import '../../../pages/invoice/invoce_list.dart';
|
||||||
import '../../../pages/pickup_list.dart';
|
import '../../../pages/pickup_list.dart';
|
||||||
@@ -71,7 +71,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
login = Provider.of<MainModel>(context).isLogin();
|
login = Provider.of<MainModel>(context).isLogin();
|
||||||
var owner = Provider.of<MainModel>(context).isOwner();
|
// var owner =true;// Provider.of<MainModel>(context).isOwner();
|
||||||
var customer = Provider.of<MainModel>(context).isCustomer();
|
var customer = Provider.of<MainModel>(context).isCustomer();
|
||||||
LanguageModel languageModel = Provider.of<LanguageModel>(context);
|
LanguageModel languageModel = Provider.of<LanguageModel>(context);
|
||||||
|
|
||||||
@@ -169,20 +169,20 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
List<Widget> widgets = [];
|
List<Widget> widgets = [];
|
||||||
widgets.add(faqBtn);
|
widgets.add(faqBtn);
|
||||||
customer ? widgets.add(buyingBtn) : "";
|
// customer ? widgets.add(buyingBtn) : "";
|
||||||
customer || owner ? widgets.add(pickUpBtn) : "";
|
// customer || owner ? widgets.add(pickUpBtn) : "";
|
||||||
owner ? widgets.add(shipmentBtn) : "";
|
!customer ? widgets.add(shipmentBtn) : "";
|
||||||
customer || owner ? widgets.add(notiBtn) : "";
|
// customer || owner ? widgets.add(notiBtn) : "";
|
||||||
owner ? widgets.add(staffBtn) : "";
|
// owner ? widgets.add(staffBtn) : "";
|
||||||
owner ? widgets.add(fcsProfileBtn) : "";
|
// owner ? widgets.add(fcsProfileBtn) : "";
|
||||||
widgets.add(shipmentCostBtn);
|
// widgets.add(shipmentCostBtn);
|
||||||
customer || owner ? widgets.add(packagesBtn) : "";
|
// customer || owner ? widgets.add(packagesBtn) : "";
|
||||||
owner ? widgets.add(boxesBtn) : "";
|
// owner ? widgets.add(boxesBtn) : "";
|
||||||
owner ? widgets.add(deliveryBtn) : "";
|
// owner ? widgets.add(deliveryBtn) : "";
|
||||||
owner ? widgets.add(customersBtn) : "";
|
widgets.add(customersBtn) ;
|
||||||
customer || owner ? widgets.add(invoicesBtn) : "";
|
// customer || owner ? widgets.add(invoicesBtn) : "";
|
||||||
owner ? widgets.add(paymentMethodBtn) : "";
|
// owner ? widgets.add(paymentMethodBtn) : "";
|
||||||
owner ? widgets.add(discountBtn) : "";
|
// owner ? widgets.add(discountBtn) : "";
|
||||||
// widgets.add(termBtn);
|
// widgets.add(termBtn);
|
||||||
|
|
||||||
return OfflineRedirect(
|
return OfflineRedirect(
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:fcs/fcs/common/domain/entities/auth_status.dart';
|
|||||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
||||||
import 'package:fcs/fcs/common/helpers/network_connectivity.dart';
|
import 'package:fcs/fcs/common/helpers/network_connectivity.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||||
import 'package:fcs/fcs/common/services/services.dart';
|
import 'package:fcs/fcs/common/services/services.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
@@ -16,6 +17,7 @@ import 'package:package_info/package_info.dart';
|
|||||||
|
|
||||||
class MainModel extends ChangeNotifier {
|
class MainModel extends ChangeNotifier {
|
||||||
final log = Logger('MainModel');
|
final log = Logger('MainModel');
|
||||||
|
List<BaseModel> models = [];
|
||||||
|
|
||||||
User user;
|
User user;
|
||||||
PackageInfo packageInfo;
|
PackageInfo packageInfo;
|
||||||
@@ -37,67 +39,50 @@ class MainModel extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
Services.instance.authService.onAuthStatus().listen((event) {
|
Services.instance.authService.onAuthStatus().listen((event) {
|
||||||
|
this.user=event;
|
||||||
|
notifyListeners();
|
||||||
print("main event-->$event");
|
print("main event-->$event");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool faqEditable(){
|
||||||
|
return this.user != null && false;
|
||||||
|
}
|
||||||
|
bool termEditable(){
|
||||||
|
return this.user != null && false;
|
||||||
|
}
|
||||||
|
bool contactEditable(){
|
||||||
|
return this.user != null && false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool isLogin() {
|
bool isLogin() {
|
||||||
return this.user != null;
|
return this.user != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCustomer() {
|
bool isCustomer() {
|
||||||
return user != null && user.name != "Owner";
|
return user != null && user.isCustomer();
|
||||||
}
|
|
||||||
|
|
||||||
bool isOwner() {
|
|
||||||
return user != null && user.name == "Owner";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasEmail() {
|
|
||||||
return this.user != null && this.user.isEmail();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool agreedTerm() {
|
|
||||||
return this.user != null && this.user.agreeTerms;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBuyer() {
|
|
||||||
return this.user == null || this.user.isBuyer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSysAdmin() {
|
bool isSysAdmin() {
|
||||||
return this.user != null && this.user.isSysAdmin();
|
return this.user != null && this.user.hasSysAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSysSupport() {
|
|
||||||
return this.user != null && this.user.isSysSupport();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBizAdmin() {
|
|
||||||
return this.user != null && this.user.isBizAdmin();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isOwnerAndAbove() {
|
|
||||||
return this.user != null && this.user.isOwnerAndAbove();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAdmin() {
|
bool isAdmin() {
|
||||||
return this.user != null && this.user.hasAdmin();
|
return this.user != null && this.user.hasAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool showHistoryBtn() {
|
|
||||||
return isSysAdmin() || isSysSupport() || isBizAdmin();
|
|
||||||
}
|
|
||||||
|
|
||||||
init() async {
|
init() async {
|
||||||
await _loadSetting();
|
await _loadSetting();
|
||||||
_loadUser();
|
_loadUser();
|
||||||
this.packageInfo = await PackageInfo.fromPlatform();
|
this.packageInfo = await PackageInfo.fromPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void addModel(BaseModel model) {
|
void addModel(BaseModel model) {
|
||||||
// models.add(model);
|
models.add(model);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void _initUser(User user) {
|
// void _initUser(User user) {
|
||||||
// models.forEach((m) => m.initUser(user));
|
// models.forEach((m) => m.initUser(user));
|
||||||
@@ -107,18 +92,18 @@ class MainModel extends ChangeNotifier {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void _initSetting(Setting setting) {
|
void _initSetting(Setting setting) {
|
||||||
// models.forEach((m) => m.initSetting(setting));
|
models.forEach((m) => m.initSetting(setting));
|
||||||
// }
|
}
|
||||||
|
|
||||||
Future<void> _loadSetting() async {
|
Future<void> _loadSetting() async {
|
||||||
try {
|
try {
|
||||||
Services.instance.authService.getSetting().listen((event) {
|
Services.instance.authService.getSetting().listen((event) {
|
||||||
this.setting = event;
|
this.setting = event;
|
||||||
|
_initSetting(setting);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
} finally {}
|
} finally {}
|
||||||
// _initSetting(setting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadUser() async {
|
void _loadUser() async {
|
||||||
|
|||||||
@@ -51,16 +51,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
var languageModel = Provider.of<LanguageModel>(context);
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
MainModel mainModel = Provider.of<MainModel>(context);
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
|
||||||
// buildLanguage(languageModel);
|
|
||||||
_selectedDropdown(String selected) {
|
|
||||||
setState(() {
|
|
||||||
selectedLanguage = selected;
|
|
||||||
languageModel.saveLanguage(selectedLanguage);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
final namebox = Container(
|
final namebox = Container(
|
||||||
// padding: EdgeInsets.only(left: 25.0, right: 25.0),
|
|
||||||
padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0),
|
padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 45.0,
|
height: 45.0,
|
||||||
@@ -137,80 +128,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final emailBox = Container(
|
|
||||||
padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
AppTranslations.of(context).text("profile.email"),
|
|
||||||
style: languageModel.isEng
|
|
||||||
? TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontStyle: FontStyle.normal)
|
|
||||||
: TextStyle(
|
|
||||||
fontSize: 15.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontStyle: FontStyle.normal,
|
|
||||||
fontFamily: "MyanmarUnicode"),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 35,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
mainModel.user == null
|
|
||||||
? ""
|
|
||||||
: mainModel.user.email == null || mainModel.user.email == ''
|
|
||||||
? ''
|
|
||||||
: mainModel.user.email,
|
|
||||||
style: TextStyle(fontSize: 16.0, fontStyle: FontStyle.normal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
final languageBox = Container(
|
|
||||||
padding: EdgeInsets.only(bottom: 0, top: 7, left: 25.0, right: 25.0),
|
|
||||||
child: Container(
|
|
||||||
height: 45.0,
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
AppTranslations.of(context).text("profile.language"),
|
|
||||||
style: languageModel.isEng
|
|
||||||
? TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontStyle: FontStyle.normal)
|
|
||||||
: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontStyle: FontStyle.normal,
|
|
||||||
fontFamily: "MyanmarUnicode"),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: 140,
|
|
||||||
padding: EdgeInsets.only(left: 30),
|
|
||||||
child: Theme(
|
|
||||||
data: new ThemeData(
|
|
||||||
canvasColor: Colors.white,
|
|
||||||
),
|
|
||||||
child: DropdownButton(
|
|
||||||
hint: Text("English"),
|
|
||||||
value: selectedLanguage,
|
|
||||||
isExpanded: true,
|
|
||||||
iconSize: 40,
|
|
||||||
items: languagesList
|
|
||||||
.map<DropdownMenuItem<String>>((String value) {
|
|
||||||
return DropdownMenuItem<String>(
|
|
||||||
value: value,
|
|
||||||
child: Text(value),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
onChanged: _selectedDropdown),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
final logoutbutton = Container(
|
final logoutbutton = Container(
|
||||||
padding: EdgeInsets.only(left: 20.0, right: 24.0),
|
padding: EdgeInsets.only(left: 20.0, right: 24.0),
|
||||||
@@ -283,20 +201,15 @@ class _ProfileState extends State<Profile> {
|
|||||||
namebox,
|
namebox,
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 18.0),
|
padding: const EdgeInsets.only(left: 18.0),
|
||||||
child: Icon(Icons.edit),
|
child: Icon(Icons.edit, color: primaryColor),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
mainModel.isBuyer() ? Container() : getPrivilegeBox(context),
|
mainModel.isCustomer()
|
||||||
|
? Container()
|
||||||
|
: getPrivilegeBox(context),
|
||||||
phonenumberbox,
|
phonenumberbox,
|
||||||
mainModel.user == null
|
// getShippingAddressList(context),
|
||||||
? Container()
|
|
||||||
: mainModel.user.email == null ||
|
|
||||||
mainModel.user.email == ''
|
|
||||||
? Container()
|
|
||||||
: emailBox,
|
|
||||||
languageBox,
|
|
||||||
getShippingAddressList(context),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ class _CodePageState extends State<CodePage> {
|
|||||||
_resend() async {}
|
_resend() async {}
|
||||||
|
|
||||||
_verify() async {
|
_verify() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
AuthResult auth = await context.read<MainModel>().signin(this.pin);
|
AuthResult auth = await context.read<MainModel>().signin(this.pin);
|
||||||
if (auth.authStatus == AuthStatus.AUTH_VERIFIED) {
|
if (auth.authStatus == AuthStatus.AUTH_VERIFIED) {
|
||||||
@@ -202,12 +205,13 @@ class _CodePageState extends State<CodePage> {
|
|||||||
} else {
|
} else {
|
||||||
Navigator.pushNamedAndRemoveUntil(context, "/home", (r) => false);
|
Navigator.pushNamedAndRemoveUntil(context, "/home", (r) => false);
|
||||||
}
|
}
|
||||||
// Provider.of<MainModel>(context, listen: false)
|
|
||||||
// .saveUser(pin, widget.phoneNumber);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
}
|
}
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_completeResend() {
|
_completeResend() {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'package:country_code_picker/country_code_picker.dart';
|
import 'package:country_code_picker/country_code_picker.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/auth_result.dart';
|
import 'package:fcs/fcs/common/domain/entities/auth_result.dart';
|
||||||
import 'package:fcs/fcs/common/domain/entities/auth_status.dart';
|
import 'package:fcs/fcs/common/domain/entities/auth_status.dart';
|
||||||
|
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
||||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||||
|
import 'package:fcs/fcs/common/pages/signin/signup_page.dart';
|
||||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -176,6 +178,13 @@ class _SigninPageState extends State<SigninPage> {
|
|||||||
await Navigator.of(context)
|
await Navigator.of(context)
|
||||||
.push(BottomUpPageRoute(CodePage(phoneNumber: phoneNumber)));
|
.push(BottomUpPageRoute(CodePage(phoneNumber: phoneNumber)));
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
} else if (auth.authStatus == AuthStatus.AUTH_VERIFIED) {
|
||||||
|
User user = context.read<MainModel>().user;
|
||||||
|
if (user != null && !user.hasSignup) {
|
||||||
|
await Navigator.of(context).push(BottomUpPageRoute(SignupPage()));
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamedAndRemoveUntil(context, "/home", (r) => false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (auth.authStatus == AuthStatus.ERROR) {
|
if (auth.authStatus == AuthStatus.ERROR) {
|
||||||
showMsgDialog(context, "Error", auth.authErrorMsg);
|
showMsgDialog(context, "Error", auth.authErrorMsg);
|
||||||
|
|||||||
@@ -49,8 +49,10 @@ class _TermPageState extends State<TermPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Setting setting = Provider.of<MainModel>(context).setting;
|
Setting setting = Provider.of<MainModel>(context).setting;
|
||||||
return CupertinoPageScaffold(
|
bool isEditable = context.select((MainModel m) => m.termEditable());
|
||||||
child: CustomScrollView(slivers: [
|
|
||||||
|
return Scaffold(
|
||||||
|
body: CustomScrollView(slivers: [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -60,8 +62,8 @@ class _TermPageState extends State<TermPage> {
|
|||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
expandedHeight: 150.0,
|
expandedHeight: 100.0,
|
||||||
floating: true,
|
floating: false,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -72,7 +74,8 @@ class _TermPageState extends State<TermPage> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: isEditable
|
||||||
|
? [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
@@ -83,9 +86,11 @@ class _TermPageState extends State<TermPage> {
|
|||||||
CupertinoIcons.pen,
|
CupertinoIcons.pen,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
))
|
))
|
||||||
],
|
]
|
||||||
|
: [],
|
||||||
),
|
),
|
||||||
SliverFillRemaining(child: ZefyrTheme(
|
SliverFillRemaining(
|
||||||
|
child: ZefyrTheme(
|
||||||
data: ZefyrThemeData().copyWith(
|
data: ZefyrThemeData().copyWith(
|
||||||
defaultLineTheme: LineTheme(
|
defaultLineTheme: LineTheme(
|
||||||
textStyle: TextStyle(color: Colors.black),
|
textStyle: TextStyle(color: Colors.black),
|
||||||
@@ -97,9 +102,7 @@ class _TermPageState extends State<TermPage> {
|
|||||||
controller: ZefyrController(_loadDocument(setting)),
|
controller: ZefyrController(_loadDocument(setting)),
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
),
|
),
|
||||||
))
|
))),
|
||||||
|
|
||||||
),
|
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
lib/fcs/common/pages/widgets/bottom_up_page_route.dart
Normal file
23
lib/fcs/common/pages/widgets/bottom_up_page_route.dart
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class BottomUpPageRoute extends PageRouteBuilder {
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
BottomUpPageRoute(this.child)
|
||||||
|
: super(
|
||||||
|
pageBuilder: (context, animation, secondaryAnimation) => child,
|
||||||
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||||
|
var begin = Offset(0.0, 1.0);
|
||||||
|
var end = Offset.zero;
|
||||||
|
var curve = Curves.ease;
|
||||||
|
|
||||||
|
var tween =
|
||||||
|
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
||||||
|
|
||||||
|
return SlideTransition(
|
||||||
|
position: animation.drive(tween),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ class InputText extends StatelessWidget {
|
|||||||
final int maxLines;
|
final int maxLines;
|
||||||
final bool withBorder;
|
final bool withBorder;
|
||||||
final Color borderColor;
|
final Color borderColor;
|
||||||
|
final TextInputType textInputType;
|
||||||
|
|
||||||
const InputText(
|
const InputText(
|
||||||
{Key key,
|
{Key key,
|
||||||
@@ -22,7 +23,8 @@ class InputText extends StatelessWidget {
|
|||||||
this.validator,
|
this.validator,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor})
|
this.borderColor,
|
||||||
|
this.textInputType})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -36,10 +38,11 @@ class InputText extends StatelessWidget {
|
|||||||
cursorColor: primaryColor,
|
cursorColor: primaryColor,
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
|
keyboardType: textInputType,
|
||||||
decoration: new InputDecoration(
|
decoration: new InputDecoration(
|
||||||
hintText: '',
|
// hintText: '',
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
height: 2.5,
|
height: 3.5,
|
||||||
),
|
),
|
||||||
labelText: labelTextKey == null
|
labelText: labelTextKey == null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -115,3 +115,8 @@ flutter:
|
|||||||
- family: MyanmarUnicode
|
- family: MyanmarUnicode
|
||||||
fonts:
|
fonts:
|
||||||
- asset: assets/fonts/MyMMUnicodeUniversal.ttf
|
- asset: assets/fonts/MyMMUnicodeUniversal.ttf
|
||||||
|
|
||||||
|
- family: Myanmar3
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/Myanmar3_2018.ttf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user