modify
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
import 'package:fcs/widget/label_widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
@@ -9,8 +11,6 @@ import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import 'contact_editor.dart';
|
||||
|
||||
class Contact extends StatefulWidget {
|
||||
@override
|
||||
_ContactState createState() => _ContactState();
|
||||
@@ -21,71 +21,56 @@ class _ContactState extends State<Contact> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
bool isOwner = mainModel.user != null && mainModel.user.isOwner();
|
||||
bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
|
||||
var pickupModel = Provider.of<PickUpModel>(context, listen: false);
|
||||
|
||||
// MainModel mainModel = Provider.of<MainModel>(context);
|
||||
// bool isOwner = mainModel.user != null && mainModel.user.isOwner();
|
||||
// bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
iconTheme: IconThemeData(
|
||||
color: Colors.grey,
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: Image(
|
||||
height: 30,
|
||||
fit: BoxFit.scaleDown,
|
||||
image: new AssetImage('assets/img/logo.png')),
|
||||
actions: <Widget>[
|
||||
isOwner || hasAdmin
|
||||
? IconButton(
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
ContactEditor(setting: mainModel.setting)),
|
||||
);
|
||||
},
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: LocalText(
|
||||
context,
|
||||
"contact",
|
||||
fontSize: 25,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 5.0, bottom: 5),
|
||||
child: LocalText(
|
||||
context,
|
||||
"contact.title",
|
||||
fontSize: 25,
|
||||
)),
|
||||
link(pickupModel.profile.usaContactNumber, Icons.phone_forwarded,
|
||||
onTap: () => _call(pickupModel.profile.usaContactNumber),
|
||||
label: LocalText(
|
||||
context,
|
||||
"contact.usa.phone",
|
||||
color: primaryColor,
|
||||
)),
|
||||
link(pickupModel.profile.mmContactNumber, Icons.phone_forwarded,
|
||||
onTap: () => _call(
|
||||
pickupModel.profile.mmContactNumber,
|
||||
),
|
||||
label: LocalText(
|
||||
context,
|
||||
"contact.mm.phone",
|
||||
color: primaryColor,
|
||||
)),
|
||||
link(
|
||||
pickupModel.profile.usaAddress,
|
||||
Icons.location_on,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children:
|
||||
List.generate(mainModel.setting.phones.length, (index) {
|
||||
return link(mainModel.setting.phones[index], Icons.phone,
|
||||
onTap: () => _call(mainModel.setting.phones[index]));
|
||||
}),
|
||||
),
|
||||
),
|
||||
link(mainModel.setting.deliveryPhone, Icons.phone_forwarded,
|
||||
onTap: () => _call(mainModel.setting.deliveryPhone),
|
||||
label: LocalText(context, "contact.delivery.phone")),
|
||||
link(mainModel.setting.email, Icons.email,
|
||||
onTap: () => _email(mainModel.setting.email)),
|
||||
link(mainModel.setting.facebook, FontAwesomeIcons.facebook,
|
||||
onTap: () => _openLink(mainModel.setting.facebook)),
|
||||
link(mainModel.setting.website, FontAwesomeIcons.chrome,
|
||||
onTap: () => _openLink(mainModel.setting.website)),
|
||||
link(mainModel.setting.address, Icons.location_on),
|
||||
link(pickupModel.profile.mmAddress, Icons.location_on),
|
||||
link(pickupModel.profile.mail, Icons.email,
|
||||
onTap: () => _email(pickupModel.profile.mail)),
|
||||
link(pickupModel.profile.facebook, FontAwesomeIcons.facebook,
|
||||
onTap: () => _openLink(pickupModel.profile.facebook)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -106,17 +91,25 @@ class _ContactState extends State<Contact> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
iconData,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
label == null ? Container() : label,
|
||||
Text(
|
||||
text == null ? "" : text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 5,
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user