This commit is contained in:
Phaung Phaung
2021-09-10 12:02:08 +06:30
parent a144c945b6
commit c06ae00b68
35 changed files with 190 additions and 223 deletions

View File

@@ -5,15 +5,14 @@ import 'package:fcs/pages/discount/discount_editor.dart';
import 'package:fcs/pages/main/util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart';
typedef OnSelect(Discount discount);
class DiscountListRow extends StatelessWidget {
final OnSelect onSelect;
final Discount discount;
DiscountListRow({Key key, this.discount, this.onSelect}) : super(key: key);
final OnSelect? onSelect;
final Discount? discount;
DiscountListRow({Key? key, this.discount, this.onSelect}) : super(key: key);
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@@ -21,8 +20,8 @@ class DiscountListRow extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (onSelect != null) {
onSelect(discount);
if (onSelect != null && discount != null) {
onSelect!(discount!);
}
},
child: Container(
@@ -49,7 +48,7 @@ class DiscountListRow extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
discount.code ?? "",
discount?.code ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
@@ -57,7 +56,7 @@ class DiscountListRow extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
discount.customerName ?? "",
discount?.customerName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
@@ -73,14 +72,14 @@ class DiscountListRow extends StatelessWidget {
children: <Widget>[
Padding(
padding: const EdgeInsets.all(0),
child: Text(discount.status),
child: Text(discount?.status ?? ''),
),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${discount.amount.toStringAsFixed(2) ?? ''}",
"${discount?.amount.toStringAsFixed(2) ?? ''}",
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),