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