fix errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/domain/entities/user.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/customer/customer_editor.dart';
|
||||
import 'package:fcs/pages/customer/model/customer_model.dart';
|
||||
import 'package:fcs/pages/invoice/invoice_editor.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
@@ -11,6 +11,10 @@ import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class InvoiceCustomerList extends StatefulWidget {
|
||||
final FcsShipment fcsShipment;
|
||||
|
||||
const InvoiceCustomerList({Key key, this.fcsShipment}) : super(key: key);
|
||||
|
||||
@override
|
||||
_InvoiceCustomerListState createState() => _InvoiceCustomerListState();
|
||||
}
|
||||
@@ -19,11 +23,24 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
|
||||
final double dotSize = 15.0;
|
||||
bool _isLoading = false;
|
||||
List<User> _users = [];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
_load() async {
|
||||
CustomerModel customerModel =
|
||||
Provider.of<CustomerModel>(context, listen: false);
|
||||
var users = await customerModel.getInvoiceUsers(widget.fcsShipment.id);
|
||||
setState(() {
|
||||
_users = users;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var customerModel = Provider.of<CustomerModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -51,9 +68,9 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: customerModel.customers.length,
|
||||
itemCount: _users.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
User customer = customerModel.customers[index];
|
||||
User customer = _users[index];
|
||||
return _item(customer);
|
||||
}),
|
||||
),
|
||||
@@ -67,7 +84,10 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => InvoiceEditor(customer: customer)));
|
||||
builder: (context) => InvoiceEditor(
|
||||
customer: customer,
|
||||
fcsShipment: widget.fcsShipment,
|
||||
)));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||
@@ -78,21 +98,18 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => _select(customer),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0, right: 10, top: 6, bottom: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(35.0))),
|
||||
child: Text(
|
||||
customer.initial,
|
||||
style: TextStyle(fontSize: 30, color: Colors.white),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0, right: 10, top: 6, bottom: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(35.0))),
|
||||
child: Text(
|
||||
customer.initial,
|
||||
style: TextStyle(fontSize: 30, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -113,7 +130,7 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2.0),
|
||||
child: new Text(
|
||||
customer.getLastMessage,
|
||||
customer.phoneNumber,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
@@ -140,9 +157,4 @@ class _InvoiceCustomerListState extends State<InvoiceCustomerList> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_select(User customer) {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => CustomerEditor(customer: customer)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user