add contact page
This commit is contained in:
@@ -279,7 +279,7 @@
|
|||||||
"document.by":"By",
|
"document.by":"By",
|
||||||
"document.desc":"Description",
|
"document.desc":"Description",
|
||||||
|
|
||||||
"contact.title":"Contacts",
|
"contact.title":"Contact Us",
|
||||||
"contact.phone.title":"Input Phone Number",
|
"contact.phone.title":"Input Phone Number",
|
||||||
"contact.phone":"Phone Number",
|
"contact.phone":"Phone Number",
|
||||||
"contact.phone.confim":"Call {0}?",
|
"contact.phone.confim":"Call {0}?",
|
||||||
@@ -295,7 +295,16 @@
|
|||||||
"contact.open.confrim":"Open '{0}'?",
|
"contact.open.confrim":"Open '{0}'?",
|
||||||
"contact.bank.accounts":"Bank Accounts Info",
|
"contact.bank.accounts":"Bank Accounts Info",
|
||||||
"contact.address":"Address",
|
"contact.address":"Address",
|
||||||
|
"contact.usa.address":"USA Address",
|
||||||
|
"contact.mm.address":"Myanmar Address",
|
||||||
"contact.delivery.phone":"Delivery Phone",
|
"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",
|
"term.title":"Terms",
|
||||||
"manual.title":"Manual",
|
"manual.title":"Manual",
|
||||||
|
|||||||
@@ -277,6 +277,8 @@
|
|||||||
"contact.title":"ဆက်သွယ်ရန်",
|
"contact.title":"ဆက်သွယ်ရန်",
|
||||||
"contact.phone.title":"ဖုန်းနံပါတ်ထည့်သွင်းရန်",
|
"contact.phone.title":"ဖုန်းနံပါတ်ထည့်သွင်းရန်",
|
||||||
"contact.phone":"ဖုန်းနံပါတ်",
|
"contact.phone":"ဖုန်းနံပါတ်",
|
||||||
|
"contact.usa.phone": "အမေရိကား ဖုန်းနံပါတ်",
|
||||||
|
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်",
|
||||||
"contact.phone.confim":"ဖုန်းနံပါတ် '{0}' ကို ခေါ်မလား?",
|
"contact.phone.confim":"ဖုန်းနံပါတ် '{0}' ကို ခေါ်မလား?",
|
||||||
"contact.phone.empty":"ကျေးဇူးပြု၍ ဖုန်းနံပါတ်ထည့်ပါ",
|
"contact.phone.empty":"ကျေးဇူးပြု၍ ဖုန်းနံပါတ်ထည့်ပါ",
|
||||||
"contact.email":"အီးမေးလ်",
|
"contact.email":"အီးမေးလ်",
|
||||||
@@ -291,7 +293,15 @@
|
|||||||
"contact.bank.accounts":"ဘဏ်အကောင့်အချက်အလက်",
|
"contact.bank.accounts":"ဘဏ်အကောင့်အချက်အလက်",
|
||||||
"contact.address":"လိပ်စာ",
|
"contact.address":"လိပ်စာ",
|
||||||
"contact.delivery.phone":"သီလဝါ ဆီထုတ် ဖုန်းနံပါတ်",
|
"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":"စည်းကမ်းချက်များ",
|
"term.title":"စည်းကမ်းချက်များ",
|
||||||
"manual.title":"လက်စွဲစာအုပ်",
|
"manual.title":"လက်စွဲစာအုပ်",
|
||||||
@@ -594,8 +604,6 @@
|
|||||||
|
|
||||||
"fcs.profile": "ပရိုဖိုင်",
|
"fcs.profile": "ပရိုဖိုင်",
|
||||||
|
|
||||||
"contact.usa.phone": "ယူအက်စ်အေ ဖုန်းနံပါတ်",
|
|
||||||
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်",
|
|
||||||
|
|
||||||
"payment.title": "ငွေပေးချေခြင်း",
|
"payment.title": "ငွေပေးချေခြင်း",
|
||||||
"payment.date": "ရက်စွဲ",
|
"payment.date": "ရက်စွဲ",
|
||||||
|
|||||||
26
lib/app.dart
26
lib/app.dart
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
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/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/model/language_model.dart';
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||||||
@@ -19,6 +20,7 @@ import 'package:fcs/model_fcs/message_model.dart';
|
|||||||
import 'package:fcs/model_fcs/package_model.dart';
|
import 'package:fcs/model_fcs/package_model.dart';
|
||||||
import 'package:fcs/pages/email_page.dart';
|
import 'package:fcs/pages/email_page.dart';
|
||||||
import 'package:fcs/pages/login_page.dart';
|
import 'package:fcs/pages/login_page.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@@ -242,11 +244,27 @@ class _AppState extends State<App> {
|
|||||||
ChangeNotifierProvider.value(value: testModel),
|
ChangeNotifierProvider.value(value: testModel),
|
||||||
ChangeNotifierProvider.value(value: mainModel2),
|
ChangeNotifierProvider.value(value: mainModel2),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: Consumer<LanguageModel>(
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return CupertinoApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'FCS',
|
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),
|
||||||
|
)),
|
||||||
routes: route(context),
|
routes: route(context),
|
||||||
theme: ThemeData(accentColor: Colors.black),
|
|
||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
_newLocaleDelegate,
|
_newLocaleDelegate,
|
||||||
//provides localised strings
|
//provides localised strings
|
||||||
@@ -254,6 +272,8 @@ class _AppState extends State<App> {
|
|||||||
//provides RTL support
|
//provides RTL support
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
],
|
],
|
||||||
supportedLocales: Translation().supportedLocales()));
|
supportedLocales: Translation().supportedLocales());
|
||||||
|
},
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
import 'package:fcs/fcs/common/domain/entities/setting.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/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/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/fcs/common/pages/widgets/progress.dart';
|
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
|
||||||
import 'package:fcs/fcs/common/pages/util.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:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
@@ -21,62 +24,86 @@ class _ContactState extends State<Contact> {
|
|||||||
@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 isEng = Provider.of<LanguageModel>(context).isEng;
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: CupertinoPageScaffold(
|
||||||
appBar: AppBar(
|
child: NestedScrollView(
|
||||||
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
|
return <Widget>[
|
||||||
|
CupertinoSliverNavigationBar(
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
elevation: 0,
|
actionsForegroundColor: Colors.white,
|
||||||
centerTitle: true,
|
largeTitle: Text(
|
||||||
leading: new IconButton(
|
AppTranslations.of(context).text('contact.title'),
|
||||||
icon: new Icon(Icons.close),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
),
|
),
|
||||||
title: LocalText(
|
trailing: GestureDetector(
|
||||||
context,
|
onTap: () =>
|
||||||
"contact",
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
fontSize: 25,
|
builder: (context) => ContactEditor(
|
||||||
|
setting: setting,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Icon(
|
||||||
|
CupertinoIcons.pen,
|
||||||
|
size: 23,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
itemTitle("contact.callus"),
|
||||||
link(setting.usaContactNumber, Icons.phone_forwarded,
|
link(setting.usaContactNumber, Icons.phone_forwarded,
|
||||||
onTap: () => _call(setting.usaContactNumber),
|
onTap: () => _call(setting.usaContactNumber),
|
||||||
label: LocalText(
|
label: LocalText(context, "contact.usa.phone",
|
||||||
context,
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
"contact.usa.phone",
|
|
||||||
color: primaryColor,
|
|
||||||
)),
|
|
||||||
link(setting.mmContactNumber, Icons.phone_forwarded,
|
link(setting.mmContactNumber, Icons.phone_forwarded,
|
||||||
onTap: () => _call(
|
onTap: () => _call(
|
||||||
setting.mmContactNumber,
|
setting.mmContactNumber,
|
||||||
),
|
),
|
||||||
label: LocalText(
|
label: LocalText(context, "contact.mm.phone",
|
||||||
context,
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
"contact.mm.phone",
|
itemTitle("contact.findus"),
|
||||||
color: primaryColor,
|
link(setting.usaAddress, Icons.location_on,
|
||||||
)),
|
label: LocalText(context, "contact.usa.address",
|
||||||
link(
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
setting.usaAddress,
|
link(setting.mmAddress, Icons.location_on,
|
||||||
Icons.location_on,
|
label: LocalText(context, "contact.mm.address",
|
||||||
),
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
link(setting.mmAddress, Icons.location_on),
|
itemTitle("contact.emailus"),
|
||||||
link(setting.emailAddress, Icons.email,
|
link(setting.emailAddress, Icons.email,
|
||||||
onTap: () => _email(setting.emailAddress)),
|
onTap: () => _email(setting.emailAddress),
|
||||||
|
label: LocalText(context, "contact.fcs.email",
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
|
itemTitle("contact.visitus"),
|
||||||
link(setting.facebookLink, FontAwesomeIcons.facebook,
|
link(setting.facebookLink, FontAwesomeIcons.facebook,
|
||||||
onTap: () => _openLink(setting.facebookLink)),
|
onTap: () => _openLink(setting.facebookLink),
|
||||||
|
label: LocalText(context, "contact.facebook",
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget link(String text, IconData iconData,
|
Widget link(String text, IconData iconData,
|
||||||
{Function() onTap, Widget label}) {
|
{Function() onTap, Widget label}) {
|
||||||
return Padding(
|
return Material(
|
||||||
padding: const EdgeInsets.only(left: 18.0, bottom: 5),
|
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(
|
child: InkWell(
|
||||||
onTap: () => onTap != null ? onTap() : null,
|
onTap: () => onTap != null ? onTap() : null,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@@ -87,6 +114,7 @@ class _ContactState extends State<Contact> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
iconData,
|
iconData,
|
||||||
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
@@ -104,7 +132,9 @@ class _ContactState extends State<Contact> {
|
|||||||
text == null ? "" : text,
|
text == null ? "" : text,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 5,
|
maxLines: 5,
|
||||||
style: TextStyle(fontSize: 14.0),
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -122,6 +152,19 @@ class _ContactState extends State<Contact> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,19 +175,14 @@ class _ContactState extends State<Contact> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_call(String phone) {
|
_call(String phone) {
|
||||||
showConfirmDialog(
|
launch("tel:$phone");
|
||||||
context, "contact.phone.confim", () => launch("tel:$phone"),
|
|
||||||
translationVariables: ["$phone"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_email(String email) {
|
_email(String email) {
|
||||||
showConfirmDialog(
|
launch("mailto:$email");
|
||||||
context, "contact.email.configm", () => launch("mailto:$email"),
|
|
||||||
translationVariables: ["$email"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_openLink(String link) {
|
_openLink(String link) {
|
||||||
showConfirmDialog(context, "contact.open.confrim", () => launch("$link"),
|
launch("$link");
|
||||||
translationVariables: ["$link"]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
297
lib/fcs/common/pages/contact_editor.dart
Normal file
297
lib/fcs/common/pages/contact_editor.dart
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'package:fcs/fcs/common/pages/contact.dart';
|
|||||||
import 'package:fcs/fcs/common/pages/term.dart';
|
import 'package:fcs/fcs/common/pages/term.dart';
|
||||||
import 'package:fcs/fcs/common/helpers/theme.dart';
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
@@ -14,13 +15,18 @@ class BottomWidgets extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(BottomUpPageRoute(Contact()));
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
|
fullscreenDialog: true,
|
||||||
|
builder: (context) => Contact(),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
child: _buildSmallButton("Contact Us", SimpleLineIcons.support),
|
child: _buildSmallButton("Contact Us", SimpleLineIcons.support),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(BottomUpPageRoute(Term()));
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||||
|
builder: (context) => Term(),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
child: _buildSmallButton("Terms of service", Icons.info_outline),
|
child: _buildSmallButton("Terms of service", Icons.info_outline),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user