price round fix
parent
410f162eed
commit
8d162bf19b
|
|
@ -18,7 +18,7 @@ import 'package:satu/views/work/tabs/component/product_list_item.dart';
|
||||||
import 'package:satu/widgets/bar/products_app_bar.dart';
|
import 'package:satu/widgets/bar/products_app_bar.dart';
|
||||||
import 'package:satu/widgets/bar/products_header_bar.dart';
|
import 'package:satu/widgets/bar/products_header_bar.dart';
|
||||||
import 'package:satu/widgets/bar/products_title_bar.dart';
|
import 'package:satu/widgets/bar/products_title_bar.dart';
|
||||||
import 'package:satu/views/work/tabs/utils/ProductUtils.dart';
|
import 'package:satu/views/work/tabs/utils/product_utils.dart';
|
||||||
|
|
||||||
import 'component/contagent_select_bar.dart';
|
import 'component/contagent_select_bar.dart';
|
||||||
|
|
||||||
|
|
@ -39,12 +39,15 @@ class SellView extends StatelessWidget {
|
||||||
sum: sumProducts(state.items!),
|
sum: sumProducts(state.items!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: Column(
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
children: [
|
children: [
|
||||||
const ContragentSelectBar(
|
const ContragentSelectBar(
|
||||||
value: 'Частное лицо',
|
value: 'Частное лицо',
|
||||||
),
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
children: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: state.items!.isNotEmpty,
|
visible: state.items!.isNotEmpty,
|
||||||
child: const ProductsTitleBarBar(
|
child: const ProductsTitleBarBar(
|
||||||
|
|
@ -79,6 +82,9 @@ class SellView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
FloatingActionButtonLocation.centerDocked,
|
FloatingActionButtonLocation.centerDocked,
|
||||||
floatingActionButton: floatingActionButtonRender(),
|
floatingActionButton: floatingActionButtonRender(),
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import 'package:satu/core/models/flow/product_dao.dart';
|
|
||||||
|
|
||||||
num sumProducts(List<ProductDao> list) {
|
|
||||||
num result = 0.0;
|
|
||||||
if (list.isNotEmpty) {
|
|
||||||
list.forEach((product) {
|
|
||||||
result += (product.price! * product.count!);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import 'package:satu/core/models/flow/product_dao.dart';
|
||||||
|
|
||||||
|
num sumProducts(List<ProductDao> list) {
|
||||||
|
num result = 0.0;
|
||||||
|
if (list.isNotEmpty) {
|
||||||
|
for( final ProductDao product in list) {
|
||||||
|
final String val = (product.price! * product.count!).toStringAsFixed(5);
|
||||||
|
// result += product.price! * product.count!;
|
||||||
|
result += num.parse(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ import 'package:satu/shared/app_colors.dart';
|
||||||
import 'package:satu/widgets/bar/products_app_bar.dart';
|
import 'package:satu/widgets/bar/products_app_bar.dart';
|
||||||
import 'package:satu/widgets/bar/products_header_bar.dart';
|
import 'package:satu/widgets/bar/products_header_bar.dart';
|
||||||
import 'package:satu/widgets/bar/products_title_bar.dart';
|
import 'package:satu/widgets/bar/products_title_bar.dart';
|
||||||
import 'package:satu/views/work/tabs/utils/ProductUtils.dart';
|
import 'package:satu/views/work/tabs/utils/product_utils.dart';
|
||||||
import 'package:satu/widgets/buttons/busy_button.dart';
|
import 'package:satu/widgets/buttons/busy_button.dart';
|
||||||
|
|
||||||
class PaymentView extends StatefulWidget {
|
class PaymentView extends StatefulWidget {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue