add contact
This commit is contained in:
@@ -1,4 +1,49 @@
|
||||
{
|
||||
"contact.btn":"Contact Us",
|
||||
"contact.title":"Contact Us",
|
||||
"contact.phone.title":"Input Phone Number",
|
||||
"contact.phone":"Phone Number",
|
||||
"contact.phone.confim":"Call {0}?",
|
||||
"contact.phone.empty":"Please enter phone number",
|
||||
"contact.email":"Email",
|
||||
"contact.email.configm":"Email to '{0}'?",
|
||||
"contact.email.empty":"Please enter email",
|
||||
"contact.facebook":"Facebook",
|
||||
"contact.facebook.empty":"Please enter facebook url",
|
||||
"contact.google":"Website",
|
||||
"contact.google.empty":"Please enter website url",
|
||||
"contact.confrim":"Confirm update contact?",
|
||||
"contact.open.confrim":"Open '{0}'?",
|
||||
"contact.bank.accounts":"Bank Accounts Info",
|
||||
"contact.address":"Address",
|
||||
"contact.usa.address":"USA Address",
|
||||
"contact.mm.address":"Myanmar Address",
|
||||
"contact.delivery.phone":"Delivery Phone",
|
||||
"contact.fcs.email":"FCS Email",
|
||||
"contact.callus":"Call Us",
|
||||
"contact.findus":"Find Us",
|
||||
"contact.emailus":"Email Us",
|
||||
"contact.visitus":"Visit Us",
|
||||
"contact.usa.phone": "USA Phone",
|
||||
"contact.mm.phone": "Myanmar Phone",
|
||||
|
||||
"contact.edit.title":"Edit Contact Us",
|
||||
|
||||
"term":"Terms of service",
|
||||
"term.btn":"Terms of service",
|
||||
|
||||
"faq.btn":"FAQs",
|
||||
"faq.title":"Frequently Asked Questions",
|
||||
|
||||
"faq.add.title":"New FAQ",
|
||||
"faq.edit.title":"Edit FAQ",
|
||||
"faq.edit.eng":"English",
|
||||
"faq.edit.mm":"Myanmar",
|
||||
"faq.edit.question":"Question",
|
||||
"faq.edit.answer":"Answer",
|
||||
|
||||
|
||||
|
||||
"btn.save": "Save",
|
||||
"btn.approve":"Approve",
|
||||
|
||||
@@ -267,8 +312,6 @@
|
||||
"buyer.delete.confirm":"Delete buyer request?",
|
||||
"buyer.allocate.quota.confirm":"Allocate Quota?",
|
||||
|
||||
"term.agree_btn":"Agree",
|
||||
"term.iagree":"I agree on terms and condition.",
|
||||
|
||||
"noti.title":"Notifications",
|
||||
"noti.list.title":"NOTIFICATIONS",
|
||||
@@ -279,34 +322,8 @@
|
||||
"document.by":"By",
|
||||
"document.desc":"Description",
|
||||
|
||||
"contact.title":"Contact Us",
|
||||
"contact.phone.title":"Input Phone Number",
|
||||
"contact.phone":"Phone Number",
|
||||
"contact.phone.confim":"Call {0}?",
|
||||
"contact.phone.empty":"Please enter phone number",
|
||||
"contact.email":"Email",
|
||||
"contact.email.configm":"Email to '{0}'?",
|
||||
"contact.email.empty":"Please enter email",
|
||||
"contact.facebook":"Facebook",
|
||||
"contact.facebook.empty":"Please enter facebook url",
|
||||
"contact.google":"Website",
|
||||
"contact.google.empty":"Please enter website url",
|
||||
"contact.confrim":"Confirm update contact?",
|
||||
"contact.open.confrim":"Open '{0}'?",
|
||||
"contact.bank.accounts":"Bank Accounts Info",
|
||||
"contact.address":"Address",
|
||||
"contact.usa.address":"USA Address",
|
||||
"contact.mm.address":"Myanmar Address",
|
||||
"contact.delivery.phone":"Delivery Phone",
|
||||
"contact.fcs.email":"FCS Email",
|
||||
"contact.callus":"Call Us",
|
||||
"contact.findus":"Find Us",
|
||||
"contact.emailus":"Email Us",
|
||||
"contact.visitus":"Visit Us",
|
||||
|
||||
"contact.edit.title":"Edit Contact Us",
|
||||
|
||||
"term.title":"Terms",
|
||||
|
||||
"manual.title":"Manual",
|
||||
"myreg.title":"My\nRegistration",
|
||||
"storage.title":"Storages",
|
||||
@@ -574,20 +591,14 @@
|
||||
"invoice.add_box":"Add Box",
|
||||
"invoice.add_package":"Add Package",
|
||||
|
||||
"term":"TERMS",
|
||||
"term.btn":"Terms of service",
|
||||
|
||||
"customer.list.title":"CUSTOMERS",
|
||||
"customer.form.title":"CUSTOMER",
|
||||
"customer.invite":"Invite",
|
||||
|
||||
"contact": "CONTACT US",
|
||||
|
||||
"fcs.btn": "FCS Profile",
|
||||
"fcs.profile": "FCS PROFILE",
|
||||
|
||||
"contact.usa.phone": "USA Phone",
|
||||
"contact.mm.phone": "Myanmar Phone",
|
||||
|
||||
"payment.title": "PAYMENT",
|
||||
"payment.date": "Date",
|
||||
|
||||
@@ -1,4 +1,48 @@
|
||||
{
|
||||
"contact.btn":"ဆက်သွယ်ရန်",
|
||||
"contact.title":"ဆက်သွယ်ရန်",
|
||||
"contact.phone.title":"ဖုန်းနံပါတ်ထည့်သွင်းရန်",
|
||||
"contact.phone":"ဖုန်းနံပါတ်",
|
||||
"contact.usa.phone": "အမေရိကား ဖုန်းနံပါတ်",
|
||||
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်",
|
||||
"contact.phone.confim":"ဖုန်းနံပါတ် '{0}' ကို ခေါ်မလား?",
|
||||
"contact.phone.empty":"ကျေးဇူးပြု၍ ဖုန်းနံပါတ်ထည့်ပါ",
|
||||
"contact.email":"အီးမေးလ်",
|
||||
"contact.email.configm":"အီးမေးလ် '{0}' ကိုပို့ မလား?",
|
||||
"contact.email.empty":"ကျေးဇူးပြု၍ အီးမေးလ်ထည့်ပါ",
|
||||
"contact.facebook":"ဖေ့စ်ဘွတ်ခ်",
|
||||
"contact.facebook.empty":"ကျေးဇူးပြုပြီး ဖေ့စ်ဘွတ်ခ် လင့်ခ် ကိုရိုက်ထည့်ပါ",
|
||||
"contact.google":"ဝဘ်ဆိုက်",
|
||||
"contact.google.empty":"ကျေးဇူးပြုပြီး ဝဘ်ဆိုက် လင့်ခ် ကိုရိုက်ထည့်ပါ",
|
||||
"contact.confrim":"ဆက်သွယ်ခြင်း ကိုပြင်မည်လား?",
|
||||
"contact.open.confrim":"'{0}' ကိုဖွင့် မလား?",
|
||||
"contact.bank.accounts":"ဘဏ်အကောင့်အချက်အလက်",
|
||||
"contact.address":"လိပ်စာ",
|
||||
"contact.delivery.phone":"သီလဝါ ဆီထုတ် ဖုန်းနံပါတ်",
|
||||
"contact.usa.address":"အမေရိကား လိပ်စာ",
|
||||
"contact.mm.address":"မြန်မာ လိပ်စာ",
|
||||
"contact.fcs.email":"FCS အီးမေးလ်",
|
||||
"contact.callus":"ခေါ်ရန်",
|
||||
"contact.findus":"တည်နေရာ",
|
||||
"contact.emailus":"အီးမေးလ်",
|
||||
"contact.visitus":"ကြည့်ပါ",
|
||||
|
||||
"contact.edit.title":"ဆက်သွယ်ရန် ပြုပြင်ခြင်း",
|
||||
|
||||
"term":"စည်းကမ်းချက်များ",
|
||||
"term.btn":"စည်းကမ်းချက်များ",
|
||||
|
||||
"faq.btn":"မေးလေ့ရှိသောမေးခွန်းများ",
|
||||
"faq.title":"မေးလေ့ရှိသောမေးခွန်းများ",
|
||||
|
||||
"faq.add.title":"မေးလေ့ရှိသောမေးခွန်း အသစ်",
|
||||
"faq.edit.title":"မေးလေ့ရှိသောမေးခွန်း ပြုပြင်ခြင်း",
|
||||
"faq.edit.eng":"အင်္ဂလိပ်",
|
||||
"faq.edit.mm":"မြန်မာ",
|
||||
"faq.edit.question":"မေးခွန်း",
|
||||
"faq.edit.answer":"အဖြေ",
|
||||
|
||||
|
||||
"btn.save":"သိမ်းဆည်းရန်",
|
||||
"btn.approve":"အတည်ပြုရန်",
|
||||
|
||||
@@ -262,9 +306,6 @@
|
||||
"buyer.delete.confirm":"ဝယ်ယူသူပယ်ဖျက်မည်လား?",
|
||||
"buyer.allocate.quota.confirm":"ခွဲတမ်းသတ်မှတ်မည်လား?",
|
||||
|
||||
"term.agree_btn":"သဘောတူပါသည်",
|
||||
"term.iagree":"ကျွန်တော် သဘောတူပါသည်",
|
||||
|
||||
"noti.title":"အသိပေးချက်များ",
|
||||
"noti.list.title":"NOTIFICATIONS",
|
||||
"log.title":"မှတ်တမ်းများ",
|
||||
@@ -274,36 +315,7 @@
|
||||
"document.by":"အားဖြင့်",
|
||||
"document.desc":"ဖော်ပြချက်",
|
||||
|
||||
"contact.title":"ဆက်သွယ်ရန်",
|
||||
"contact.phone.title":"ဖုန်းနံပါတ်ထည့်သွင်းရန်",
|
||||
"contact.phone":"ဖုန်းနံပါတ်",
|
||||
"contact.usa.phone": "အမေရိကား ဖုန်းနံပါတ်",
|
||||
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်",
|
||||
"contact.phone.confim":"ဖုန်းနံပါတ် '{0}' ကို ခေါ်မလား?",
|
||||
"contact.phone.empty":"ကျေးဇူးပြု၍ ဖုန်းနံပါတ်ထည့်ပါ",
|
||||
"contact.email":"အီးမေးလ်",
|
||||
"contact.email.configm":"အီးမေးလ် '{0}' ကိုပို့ မလား?",
|
||||
"contact.email.empty":"ကျေးဇူးပြု၍ အီးမေးလ်ထည့်ပါ",
|
||||
"contact.facebook":"ဖေ့စ်ဘွတ်ခ်",
|
||||
"contact.facebook.empty":"ကျေးဇူးပြုပြီး ဖေ့စ်ဘွတ်ခ် လင့်ခ် ကိုရိုက်ထည့်ပါ",
|
||||
"contact.google":"ဝဘ်ဆိုက်",
|
||||
"contact.google.empty":"ကျေးဇူးပြုပြီး ဝဘ်ဆိုက် လင့်ခ် ကိုရိုက်ထည့်ပါ",
|
||||
"contact.confrim":"ဆက်သွယ်ခြင်း ကိုပြင်မည်လား?",
|
||||
"contact.open.confrim":"'{0}' ကိုဖွင့် မလား?",
|
||||
"contact.bank.accounts":"ဘဏ်အကောင့်အချက်အလက်",
|
||||
"contact.address":"လိပ်စာ",
|
||||
"contact.delivery.phone":"သီလဝါ ဆီထုတ် ဖုန်းနံပါတ်",
|
||||
"contact.usa.address":"အမေရိကား လိပ်စာ",
|
||||
"contact.mm.address":"မြန်မာ လိပ်စာ",
|
||||
"contact.fcs.email":"FCS အီးမေးလ်",
|
||||
"contact.callus":"ခေါ်ပါ",
|
||||
"contact.findus":"တည်နေရာ",
|
||||
"contact.emailus":"အီးမေးလ်",
|
||||
"contact.visitus":"ကြည့်ပါ",
|
||||
|
||||
"contact.edit.title":"ဆက်သွယ်ရန် ပြုပြင်ခြင်း",
|
||||
|
||||
"term.title":"စည်းကမ်းချက်များ",
|
||||
"manual.title":"လက်စွဲစာအုပ်",
|
||||
"myreg.title":"ကိုယ်ရေး\nအချက်အလက်",
|
||||
"storage.title":"သိုလှောင်ကန်များ",
|
||||
@@ -594,14 +606,10 @@
|
||||
"invoice.add_package":"Add Package",
|
||||
"invoice.add_box":"Add Box",
|
||||
|
||||
"term":"စည်းကမ်းချက်များ",
|
||||
"term.btn":"စည်းကမ်းချက်များ",
|
||||
|
||||
"customer.list.title":"ဝယ်ယူသူများ",
|
||||
"customer.form.title":"ဝယ်ယူသူ",
|
||||
|
||||
"contact": "ဆက်သွယ်ရန်",
|
||||
|
||||
"fcs.profile": "ပရိုဖိုင်",
|
||||
|
||||
|
||||
|
||||
38
lib/app.dart
38
lib/app.dart
@@ -3,7 +3,9 @@ import 'dart:io';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations_delegate.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/model/language_model.dart';
|
||||
import 'package:fcs/fcs/common/pages/term/model/term_model.dart';
|
||||
import 'package:fcs/fcs/common/services/services.dart';
|
||||
import 'package:fcs/model/buyer_model.dart';
|
||||
import 'package:fcs/model/delivery_model.dart';
|
||||
@@ -55,8 +57,10 @@ class App extends StatefulWidget {
|
||||
|
||||
class _AppState extends State<App> {
|
||||
final fcs.MainModel mainModel2 = new fcs.MainModel();
|
||||
|
||||
final ContactModel contactModel =new ContactModel();
|
||||
final TermModel termModel=new TermModel();
|
||||
final MainModel mainModel = new MainModel();
|
||||
|
||||
final UserModel userModel = new UserModel();
|
||||
final ProductModel productModel = new ProductModel();
|
||||
final EmployeeModel employeeModel = new EmployeeModel();
|
||||
@@ -243,27 +247,29 @@ class _AppState extends State<App> {
|
||||
ChangeNotifierProvider.value(value: discountModel),
|
||||
ChangeNotifierProvider.value(value: testModel),
|
||||
ChangeNotifierProvider.value(value: mainModel2),
|
||||
ChangeNotifierProvider.value(value: contactModel),
|
||||
ChangeNotifierProvider.value(value: termModel),
|
||||
],
|
||||
child: Consumer<LanguageModel>(
|
||||
builder: (context, value, child) {
|
||||
return CupertinoApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'FCS',
|
||||
theme: CupertinoThemeData(
|
||||
textTheme: CupertinoTextThemeData(
|
||||
navActionTextStyle: TextStyle(color: Colors.white),
|
||||
navTitleTextStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: value.isEng ? 20 : 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
navLargeTitleTextStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: value.isEng ? 40 : 24,
|
||||
fontWeight: FontWeight.bold),
|
||||
primaryColor: primaryColor,
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
actionTextStyle: TextStyle(color: Colors.white),
|
||||
)),
|
||||
// theme: CupertinoThemeData(
|
||||
// textTheme: CupertinoTextThemeData(
|
||||
// navActionTextStyle: TextStyle(color: Colors.white),
|
||||
// navTitleTextStyle: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: value.isEng ? 20 : 18,
|
||||
// fontWeight: FontWeight.w600),
|
||||
// navLargeTitleTextStyle: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: value.isEng ? 40 : 24,
|
||||
// fontWeight: FontWeight.w600),
|
||||
// primaryColor: primaryColor,
|
||||
// textStyle: TextStyle(color: Colors.white),
|
||||
// actionTextStyle: TextStyle(color: Colors.white),
|
||||
// )),
|
||||
routes: route(context),
|
||||
localizationsDelegates: [
|
||||
_newLocaleDelegate,
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:fcs/fcs/common/domain/constants.dart';
|
||||
import 'package:fcs/fcs/common/domain/entities/auth_result.dart' as fcs;
|
||||
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/exceiptions/signin_exception.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
@@ -126,7 +127,7 @@ class AuthFb {
|
||||
return getUser(refreshIdToken: true);
|
||||
}
|
||||
|
||||
static Future<String> getToken() async {
|
||||
Future<String> getToken() async {
|
||||
FirebaseUser firebaseUser = await _fb.currentUser();
|
||||
IdTokenResult token = await firebaseUser.getIdToken();
|
||||
return token.token;
|
||||
@@ -143,4 +144,16 @@ class AuthFb {
|
||||
// _listSetting();
|
||||
return Setting.fromMap(snap.data);
|
||||
}
|
||||
|
||||
Stream<Setting> settings() async* {
|
||||
Stream<DocumentSnapshot> snapshot = Firestore.instance
|
||||
.collection(config_collection)
|
||||
.document(setting_doc_id)
|
||||
.snapshots();
|
||||
|
||||
await for (var snap in snapshot) {
|
||||
Setting setting = Setting.fromMap(snap.data);
|
||||
yield setting;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
lib/fcs/common/domain/entities/faq.dart
Normal file
29
lib/fcs/common/domain/entities/faq.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
class FAQ {
|
||||
String id;
|
||||
String questionEng;
|
||||
String questionMm;
|
||||
String answerEng;
|
||||
String answerMm;
|
||||
|
||||
String question(bool isEng) => isEng?questionEng:questionMm;
|
||||
String answer(bool isEng) => isEng?answerEng:answerMm;
|
||||
|
||||
Map<String, String> images;
|
||||
FAQ({this.id,this.questionEng,this.questionMm,this.answerEng,this.answerMm,this.images});
|
||||
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'question_eng': questionEng,
|
||||
'answer_eng': answerEng,
|
||||
'question_mm': questionMm,
|
||||
'answer_mm': answerMm,
|
||||
'images': images,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FAQ{id: $id, questionEng: $questionEng,questionMm:$questionMm}';
|
||||
}
|
||||
}
|
||||
45
lib/fcs/common/domain/vo/contact.dart
Normal file
45
lib/fcs/common/domain/vo/contact.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||
|
||||
class Contact {
|
||||
String usaAddress;
|
||||
String mmAddress;
|
||||
String usaContactNumber;
|
||||
String mmContactNumber;
|
||||
String emailAddress;
|
||||
String facebookLink;
|
||||
|
||||
Contact({
|
||||
this.usaAddress,
|
||||
this.mmAddress,
|
||||
this.usaContactNumber,
|
||||
this.mmContactNumber,
|
||||
this.emailAddress,
|
||||
this.facebookLink,
|
||||
});
|
||||
|
||||
factory Contact.fromSetting(Setting setting) {
|
||||
return Contact(
|
||||
usaContactNumber: setting.usaContactNumber,
|
||||
mmContactNumber: setting.mmContactNumber,
|
||||
usaAddress: setting.usaAddress,
|
||||
mmAddress: setting.mmAddress,
|
||||
emailAddress: setting.emailAddress,
|
||||
facebookLink: setting.facebookLink);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'usa_address': usaAddress,
|
||||
'mm_address': mmAddress,
|
||||
'usa_contact_number': usaContactNumber,
|
||||
'mm_contact_number': mmContactNumber,
|
||||
'email_address': emailAddress,
|
||||
'facebook_link': facebookLink,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Contact{usa_address:$usaAddress,mm_address:$mmAddress}';
|
||||
}
|
||||
}
|
||||
25
lib/fcs/common/domain/vo/term.dart
Normal file
25
lib/fcs/common/domain/vo/term.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||
|
||||
class Term {
|
||||
String term;
|
||||
|
||||
Term({
|
||||
this.term,
|
||||
});
|
||||
|
||||
factory Term.fromSetting(Setting setting) {
|
||||
return Term(
|
||||
term: setting.terms,);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'terms': term,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Contact{terms:$term}';
|
||||
}
|
||||
}
|
||||
12
lib/fcs/common/helpers/firebase_helper.dart
Normal file
12
lib/fcs/common/helpers/firebase_helper.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
final log = Logger('firebaseHelper');
|
||||
|
||||
final FirebaseAuth auth = FirebaseAuth.instance;
|
||||
|
||||
Future<String> getToken() async {
|
||||
FirebaseUser firebaseUser = await auth.currentUser();
|
||||
IdTokenResult token = await firebaseUser.getIdToken();
|
||||
return token.token;
|
||||
}
|
||||
@@ -11,22 +11,25 @@ const buttonBkColor = const Color(0xFF268944);
|
||||
const labelColor = const Color(0xFF757575);
|
||||
|
||||
const TextStyle labelStyle =
|
||||
TextStyle(fontSize: 13, color: Colors.grey, fontWeight: FontWeight.w500);
|
||||
TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500);
|
||||
const TextStyle labelStyleMM = TextStyle(
|
||||
fontSize: 23,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: "MyanmarUnicode");
|
||||
const TextStyle subMenuStyle =
|
||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500);
|
||||
const TextStyle subMenuStyleMM =
|
||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500,
|
||||
fontFamily: "MyanmarUnicode");
|
||||
|
||||
const TextStyle welcomeLabelStyle =
|
||||
TextStyle(fontSize: 23, color: primaryColor, fontWeight: FontWeight.w500);
|
||||
const TextStyle welcomeSubLabelStyle =
|
||||
TextStyle(fontSize: 18, color: primaryColor, fontWeight: FontWeight.w500);
|
||||
const TextStyle subMenuStyle =
|
||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.w500);
|
||||
const TextStyle siginButtonStyle =
|
||||
TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500);
|
||||
|
||||
const TextStyle labelStyleMM = TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: "MyanmarUnicode");
|
||||
|
||||
TextStyle newLabelStyle(
|
||||
{Color color,
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact_editor.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/widgets/local_text.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.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:url_launcher/url_launcher.dart';
|
||||
|
||||
class Contact extends StatefulWidget {
|
||||
@override
|
||||
_ContactState createState() => _ContactState();
|
||||
}
|
||||
|
||||
class _ContactState extends State<Contact> {
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Setting setting = Provider.of<MainModel>(context).setting;
|
||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: CupertinoPageScaffold(
|
||||
child: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
backgroundColor: primaryColor,
|
||||
actionsForegroundColor: Colors.white,
|
||||
largeTitle: Text(
|
||||
AppTranslations.of(context).text('contact.title'),
|
||||
),
|
||||
trailing: GestureDetector(
|
||||
onTap: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => ContactEditor(
|
||||
setting: setting,
|
||||
),
|
||||
)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
CupertinoIcons.pen,
|
||||
size: 23,
|
||||
color: Colors.white,
|
||||
),
|
||||
)),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
itemTitle("contact.callus"),
|
||||
link(setting.usaContactNumber, Icons.phone_forwarded,
|
||||
onTap: () => _call(setting.usaContactNumber),
|
||||
label: LocalText(context, "contact.usa.phone",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
link(setting.mmContactNumber, Icons.phone_forwarded,
|
||||
onTap: () => _call(
|
||||
setting.mmContactNumber,
|
||||
),
|
||||
label: LocalText(context, "contact.mm.phone",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
itemTitle("contact.findus"),
|
||||
link(setting.usaAddress, Icons.location_on,
|
||||
label: LocalText(context, "contact.usa.address",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
link(setting.mmAddress, Icons.location_on,
|
||||
label: LocalText(context, "contact.mm.address",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
itemTitle("contact.emailus"),
|
||||
link(setting.emailAddress, Icons.email,
|
||||
onTap: () => _email(setting.emailAddress),
|
||||
label: LocalText(context, "contact.fcs.email",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
itemTitle("contact.visitus"),
|
||||
link(setting.facebookLink, FontAwesomeIcons.facebook,
|
||||
onTap: () => _openLink(setting.facebookLink),
|
||||
label: LocalText(context, "contact.facebook",
|
||||
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget link(String text, IconData iconData,
|
||||
{Function() onTap, Widget label}) {
|
||||
return Material(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, bottom: 10, right: 18),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 0.8),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5.0) // <--- border radius here
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => onTap != null ? onTap() : null,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
iconData,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
label == null
|
||||
? Container()
|
||||
: Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||
child: label,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
text == null ? "" : text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 5,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
onTap == null
|
||||
? Container()
|
||||
: Icon(
|
||||
Icons.open_in_new,
|
||||
color: Colors.grey,
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemTitle(String textKey) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, top: 15, bottom: 5),
|
||||
child: Text(
|
||||
AppTranslations.of(context).text(textKey),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18, color: Colors.black54),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getVersionNumber() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
String version = packageInfo.version + "+" + packageInfo.buildNumber;
|
||||
return version;
|
||||
}
|
||||
|
||||
_call(String phone) {
|
||||
launch("tel:$phone");
|
||||
}
|
||||
|
||||
_email(String email) {
|
||||
launch("mailto:$email");
|
||||
}
|
||||
|
||||
_openLink(String link) {
|
||||
launch("$link");
|
||||
}
|
||||
}
|
||||
164
lib/fcs/common/pages/contact/contact_editor.dart
Normal file
164
lib/fcs/common/pages/contact/contact_editor.dart
Normal file
@@ -0,0 +1,164 @@
|
||||
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/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact/model/contact_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/util.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'widgets.dart';
|
||||
|
||||
class ContactEditor extends StatefulWidget {
|
||||
final Contact contact;
|
||||
const ContactEditor({this.contact});
|
||||
@override
|
||||
_ContactEditorState createState() => _ContactEditorState();
|
||||
}
|
||||
|
||||
class _ContactEditorState extends State<ContactEditor> {
|
||||
TextEditingController _usaPhone = new TextEditingController();
|
||||
TextEditingController _mmPhone = new TextEditingController();
|
||||
TextEditingController _usaAddress = new TextEditingController();
|
||||
TextEditingController _mmAddress = new TextEditingController();
|
||||
TextEditingController _email = new TextEditingController();
|
||||
TextEditingController _facebook = new TextEditingController();
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.contact != null) {
|
||||
_usaPhone.text = widget.contact.usaContactNumber;
|
||||
_mmPhone.text = widget.contact.mmContactNumber;
|
||||
_usaAddress.text = widget.contact.usaAddress;
|
||||
_mmAddress.text = widget.contact.mmAddress;
|
||||
_email.text = widget.contact.emailAddress;
|
||||
_facebook.text = widget.contact.facebookLink;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final usaPhoneBox = InputText(
|
||||
labelTextKey: 'contact.usa.phone',
|
||||
iconData: CupertinoIcons.phone,
|
||||
controller: _usaPhone);
|
||||
final mmPhoneBox = InputText(
|
||||
labelTextKey: 'contact.mm.phone',
|
||||
iconData: CupertinoIcons.phone,
|
||||
controller: _mmPhone);
|
||||
final usaAddreesBox = InputText(
|
||||
labelTextKey: 'contact.usa.address',
|
||||
iconData: CupertinoIcons.location,
|
||||
controller: _usaAddress);
|
||||
final mmAddressBox = InputText(
|
||||
labelTextKey: 'contact.mm.address',
|
||||
iconData: CupertinoIcons.location,
|
||||
controller: _mmAddress);
|
||||
final emailBox = InputText(
|
||||
labelTextKey: 'contact.email',
|
||||
iconData: CupertinoIcons.mail,
|
||||
controller: _email);
|
||||
final faceBookBox = InputText(
|
||||
labelTextKey: 'contact.facebook',
|
||||
iconData: FontAwesomeIcons.facebook,
|
||||
controller: _facebook);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: CupertinoPageScaffold(
|
||||
child: 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('contact.edit.title'),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _submit(),
|
||||
icon: Icon(
|
||||
Icons.save,
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
body: Material(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||
children: <Widget>[
|
||||
itemTitle(context, "contact.callus"),
|
||||
usaPhoneBox,
|
||||
mmPhoneBox,
|
||||
Divider(),
|
||||
itemTitle(context, "contact.findus"),
|
||||
usaAddreesBox,
|
||||
mmAddressBox,
|
||||
Divider(),
|
||||
itemTitle(context, "contact.emailus"),
|
||||
emailBox,
|
||||
Divider(),
|
||||
itemTitle(context, "contact.visitus"),
|
||||
faceBookBox
|
||||
],
|
||||
),
|
||||
),
|
||||
))));
|
||||
}
|
||||
|
||||
_submit() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
widget.contact.usaContactNumber = _usaPhone.text;
|
||||
widget.contact.mmContactNumber = _mmPhone.text;
|
||||
widget.contact.usaAddress = _usaAddress.text;
|
||||
widget.contact.mmAddress = _mmAddress.text;
|
||||
widget.contact.emailAddress = _email.text;
|
||||
widget.contact.facebookLink = _facebook.text;
|
||||
var contactModel = Provider.of<ContactModel>(context, listen: false);
|
||||
await contactModel.saveContact(widget.contact);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
132
lib/fcs/common/pages/contact/contact_page.dart
Normal file
132
lib/fcs/common/pages/contact/contact_page.dart
Normal file
@@ -0,0 +1,132 @@
|
||||
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/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact/contact_editor.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||
import 'package:flutter/cupertino.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:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'widgets.dart';
|
||||
|
||||
class ContactPage extends StatefulWidget {
|
||||
@override
|
||||
_ContactPageState createState() => _ContactPageState();
|
||||
}
|
||||
|
||||
class _ContactPageState extends State<ContactPage> {
|
||||
@override
|
||||
Widget build(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('contact.title'),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => ContactEditor(
|
||||
contact: Contact.fromSetting(setting),
|
||||
),
|
||||
)),
|
||||
icon: Icon(
|
||||
CupertinoIcons.pen,
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
itemTitle(context, "contact.callus"),
|
||||
contactItem(context, setting.usaContactNumber, CupertinoIcons.phone,
|
||||
onTap: () => _call(setting.usaContactNumber),
|
||||
labelKey: "contact.usa.phone"),
|
||||
contactItem(
|
||||
context,
|
||||
setting.mmContactNumber,
|
||||
CupertinoIcons.phone,
|
||||
onTap: () => _call(
|
||||
setting.mmContactNumber,
|
||||
),
|
||||
labelKey: "contact.mm.phone",
|
||||
),
|
||||
itemTitle(context, "contact.findus"),
|
||||
contactItem(
|
||||
context,
|
||||
setting.usaAddress,
|
||||
CupertinoIcons.location,
|
||||
labelKey: "contact.usa.address",
|
||||
),
|
||||
contactItem(
|
||||
context,
|
||||
setting.mmAddress,
|
||||
CupertinoIcons.location,
|
||||
labelKey: "contact.mm.address",
|
||||
),
|
||||
itemTitle(context, "contact.emailus"),
|
||||
contactItem(
|
||||
context,
|
||||
setting.emailAddress,
|
||||
CupertinoIcons.mail,
|
||||
onTap: () => _email(setting.emailAddress),
|
||||
labelKey: "contact.fcs.email",
|
||||
),
|
||||
itemTitle(context, "contact.visitus"),
|
||||
contactItem(
|
||||
context,
|
||||
setting.facebookLink,
|
||||
FontAwesomeIcons.facebook,
|
||||
onTap: () => _opencontactItem(setting.facebookLink),
|
||||
labelKey: "contact.facebook",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getVersionNumber() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
String version = packageInfo.version + "+" + packageInfo.buildNumber;
|
||||
return version;
|
||||
}
|
||||
|
||||
_call(String phone) {
|
||||
launch("tel:$phone");
|
||||
}
|
||||
|
||||
_email(String email) {
|
||||
launch("mailto:$email");
|
||||
}
|
||||
|
||||
_opencontactItem(String contactItem) {
|
||||
launch("$contactItem");
|
||||
}
|
||||
}
|
||||
17
lib/fcs/common/pages/contact/model/contact_model.dart
Normal file
17
lib/fcs/common/pages/contact/model/contact_model.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fcs/fcs/common/domain/vo/contact.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||
import 'package:fcs/fcs/common/services/services.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class ContactModel extends BaseModel {
|
||||
final log = Logger('ContactModel');
|
||||
|
||||
Future<void> saveContact(Contact contact) async {
|
||||
await request("/contact", "PUT",
|
||||
payload: contact.toMap(), token: await Services.instance.authService.getToken());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
92
lib/fcs/common/pages/contact/widgets.dart
Normal file
92
lib/fcs/common/pages/contact/widgets.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget itemTitle(BuildContext context, String textKey) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, top: 25, bottom: 5),
|
||||
child: Text(
|
||||
AppTranslations.of(context).text(textKey),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18, color: Colors.black),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget subItemTitle(BuildContext context, String textKey) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 38.0, top: 5, bottom: 0),
|
||||
child: Text(
|
||||
AppTranslations.of(context).text(textKey),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700, fontSize: 15, color: Colors.grey),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactItem(BuildContext context, String text, IconData iconData,
|
||||
{Function() onTap, String labelKey}) {
|
||||
return Material(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0, bottom: 10, right: 18),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 0.8),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5.0) // <--- border radius here
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => onTap != null ? onTap() : null,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
iconData,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
labelKey == null
|
||||
? Container()
|
||||
: Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||
child: LocalText(context, labelKey,
|
||||
color: primaryColor, fontWeight: FontWeight.w500,fontSize: 18),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
text == null ? "" : text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 5,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
onTap == null
|
||||
? Container()
|
||||
: Icon(
|
||||
Icons.open_in_new,
|
||||
color: Colors.grey,
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.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/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/progress.dart';
|
||||
import 'package:fcs/pages/phone_input.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ContactEditor extends StatefulWidget {
|
||||
final Setting setting;
|
||||
const ContactEditor({this.setting});
|
||||
@override
|
||||
_ContactEditorState createState() => _ContactEditorState();
|
||||
}
|
||||
|
||||
class _ContactEditorState extends State<ContactEditor> {
|
||||
TextEditingController _email = new TextEditingController();
|
||||
TextEditingController _facebook = new TextEditingController();
|
||||
TextEditingController _website = new TextEditingController();
|
||||
TextEditingController _address = new TextEditingController();
|
||||
TextEditingController _deliveryPhone = new TextEditingController();
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
|
||||
List<String> phones = new List();
|
||||
List<String> _initPhones = new List();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.setting != null) {
|
||||
this._initPhones = widget.setting.phones;
|
||||
_email.text = widget.setting.emailAddress;
|
||||
_facebook.text = widget.setting.facebookLink;
|
||||
_website.text = widget.setting.website;
|
||||
_deliveryPhone.text = widget.setting.deliveryPhone;
|
||||
_address.text = widget.setting.address;
|
||||
|
||||
phones.clear();
|
||||
// _initPhones.forEach((p) {
|
||||
// phones.add(p);
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
final emailBox = TextFormField(
|
||||
controller: _email,
|
||||
autofocus: false,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
decoration: new InputDecoration(
|
||||
labelText: AppTranslations.of(context).text('contact.email'),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: Icon(
|
||||
Icons.email,
|
||||
color: primaryColor,
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppTranslations.of(context).text('contact.email.empty');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
final faceBookBox = TextFormField(
|
||||
controller: _facebook,
|
||||
autofocus: false,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
decoration: new InputDecoration(
|
||||
labelText: AppTranslations.of(context).text('contact.facebook'),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.facebook,
|
||||
color: primaryColor,
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppTranslations.of(context).text('contact.facebook.empty');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
final googleBox = TextFormField(
|
||||
controller: _website,
|
||||
autofocus: false,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
decoration: new InputDecoration(
|
||||
labelText: AppTranslations.of(context).text('contact.google'),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.chrome,
|
||||
color: primaryColor,
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppTranslations.of(context).text('contact.google.empty');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
|
||||
final addPhoneNumber = ListTile(
|
||||
contentPadding: EdgeInsets.only(top: 15),
|
||||
title: ButtonTheme(
|
||||
height: 45,
|
||||
child: RaisedButton(
|
||||
color: Colors.white,
|
||||
onPressed: () async {
|
||||
var phone = await showDialog(
|
||||
context: context, builder: (_) => PhoneEditor());
|
||||
_save(phone);
|
||||
},
|
||||
child: Text("Add Phone",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
)),
|
||||
),
|
||||
));
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text(
|
||||
AppTranslations.of(context).text('contact.edit.title'),
|
||||
style: TextStyle(color: CupertinoColors.activeBlue),
|
||||
),
|
||||
),
|
||||
// child: NestedScrollView(
|
||||
// headerSliverBuilder:
|
||||
// (BuildContext context, bool innerBoxIsScrolled) {
|
||||
// return <Widget>[
|
||||
// // CupertinoNavigationBar(),
|
||||
// CupertinoSliverNavigationBar(
|
||||
// largeTitle: Text(
|
||||
// AppTranslations.of(context).text('contact.edit.title'),
|
||||
// ),
|
||||
// trailing: CupertinoButton(
|
||||
// onPressed: () => {},
|
||||
// child: Icon(
|
||||
// CupertinoIcons.pen,
|
||||
// )),
|
||||
// )
|
||||
// ];
|
||||
// },
|
||||
// body: Text("text"),
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: primaryColor,
|
||||
// title: LocalText(
|
||||
// context,
|
||||
// "contact.title",
|
||||
// fontSize: 20,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// actions: <Widget>[
|
||||
// IconButton(
|
||||
// icon: Icon(Icons.send),
|
||||
// onPressed: () {
|
||||
// if (!_formKey.currentState.validate()) return;
|
||||
// showConfirmDialog(context, "contact.confrim", () {
|
||||
// _submit();
|
||||
// });
|
||||
// })
|
||||
// ],
|
||||
// ),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||
children: <Widget>[
|
||||
// this.phones.isNotEmpty
|
||||
// ? ConstrainedBox(
|
||||
// constraints: BoxConstraints(maxHeight: 1000),
|
||||
// child: ListView.builder(
|
||||
// shrinkWrap: true,
|
||||
// itemBuilder: (context, index) {
|
||||
// return Stack(
|
||||
// alignment: const Alignment(1.0, 1.0),
|
||||
// children: <Widget>[
|
||||
// new TextField(
|
||||
// controller: new TextEditingController(
|
||||
// text: this.phones[index]),
|
||||
// cursorColor: primaryColor,
|
||||
// readOnly: true,
|
||||
// decoration: new InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// focusedBorder: InputBorder.none,
|
||||
// icon: Icon(
|
||||
// Icons.phone,
|
||||
// color: primaryColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// new FlatButton(
|
||||
// onPressed: () {
|
||||
// setState(() {
|
||||
// this.phones.remove(this.phones[index]);
|
||||
// });
|
||||
// },
|
||||
// child: new Icon(
|
||||
// Icons.cancel,
|
||||
// size: 25,
|
||||
// ))
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// itemCount: this.phones.length,
|
||||
// ),
|
||||
// )
|
||||
// : Container(),
|
||||
// addPhoneNumber,
|
||||
// LocalTextField(
|
||||
// textEditingController: _deliveryPhone,
|
||||
// icon: Icon(
|
||||
// Icons.phone_forwarded,
|
||||
// color: primaryColor,
|
||||
// ),
|
||||
// labelKey: "contact.delivery.phone",
|
||||
// ),
|
||||
// emailBox,
|
||||
// faceBookBox,
|
||||
// googleBox,
|
||||
// LocalTextField(
|
||||
// textEditingController: _address,
|
||||
// icon: Icon(
|
||||
// Icons.location_on,
|
||||
// color: primaryColor,
|
||||
// ),
|
||||
// labelKey: "contact.address",
|
||||
// maxLines: 3,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
_save(String phone) {
|
||||
if (phone == null) return;
|
||||
setState(() {
|
||||
this.phones.add(phone);
|
||||
});
|
||||
}
|
||||
|
||||
_submit() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
widget.setting.emailAddress = _email.text;
|
||||
widget.setting.facebookLink = _facebook.text;
|
||||
widget.setting.website = _website.text;
|
||||
widget.setting.phones = this.phones;
|
||||
widget.setting.address = _address.text;
|
||||
widget.setting.deliveryPhone = _deliveryPhone.text;
|
||||
var mainModel = Provider.of<MainModel>(context);
|
||||
// await mainModel.updateContact(widget.setting);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
105
lib/fcs/common/pages/faq/faq_detail_page.dart
Normal file
105
lib/fcs/common/pages/faq/faq_detail_page.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
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/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact/contact_editor.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/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class FAQDetailPage extends StatelessWidget {
|
||||
final FAQ faq;
|
||||
|
||||
const FAQDetailPage({Key key, this.faq}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(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.btn'),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => ContactEditor(
|
||||
contact: Contact.fromSetting(setting),
|
||||
),
|
||||
)),
|
||||
icon: Icon(
|
||||
CupertinoIcons.delete,
|
||||
color: Colors.white,
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => ContactEditor(
|
||||
contact: Contact.fromSetting(setting),
|
||||
),
|
||||
)),
|
||||
icon: Icon(
|
||||
CupertinoIcons.pen,
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
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) {
|
||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||
return TextLocalStyle(
|
||||
context,
|
||||
faq.question(isEng),
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget getAnwser(BuildContext context, FAQ faq) {
|
||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||
return TextLocalStyle(
|
||||
context,
|
||||
faq.answer(isEng),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w200,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
149
lib/fcs/common/pages/faq/faq_edit_page.dart
Normal file
149
lib/fcs/common/pages/faq/faq_edit_page.dart
Normal file
@@ -0,0 +1,149 @@
|
||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact/widgets.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/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
|
||||
class FAQEditor extends StatefulWidget {
|
||||
final FAQ faq;
|
||||
const FAQEditor({this.faq});
|
||||
@override
|
||||
_FAQEditorState createState() => _FAQEditorState();
|
||||
}
|
||||
|
||||
class _FAQEditorState extends State<FAQEditor> {
|
||||
TextEditingController _engQ = new TextEditingController();
|
||||
TextEditingController _mmQ = new TextEditingController();
|
||||
TextEditingController _engA = new TextEditingController();
|
||||
TextEditingController _mmA = new TextEditingController();
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isNew = widget.faq == null;
|
||||
if (widget.faq != null) {
|
||||
_engQ.text = widget.faq.questionEng;
|
||||
_mmQ.text = widget.faq.questionMm;
|
||||
_engA.text = widget.faq.answerEng;
|
||||
_mmA.text = widget.faq.answerMm;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final usaPhoneBox = InputText(
|
||||
iconData: SimpleLineIcons.question,
|
||||
controller: _engQ,
|
||||
maxLines: 2,
|
||||
withBorder: true,
|
||||
);
|
||||
final mmPhoneBox = InputText(
|
||||
iconData: MaterialCommunityIcons.message_reply_text,
|
||||
controller: _mmQ,
|
||||
maxLines: 5,
|
||||
withBorder: true,
|
||||
);
|
||||
final usaAddreesBox = InputText(
|
||||
iconData: SimpleLineIcons.question,
|
||||
controller: _engA,
|
||||
maxLines: 2,
|
||||
withBorder: true,
|
||||
);
|
||||
final mmAddressBox = InputText(
|
||||
iconData: MaterialCommunityIcons.message_reply_text,
|
||||
controller: _mmA,
|
||||
maxLines: 5,
|
||||
withBorder: true,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: CupertinoPageScaffold(
|
||||
child: 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(_isNew?'faq.add.title':'faq.edit.title'),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => _submit(),
|
||||
icon: Icon(
|
||||
Icons.save,
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
body: Material(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||
children: <Widget>[
|
||||
itemTitle(context, "faq.edit.eng"),
|
||||
subItemTitle(context, "faq.edit.question"),
|
||||
usaPhoneBox,
|
||||
subItemTitle(context, "faq.edit.answer"),
|
||||
mmPhoneBox,
|
||||
Divider(),
|
||||
itemTitle(context, "faq.edit.mm"),
|
||||
subItemTitle(context, "faq.edit.question"),
|
||||
usaAddreesBox,
|
||||
subItemTitle(context, "faq.edit.answer"),
|
||||
mmAddressBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
))));
|
||||
}
|
||||
|
||||
_submit() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
widget.faq.questionEng = _engQ.text;
|
||||
// var contactModel = Provider.of<ContactModel>(context, listen: false);
|
||||
// await contactModel.saveContact(widget.contact);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
124
lib/fcs/common/pages/faq/faq_page.dart
Normal file
124
lib/fcs/common/pages/faq/faq_page.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
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/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_edit_page.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/widgets/local_text.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:flutter/cupertino.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:url_launcher/url_launcher.dart';
|
||||
|
||||
class FAQPage extends StatefulWidget {
|
||||
@override
|
||||
_FAQPageState createState() => _FAQPageState();
|
||||
}
|
||||
|
||||
class _FAQPageState extends State<FAQPage> {
|
||||
List<FAQ> faqs = [];
|
||||
@override
|
||||
void 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
|
||||
Widget build(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) {
|
||||
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => FAQDetailPage(
|
||||
faq: faq,
|
||||
),
|
||||
));
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
TextLocalStyle(
|
||||
context,
|
||||
faq.question(isEng),
|
||||
fontSize: 16,
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
CupertinoIcons.right_chevron,
|
||||
color: primaryColor,
|
||||
size: 22,
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
17
lib/fcs/common/pages/faq/model/faq_model.dart
Normal file
17
lib/fcs/common/pages/faq/model/faq_model.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||
import 'package:fcs/fcs/common/services/services.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class FAQModel extends BaseModel {
|
||||
final log = Logger('FAQModel');
|
||||
|
||||
Future<void> addFAQ(FAQ faq) async {
|
||||
await request("/faq", "POST",
|
||||
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/pages/faq/faq_page.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/widgets/action_button.dart';
|
||||
@@ -74,6 +75,12 @@ class _HomePageState extends State<HomePage> {
|
||||
var customer = Provider.of<MainModel>(context).isCustomer();
|
||||
LanguageModel languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
final faqBtn = _buildBtn("faq.btn",
|
||||
icon: MaterialCommunityIcons.frequently_asked_questions,
|
||||
btnCallback: () => Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => FAQPage(),
|
||||
)));
|
||||
|
||||
final packagesBtn = _buildBtn("package.name",
|
||||
icon: Octicons.package,
|
||||
btnCallback: () =>
|
||||
@@ -161,6 +168,7 @@ class _HomePageState extends State<HomePage> {
|
||||
Navigator.of(context).push(BottomUpPageRoute(DeliverList())));
|
||||
|
||||
List<Widget> widgets = [];
|
||||
widgets.add(faqBtn);
|
||||
customer ? widgets.add(buyingBtn) : "";
|
||||
customer || owner ? widgets.add(pickUpBtn) : "";
|
||||
owner ? widgets.add(shipmentBtn) : "";
|
||||
@@ -294,7 +302,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
]),
|
||||
),
|
||||
BottomWidgets(),
|
||||
BottomWidgets(),
|
||||
],
|
||||
))),
|
||||
),
|
||||
@@ -302,7 +310,7 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
|
||||
_langChange(index) {
|
||||
var languageModel = Provider.of<LanguageModel>(context,listen: false);
|
||||
var languageModel = Provider.of<LanguageModel>(context, listen: false);
|
||||
languageModel.saveLanguage(Translation().supportedLanguages[index]);
|
||||
setState(() {
|
||||
isSelected.asMap().forEach((i, e) {
|
||||
@@ -314,6 +322,7 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
Widget _buildBtn(String title,
|
||||
{Image imgIcon, IconData icon, BtnCallback btnCallback}) {
|
||||
return ActionButton(title: title,imgIcon: imgIcon,icon:icon,btnCallback: btnCallback);
|
||||
return ActionButton(
|
||||
title: title, imgIcon: imgIcon, icon: icon, btnCallback: btnCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ abstract class BaseModel extends ChangeNotifier {
|
||||
this.setting = setting;
|
||||
}
|
||||
|
||||
void logout();
|
||||
void logout(){
|
||||
|
||||
}
|
||||
|
||||
// request makes http request
|
||||
// if token is null
|
||||
|
||||
@@ -113,7 +113,10 @@ class MainModel extends ChangeNotifier {
|
||||
|
||||
Future<void> _loadSetting() async {
|
||||
try {
|
||||
this.setting = await Services.instance.authService.getSetting();
|
||||
Services.instance.authService.getSetting().listen((event) {
|
||||
this.setting = event;
|
||||
notifyListeners();
|
||||
});
|
||||
} finally {}
|
||||
// _initSetting(setting);
|
||||
}
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||
import 'package:fcs/fcs/common/pages/term_edit.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.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/pages/util.dart';
|
||||
import 'package:zefyr/zefyr.dart';
|
||||
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
class Term extends StatefulWidget {
|
||||
final bool agreePage;
|
||||
|
||||
const Term({Key key, this.agreePage = false}) : super(key: key);
|
||||
@override
|
||||
_TermState createState() => _TermState();
|
||||
}
|
||||
|
||||
class _TermState extends State<Term> {
|
||||
ZefyrController _controller;
|
||||
FocusNode _focusNode;
|
||||
NotusDocument document = new NotusDocument();
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = ZefyrController(_loadDocument());
|
||||
print("controller terms => ${_controller.document}");
|
||||
_focusNode = FocusNode();
|
||||
}
|
||||
|
||||
NotusDocument _loadDocument() {
|
||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||
String term = mainModel.setting.terms;
|
||||
print("terms => $term");
|
||||
NotusDocument doc;
|
||||
try {
|
||||
doc = NotusDocument.fromJson(jsonDecode(term));
|
||||
print('doc=> $doc');
|
||||
} catch (e) {}
|
||||
if (doc == null) {
|
||||
doc = NotusDocument();
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
|
||||
bool isOwnerAndAbove =
|
||||
mainModel.user != null && mainModel.user.isOwnerAndAbove();
|
||||
bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
|
||||
|
||||
// bool aggreed = mainModel.user.agreeTerms;
|
||||
bool aggreed = true;
|
||||
|
||||
final agreeBtn = Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Card(
|
||||
elevation: 10,
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
child: ButtonTheme(
|
||||
minWidth: 900.0,
|
||||
height: 100.0,
|
||||
child: FlatButton.icon(
|
||||
onPressed: () {
|
||||
showConfirmDialog(context, "term.iagree", () async {
|
||||
_agree();
|
||||
});
|
||||
},
|
||||
label: LocalText(context, "term.agree_btn"),
|
||||
icon: Icon(
|
||||
Icons.check,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
// automaticallyImplyLeading: !widget.agreePage,
|
||||
title: LocalText(context, 'term', color: Colors.white, fontSize: 20),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[
|
||||
// isOwnerAndAbove || hasAdmin
|
||||
// ?
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => TermEdit((data) {
|
||||
setState(() {
|
||||
_controller = ZefyrController(data);
|
||||
});
|
||||
})),
|
||||
);
|
||||
// print('doc=> $doc');
|
||||
|
||||
// setState(() {
|
||||
// document = doc;
|
||||
// });
|
||||
// var document = await
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => TermEdit()),
|
||||
// );
|
||||
},
|
||||
)
|
||||
// : Container()
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Card(
|
||||
child: ZefyrTheme(
|
||||
data: ZefyrThemeData().copyWith(),
|
||||
child: ZefyrScaffold(
|
||||
child: ZefyrEditor(
|
||||
mode: ZefyrMode.view,
|
||||
padding: EdgeInsets.all(16),
|
||||
controller: _controller,
|
||||
focusNode: _focusNode,
|
||||
),
|
||||
))),
|
||||
)),
|
||||
!aggreed ? agreeBtn : Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_agree() async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
try {
|
||||
// MainModel mainModel = Provider.of<MainModel>(context);
|
||||
// await mainModel.agreeTerms();
|
||||
// if (widget.agreePage) {
|
||||
// Future.delayed(const Duration(milliseconds: 3000), () {
|
||||
// Navigator.pop(context);
|
||||
// });
|
||||
// }
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
17
lib/fcs/common/pages/term/model/term_model.dart
Normal file
17
lib/fcs/common/pages/term/model/term_model.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fcs/fcs/common/domain/vo/term.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/base_model.dart';
|
||||
import 'package:fcs/fcs/common/services/services.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class TermModel extends BaseModel {
|
||||
final log = Logger('TermModel');
|
||||
|
||||
Future<void> saveTerm(Term term) async {
|
||||
await request("/terms", "PUT",
|
||||
payload: term.toMap(), token: await Services.instance.authService.getToken());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,23 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:fcs/fcs/common/domain/vo/term.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/pages/term/model/term_model.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/fcs/common/pages/util.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:zefyr/zefyr.dart';
|
||||
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
class TermEdit extends StatefulWidget {
|
||||
final ValueChanged onChangedData;
|
||||
TermEdit(this.onChangedData);
|
||||
final Term term;
|
||||
TermEdit({this.term});
|
||||
@override
|
||||
_TermEditState createState() => _TermEditState();
|
||||
}
|
||||
@@ -40,12 +43,9 @@ class _TermEditState extends State<TermEdit> {
|
||||
|
||||
/// Loads the document to be edited in Zefyr.
|
||||
NotusDocument _loadDocument() {
|
||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||
String term = mainModel.setting.terms;
|
||||
|
||||
NotusDocument doc;
|
||||
try {
|
||||
doc = NotusDocument.fromJson(jsonDecode(term));
|
||||
doc = NotusDocument.fromJson(jsonDecode(widget.term.term));
|
||||
} catch (e) {}
|
||||
if (doc == null) {
|
||||
doc = NotusDocument();
|
||||
@@ -55,31 +55,21 @@ class _TermEditState extends State<TermEdit> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
|
||||
var singleChildScrollView = SingleChildScrollView(
|
||||
padding: EdgeInsets.only(
|
||||
left: 25.0,
|
||||
right: 25.0,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 300,
|
||||
height: 300,
|
||||
child: Card(child: Markdown(data: mainModel.setting.terms))),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"Terms",
|
||||
title: LocalLargeTitle(
|
||||
context,
|
||||
"term",
|
||||
color: Colors.white,
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
CupertinoIcons.back,
|
||||
size: 30,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[
|
||||
@@ -105,16 +95,15 @@ class _TermEditState extends State<TermEdit> {
|
||||
);
|
||||
}
|
||||
|
||||
_save() {
|
||||
_save() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
try {
|
||||
final contents = jsonEncode(_controller.document);
|
||||
print('contents => $contents');
|
||||
widget.onChangedData(_controller.document);
|
||||
// MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||
// mainModel.updateTerms(contents);
|
||||
TermModel termModel = Provider.of<TermModel>(context, listen: false);
|
||||
await termModel.saveTerm(Term(term: contents));
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
} finally {
|
||||
107
lib/fcs/common/pages/term/term_page.dart
Normal file
107
lib/fcs/common/pages/term/term_page.dart
Normal file
@@ -0,0 +1,107 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||||
import 'package:fcs/fcs/common/domain/vo/term.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||||
import 'package:fcs/fcs/common/pages/term/term_edit.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:zefyr/zefyr.dart';
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
class TermPage extends StatefulWidget {
|
||||
const TermPage({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
@override
|
||||
_TermPageState createState() => _TermPageState();
|
||||
}
|
||||
|
||||
class _TermPageState extends State<TermPage> {
|
||||
ZefyrController _controller;
|
||||
FocusNode _focusNode;
|
||||
NotusDocument document = new NotusDocument();
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_focusNode = FocusNode();
|
||||
}
|
||||
|
||||
NotusDocument _loadDocument(Setting setting) {
|
||||
String term = setting.terms;
|
||||
NotusDocument doc;
|
||||
try {
|
||||
doc = NotusDocument.fromJson(jsonDecode(term));
|
||||
} catch (e) {}
|
||||
if (doc == null) {
|
||||
doc = NotusDocument();
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Setting setting = Provider.of<MainModel>(context).setting;
|
||||
return CupertinoPageScaffold(
|
||||
child: 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: LocalLargeTitle(
|
||||
context,
|
||||
"term",
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
TermEdit(term: Term.fromSetting(setting)),
|
||||
)),
|
||||
icon: Icon(
|
||||
CupertinoIcons.pen,
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
body: ZefyrTheme(
|
||||
data: ZefyrThemeData().copyWith(
|
||||
defaultLineTheme: LineTheme(
|
||||
textStyle: TextStyle(color: Colors.black),
|
||||
padding: EdgeInsets.all(0))),
|
||||
child: ZefyrScaffold(
|
||||
child: ZefyrEditor(
|
||||
mode: ZefyrMode.view,
|
||||
padding: EdgeInsets.all(16),
|
||||
controller: ZefyrController(_loadDocument(setting)),
|
||||
focusNode: _focusNode,
|
||||
),
|
||||
))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/label_widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
@@ -14,7 +15,6 @@ import 'package:fcs/model/user_model.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/vo/buyer.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/vo/notification.dart' as Noti;
|
||||
|
||||
import '../../../pages/announcement.dart';
|
||||
@@ -578,3 +578,8 @@ Widget fcsButton(BuildContext context, String text, {Function callack}) {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
String getLocalString(BuildContext context,String key){
|
||||
return AppTranslations.of(context).text(key);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:fcs/fcs/common/pages/contact.dart';
|
||||
import 'package:fcs/fcs/common/pages/term.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/fcs/common/pages/contact/contact_page.dart';
|
||||
import 'package:fcs/fcs/common/pages/term/term_page.dart';
|
||||
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@@ -16,25 +15,26 @@ class BottomWidgets extends StatelessWidget {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => Contact(),
|
||||
builder: (context) => ContactPage(),
|
||||
));
|
||||
},
|
||||
child: _buildSmallButton("Contact Us", SimpleLineIcons.support),
|
||||
child: _buildSmallButton(
|
||||
context, "contact.btn", SimpleLineIcons.support),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => Term(),
|
||||
builder: (context) => TermPage(),
|
||||
));
|
||||
},
|
||||
child: _buildSmallButton("Terms of service", Icons.info_outline),
|
||||
child: _buildSmallButton(context, "term.btn", Icons.info_outline),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSmallButton(String text, IconData iconData) {
|
||||
Widget _buildSmallButton(
|
||||
BuildContext context, String textKey, IconData iconData) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: Row(
|
||||
@@ -44,10 +44,7 @@ class BottomWidgets extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(right: 5),
|
||||
child: Icon(iconData, color: Colors.white70, size: 20),
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: subMenuStyle,
|
||||
)
|
||||
LocalText(context, textKey, color: Colors.white70)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
64
lib/fcs/common/pages/widgets/input_text.dart
Normal file
64
lib/fcs/common/pages/widgets/input_text.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||||
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class InputText extends StatelessWidget {
|
||||
final String labelTextKey;
|
||||
final IconData iconData;
|
||||
final TextEditingController controller;
|
||||
final FormFieldValidator<String> validator;
|
||||
final int maxLines;
|
||||
final bool withBorder;
|
||||
final Color borderColor;
|
||||
|
||||
const InputText(
|
||||
{Key key,
|
||||
this.labelTextKey,
|
||||
this.iconData,
|
||||
this.controller,
|
||||
this.validator,
|
||||
this.maxLines = 1,
|
||||
this.withBorder = false,
|
||||
this.borderColor})
|
||||
: super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 15.0, bottom: 5),
|
||||
child: TextFormField(
|
||||
controller: controller,
|
||||
autofocus: false,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
maxLines: maxLines,
|
||||
decoration: new InputDecoration(
|
||||
labelText:labelTextKey==null?null: AppTranslations.of(context).text(labelTextKey),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
icon: iconData == null
|
||||
? null
|
||||
: Icon(
|
||||
iconData,
|
||||
color: primaryColor,
|
||||
),
|
||||
enabledBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: validator),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||
|
||||
|
||||
class LocalText extends Text {
|
||||
final BuildContext context;
|
||||
LocalText(this.context, String translationKey,
|
||||
@@ -28,3 +27,30 @@ class LocalText extends Text {
|
||||
fontWeight: fontWeight,
|
||||
underline: underline));
|
||||
}
|
||||
|
||||
class LocalLargeTitle extends Text {
|
||||
final BuildContext context;
|
||||
LocalLargeTitle(
|
||||
this.context,
|
||||
String translationKey, {
|
||||
Color color,
|
||||
List<String> translationVariables,
|
||||
}) : super(
|
||||
AppTranslations.of(context).text(translationKey,
|
||||
translationVariables: translationVariables),
|
||||
style: Provider.of<LanguageModel>(context).isEng
|
||||
? TextStyle(color: color)
|
||||
: TextStyle(color: color, fontFamily: "MyanmarUnicode"));
|
||||
}
|
||||
|
||||
class TextLocalStyle extends Text {
|
||||
final BuildContext context;
|
||||
TextLocalStyle(this.context, String text, {Color color, double fontSize,FontWeight fontWeight})
|
||||
: super(text,
|
||||
style: Provider.of<LanguageModel>(context).isEng
|
||||
? TextStyle(color: color, fontSize: fontSize,fontWeight: fontWeight)
|
||||
: TextStyle(
|
||||
color: color,
|
||||
fontFamily: "MyanmarUnicode",
|
||||
fontSize: fontSize,fontWeight: fontWeight));
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ class AuthServiceImp implements AuthService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Setting> getSetting() {
|
||||
return authFb.getSetting();
|
||||
Stream<Setting> getSetting() {
|
||||
return authFb.settings();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,4 +56,9 @@ class AuthServiceImp implements AuthService {
|
||||
Stream<User> onAuthStatus() {
|
||||
return authFb.onAuthStatus;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> getToken() {
|
||||
return authFb.getToken();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ abstract class AuthService {
|
||||
Future<void> signout();
|
||||
Future<User> getUser({bool refreshIdToken = false});
|
||||
Future<User> signup(String userName);
|
||||
Future<Setting> getSetting();
|
||||
Stream<Setting> getSetting();
|
||||
Stream<User> onAuthStatus();
|
||||
Future<String> getToken();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() {
|
||||
Config(
|
||||
flavor: Flavor.DEV,
|
||||
color: Colors.blue,
|
||||
apiURL: "http://192.168.100.11:7777",
|
||||
apiURL: "http://192.168.1.155:7777",
|
||||
level: Level.ALL);
|
||||
runApp(App());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user