update invoice
This commit is contained in:
86
lib/pages/rates/custom_list.dart
Normal file
86
lib/pages/rates/custom_list.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:fcs/domain/entities/custom.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_editor.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/rates/custom_editor.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'custom_row.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CustomList extends StatefulWidget {
|
||||
const CustomList({Key key}) : super(key: key);
|
||||
@override
|
||||
_CustomListState createState() => _CustomListState();
|
||||
}
|
||||
|
||||
class _CustomListState extends State<CustomList> {
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
"Customs",
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (c, i) => Divider(
|
||||
color: primaryColor,
|
||||
),
|
||||
itemCount: shipmentRateModel.customs.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _row(context, shipmentRateModel.customs[index]);
|
||||
}),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
_row(BuildContext context, Custom custom) {
|
||||
return InkWell(
|
||||
onTap: () => Navigator.pop<Custom>(context, custom),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomRow(
|
||||
key: ValueKey(custom.id),
|
||||
custom: custom,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
66
lib/pages/rates/custom_row.dart
Normal file
66
lib/pages/rates/custom_row.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:fcs/domain/entities/custom.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
|
||||
typedef SelectionCallback(Custom custom);
|
||||
|
||||
class CustomRow extends StatelessWidget {
|
||||
final Custom custom;
|
||||
final SelectionCallback selectionCallback;
|
||||
const CustomRow(
|
||||
{Key key, this.custom, this.selectionCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: selectionCallback == null
|
||||
? null
|
||||
: () => this.selectionCallback(custom),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
line(context, custom.productType,
|
||||
iconData: MaterialCommunityIcons.account,
|
||||
color: primaryColor,
|
||||
fontSize: 16),
|
||||
line(context, custom.fee.toString(),
|
||||
iconData: Icons.phone, color: primaryColor, fontSize: 16),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget line(BuildContext context, String text,
|
||||
{IconData iconData, Color color, double fontSize}) {
|
||||
return Row(
|
||||
children: [
|
||||
iconData == null
|
||||
? SizedBox(width: 40)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8),
|
||||
child: Icon(iconData, color: Colors.black38),
|
||||
),
|
||||
Flexible(
|
||||
child: TextLocalStyle(
|
||||
context,
|
||||
text ?? "",
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user