null safety

This commit is contained in:
Phaung Phaung
2021-09-10 15:23:13 +06:30
parent 5c5e47b9ad
commit 376153e22f
14 changed files with 80 additions and 66 deletions

View File

@@ -37,11 +37,11 @@ class _DiscountEditorState extends State<DiscountEditor> {
super.initState();
if (widget.discount != null) {
_discount = widget.discount!;
_codeController.text = _discount.code;
_codeController.text = _discount.code ?? "";
_amountController.text = _discount.amount.toStringAsFixed(2);
_statusController.text = _discount.status;
customerName = _discount.customerName;
customerId = _discount.customerId;
_statusController.text = _discount.status ?? '';
customerName = _discount.customerName ?? "";
customerId = _discount.customerId ?? "";
} else {
_isNew = true;
}
@@ -77,8 +77,8 @@ class _DiscountEditorState extends State<DiscountEditor> {
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context, onUserSelect: (u) {
setState(() {
customerId = u.id;
customerName = u.name;
customerId = u.id ?? "";
customerName = u.name ?? "";
});
},popPage: true)),
],