add discount api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:fcs/domain/entities/discount.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
@@ -9,8 +9,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class DiscountByWeightEditor extends StatefulWidget {
|
||||
final Discount discount;
|
||||
DiscountByWeightEditor({this.discount});
|
||||
final DiscountByWeight discountByWeight;
|
||||
DiscountByWeightEditor({this.discountByWeight});
|
||||
|
||||
@override
|
||||
_DiscountByWeightEditorState createState() => _DiscountByWeightEditorState();
|
||||
@@ -21,15 +21,15 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
TextEditingController _rateController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
Discount _discount = new Discount();
|
||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.discount != null) {
|
||||
_discount = widget.discount;
|
||||
_weightController.text = _discount.weight.toString();
|
||||
_rateController.text = _discount.discountRate.toString();
|
||||
if (widget.discountByWeight != null) {
|
||||
_discountByWeight = widget.discountByWeight;
|
||||
_weightController.text = _discountByWeight.weight.toString();
|
||||
_rateController.text = _discountByWeight.discount.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.discount == null
|
||||
widget.discountByWeight == null
|
||||
? fcsButton(context, "Create", callack: () {})
|
||||
: fcsButton(context, "Save", callack: () {}),
|
||||
SizedBox(height: 10)
|
||||
|
||||
Reference in New Issue
Block a user