2020-10-18 02:38:46 +06:30
|
|
|
import 'package:fcs/domain/entities/carton.dart';
|
2020-10-19 05:13:49 +06:30
|
|
|
import 'package:fcs/domain/entities/discount.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/pages/discount/discount_editor.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/main/util.dart';
|
2020-10-14 13:54:42 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-06-26 16:17:40 +06:30
|
|
|
import 'package:flutter/material.dart';
|
2020-10-19 05:13:49 +06:30
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
2020-06-26 16:17:40 +06:30
|
|
|
import 'package:intl/intl.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
|
2020-10-22 04:14:53 +06:30
|
|
|
typedef OnSelect(Discount discount);
|
|
|
|
|
|
2020-10-21 02:59:10 +06:30
|
|
|
class DiscountListRow extends StatelessWidget {
|
2020-10-22 04:14:53 +06:30
|
|
|
final OnSelect onSelect;
|
2020-10-19 05:13:49 +06:30
|
|
|
final Discount discount;
|
2020-10-22 04:14:53 +06:30
|
|
|
DiscountListRow({Key key, this.discount, this.onSelect}) : super(key: key);
|
2020-06-26 16:17:40 +06:30
|
|
|
|
|
|
|
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-19 05:13:49 +06:30
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
2020-10-22 04:14:53 +06:30
|
|
|
if (onSelect != null) {
|
|
|
|
|
onSelect(discount);
|
|
|
|
|
}
|
2020-10-19 05:13:49 +06:30
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
2020-06-26 16:17:40 +06:30
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
|
|
|
|
child: new Row(
|
|
|
|
|
children: <Widget>[
|
2020-10-19 05:13:49 +06:30
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 5, right: 10),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Entypo.price_ribbon,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
size: 30,
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-26 16:17:40 +06:30
|
|
|
new Expanded(
|
|
|
|
|
child: new Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
2020-10-21 02:59:10 +06:30
|
|
|
discount.code ?? "",
|
2020-06-26 16:17:40 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
|
|
|
|
child: new Text(
|
2020-10-21 02:59:10 +06:30
|
|
|
discount.customerName ?? "",
|
2020-06-26 16:17:40 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(0),
|
2020-10-21 02:59:10 +06:30
|
|
|
child: Text(discount.status),
|
2020-06-26 16:17:40 +06:30
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Text(
|
2020-10-21 02:59:10 +06:30
|
|
|
"${discount.amount ?? ''}",
|
2020-06-26 16:17:40 +06:30
|
|
|
style:
|
|
|
|
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|