Files
fcs/lib/pages/discount/discount_list_row.dart

88 lines
3.0 KiB
Dart
Raw Permalink Normal View History

2020-10-19 05:13:49 +06:30
import 'package:fcs/domain/entities/discount.dart';
import 'package:fcs/helpers/theme.dart';
2020-06-26 16:17:40 +06:30
import 'package:flutter/material.dart';
2021-09-10 14:29:55 +06:30
import 'package:flutter_vector_icons/flutter_vector_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 {
2021-09-10 12:02:08 +06:30
final OnSelect? onSelect;
2024-02-28 17:47:47 +06:30
final Discount discount;
DiscountListRow({Key? key, required 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: () {
2024-02-28 17:47:47 +06:30
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(
2024-02-28 17:47:47 +06:30
padding: const EdgeInsets.symmetric(vertical: 13),
2020-06-26 16:17:40 +06:30
child: new Row(
children: <Widget>[
2024-02-28 17:47:47 +06:30
Icon(Entypo.price_ribbon, color: primaryColor, size: 30),
2020-06-26 16:17:40 +06:30
new Expanded(
2024-02-28 17:47:47 +06:30
child: Padding(
padding: const EdgeInsets.only(left: 15),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
discount.code ?? "",
2020-06-26 16:17:40 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
2024-02-28 17:47:47 +06:30
Padding(
padding: const EdgeInsets.only(top: 5),
child: new Text(
discount.customerName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
)
],
),
2020-06-26 16:17:40 +06:30
),
),
],
),
),
),
Column(
2024-02-28 17:47:47 +06:30
crossAxisAlignment: CrossAxisAlignment.end,
2020-06-26 16:17:40 +06:30
children: <Widget>[
2024-03-01 17:27:56 +06:30
Text(discount.status ?? '',
style: TextStyle(
color: primaryColor,
fontSize: 15,
fontWeight: FontWeight.bold)),
2020-06-26 16:17:40 +06:30
Padding(
2024-03-01 17:27:56 +06:30
padding: const EdgeInsets.only(top: 5),
2020-06-26 16:17:40 +06:30
child: Row(
children: <Widget>[
new Text(
2024-02-28 17:47:47 +06:30
"${discount.amount.toStringAsFixed(2)}",
2020-06-26 16:17:40 +06:30
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
],
),
),
],
)
],
),
),
);
}
}