2020-06-02 14:52:31 +06:30
|
|
|
import 'package:fcs/model/customer_model.dart';
|
|
|
|
|
import 'package:fcs/pages/search_page.dart';
|
2020-06-02 15:30:11 +06:30
|
|
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
2020-06-29 16:15:25 +06:30
|
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
2020-06-02 14:52:31 +06:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:fcs/theme/theme.dart';
|
|
|
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
|
|
|
|
|
|
import '../theme/theme.dart';
|
|
|
|
|
import '../vo/user.dart';
|
|
|
|
|
import '../widget/local_text.dart';
|
|
|
|
|
import 'customer_editor.dart';
|
2020-06-29 16:15:25 +06:30
|
|
|
import 'invitation_page.dart';
|
|
|
|
|
import 'util.dart';
|
2020-06-02 14:52:31 +06:30
|
|
|
|
|
|
|
|
class CustomerList extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_CustomerListState createState() => _CustomerListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CustomerListState extends State<CustomerList> {
|
|
|
|
|
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
|
|
|
|
|
final double dotSize = 15.0;
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var customerModel = Provider.of<CustomerModel>(context);
|
|
|
|
|
|
|
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(Icons.close),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
iconSize: 30,
|
|
|
|
|
onPressed: () => showPlacesSearch(context),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
title: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
'customer.list.title',
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-29 16:15:25 +06:30
|
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).push(BottomUpPageRoute(InvitationPage()));
|
|
|
|
|
},
|
|
|
|
|
icon: Icon(Icons.add),
|
|
|
|
|
label: Text(AppTranslations.of(context).text("customer.invite")),
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
),
|
2020-06-02 14:52:31 +06:30
|
|
|
body: new ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => Divider(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: customerModel.customers.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
User user = customerModel.customers[index];
|
|
|
|
|
return Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
2020-06-02 15:30:11 +06:30
|
|
|
Navigator.of(context).push(
|
|
|
|
|
BottomUpPageRoute(CustomerEditor(customer: user)));
|
2020-06-02 14:52:31 +06:30
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
|
|
|
|
child: new Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Padding(
|
|
|
|
|
padding: new EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 32.0 - dotSize / 2),
|
|
|
|
|
child: Icon(
|
2020-06-03 00:42:31 +06:30
|
|
|
Feather.user,
|
2020-06-02 14:52:31 +06:30
|
|
|
color: primaryColor,
|
|
|
|
|
size: 40,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
new Expanded(
|
|
|
|
|
child: new Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Text(
|
|
|
|
|
user.name,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(top: 8.0),
|
|
|
|
|
child: new Text(
|
|
|
|
|
user.phoneNumber,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-29 16:15:25 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 10),
|
|
|
|
|
child: getStatus(user.status),
|
|
|
|
|
),
|
2020-06-02 14:52:31 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|