fixes
parent
c7ce34407e
commit
b1bd0101a2
|
|
@ -3,12 +3,14 @@ import 'dart:io';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
|
||||
class AddByBarcodeView extends StatefulWidget {
|
||||
final String title;
|
||||
final int transactionId;
|
||||
|
||||
const AddByBarcodeView({
|
||||
Key key, this.title,
|
||||
Key key,
|
||||
this.title,
|
||||
this.transactionId,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -16,28 +18,20 @@ class AddByBarcodeView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _AddByBarcodeViewState extends State<AddByBarcodeView> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Container(
|
||||
height: 2000,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
print('barcode = image-${widget.transactionId}');
|
||||
return Container(
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: 'text',
|
||||
child: Text(widget.title)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ class AddProductView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _AddProductViewState extends State<AddProductView> {
|
||||
DictionaryService _dictionaryService = locator<DictionaryService>();
|
||||
NavigatorService _navigatorService = locator<NavigatorService>();
|
||||
final DictionaryService _dictionaryService = locator<DictionaryService>();
|
||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||
TextEditingController _searchTextController;
|
||||
final FocusNode _searchFocusNode = new FocusNode();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,15 @@ import 'package:flutter/cupertino.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:satu/core/redux/actions/sell_actions.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/shared/shared_styles.dart';
|
||||
import 'package:satu/shared/ui_helpers.dart';
|
||||
import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart';
|
||||
|
||||
class ProductListItem extends StatelessWidget {
|
||||
class ProductListItem extends StatefulWidget {
|
||||
final String name;
|
||||
final String ean;
|
||||
final String categoryName;
|
||||
|
|
@ -15,15 +19,39 @@ class ProductListItem extends StatelessWidget {
|
|||
final bool isOdd;
|
||||
final int transactionId;
|
||||
|
||||
const ProductListItem({Key key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.transactionId}) : super(key: key);
|
||||
const ProductListItem(
|
||||
{Key key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.transactionId})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_ProductListItemState createState() => _ProductListItemState();
|
||||
}
|
||||
|
||||
class _ProductListItemState extends State<ProductListItem> {
|
||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||
|
||||
void _onItemTapped(BuildContext context) {
|
||||
Navigator.of(context).push(new MaterialPageRoute(
|
||||
builder: (BuildContext context) => new AddByBarcodeView(
|
||||
title: widget.name,
|
||||
transactionId: widget.transactionId,
|
||||
)));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dismissible(
|
||||
background: Container( alignment: AlignmentDirectional.centerEnd, color: redColor, child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Удалить', style: buttonTitleTextStyle,),
|
||||
),),
|
||||
background: Container(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
color: redColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Удалить',
|
||||
style: buttonTitleTextStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
direction: DismissDirection.endToStart,
|
||||
confirmDismiss: (DismissDirection direction) async {
|
||||
return await showDialog(
|
||||
|
|
@ -31,12 +59,9 @@ class ProductListItem extends StatelessWidget {
|
|||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Внимание"),
|
||||
content: Text("Удалить товар \"${this.name}\" - ${count} ед. ?"),
|
||||
content: Text("Удалить товар \"${this.widget.name}\" - ${widget.count} ед. ?"),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: const Text("Удалить")
|
||||
),
|
||||
FlatButton(onPressed: () => Navigator.of(context).pop(true), child: const Text("Удалить")),
|
||||
FlatButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: const Text("Отмена"),
|
||||
|
|
@ -48,11 +73,12 @@ class ProductListItem extends StatelessWidget {
|
|||
},
|
||||
onDismissed: (direction) {
|
||||
print(direction);
|
||||
Redux.store.dispatch(removeSellItem( transactionId: this.transactionId ));
|
||||
Redux.store.dispatch(removeSellItem(transactionId: this.widget.transactionId));
|
||||
},
|
||||
key: Key(name),
|
||||
key: Key(widget.name),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric( horizontal: 10.0 ,vertical: 4.0 ),
|
||||
onTap: () => _onItemTapped(context),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(top: 4.0),
|
||||
child: Row(
|
||||
|
|
@ -64,10 +90,21 @@ class ProductListItem extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(name , style: const TextStyle( fontWeight: FontWeight.w500 ), overflow: TextOverflow.ellipsis, maxLines: 2,),
|
||||
Text(
|
||||
widget.name,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
verticalSpaceTiny,
|
||||
Text('Штрих-код: $ean' , style: productSubTextStyle,),
|
||||
Text(categoryName ?? '', style: productSubTextStyle,)
|
||||
Text(
|
||||
'Штрих-код: ${widget.ean}',
|
||||
style: productSubTextStyle,
|
||||
),
|
||||
Text(
|
||||
widget.categoryName ?? '',
|
||||
style: productSubTextStyle,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -76,15 +113,21 @@ class ProductListItem extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text('${price} ₸', style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold ),),
|
||||
Text('${count} шт', style: const TextStyle( fontSize: 12 ),),
|
||||
Text(
|
||||
'${widget.price} ₸',
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
'${widget.count} шт',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
tileColor: !isOdd ? fillColor : backgroundColor,
|
||||
tileColor: !widget.isOdd ? fillColor : backgroundColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ 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>(
|
||||
|
|
@ -72,6 +74,7 @@ class SellView extends StatelessWidget {
|
|||
child: FloatingActionButton(
|
||||
elevation: 2,
|
||||
backgroundColor: greenColor,
|
||||
|
||||
onPressed: () => print('check'),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
|
|
|
|||
Loading…
Reference in New Issue