81 lines
2.8 KiB
Dart
81 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
import 'package:satu/core/models/flow/product_dao.dart';
|
|
import 'package:satu/core/redux/state/sell_state.dart';
|
|
import 'package:satu/core/redux/store.dart';
|
|
import 'package:satu/core/services/navigator_service.dart';
|
|
import 'package:satu/core/utils/locator.dart';
|
|
import 'package:satu/routes/route_names.dart';
|
|
import 'package:satu/shared/app_colors.dart';
|
|
import 'package:satu/views/work/tabs/component/product_list_item.dart';
|
|
import 'package:satu/views/work/tabs/component/products_app_bar.dart';
|
|
import 'package:satu/views/work/tabs/component/products_header_bar.dart';
|
|
import 'package:satu/views/work/tabs/utils/ProductUtils.dart';
|
|
|
|
class SellView extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return StoreConnector<AppState, SellState>(
|
|
converter: (store) => store.state.sellState,
|
|
builder: (_, state) {
|
|
return Scaffold(
|
|
appBar: ProductsAppBar(
|
|
title: 'Продажа',
|
|
actions: actions(),
|
|
elevation: 2.0,
|
|
child: ProductHeaderBar(
|
|
count: state.items.length,
|
|
sum: sumProducts(state.items),
|
|
),
|
|
backgroundColor: backgroundColor,
|
|
childHeight: 80,
|
|
),
|
|
body: Column(
|
|
children: [
|
|
//ProductHeaderBar(count: 14, sum: 25000,),
|
|
Expanded(
|
|
child: ListView.builder(
|
|
physics: BouncingScrollPhysics(),
|
|
itemCount: state.items.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
ProductDao product = state.items.elementAt(index);
|
|
return ProductListItem(
|
|
ean: product.eanCode,
|
|
isOdd: index % 2 == 0,
|
|
name: product.productName,
|
|
price: product.price,
|
|
count: product.count,
|
|
categoryName: product.productName,
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
List<Widget> actions() {
|
|
return [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: IconButton(
|
|
icon: Icon(Icons.add_box, size: 30.0, color: yellowColor),
|
|
onPressed: () {
|
|
locator<NavigatorService>().push(AddProductViewRoute);
|
|
}),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: IconButton(
|
|
icon: Icon(Icons.camera_enhance_rounded, size: 30.0, color: yellowColor),
|
|
onPressed: () {
|
|
locator<NavigatorService>().push(AddByBarcodeViewRoute);
|
|
}),
|
|
)
|
|
];
|
|
}
|
|
}
|