81 lines
2.6 KiB
Dart
81 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:satu/shared/app_colors.dart';
|
||
import 'package:satu/shared/ui_helpers.dart';
|
||
import 'package:satu/views/add_product/component/add_category_list_item.dart';
|
||
import 'package:satu/views/add_product/component/app_bar.dart';
|
||
import 'package:satu/widgets/fields/input_field.dart';
|
||
|
||
import 'component/add_product_list_item.dart';
|
||
|
||
class AddProductView extends StatefulWidget {
|
||
@override
|
||
_AddProductViewState createState() => _AddProductViewState();
|
||
}
|
||
|
||
class _AddProductViewState extends State<AddProductView> {
|
||
|
||
TextEditingController _searchTextController;
|
||
final FocusNode _searchFocusNode = new FocusNode();
|
||
|
||
@override
|
||
void initState() {
|
||
_searchTextController = TextEditingController();
|
||
super.initState();
|
||
}
|
||
|
||
@override
|
||
void dispose() {
|
||
_searchTextController.dispose();
|
||
_searchFocusNode.dispose();
|
||
super.dispose();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
appBar: AddProductAppBar(title: 'Товар', actions: actions(),),
|
||
body: Column(
|
||
children: [
|
||
InputField(placeholder: 'Поиск по наименованию и коду товара', search: true, controller: _searchTextController, fieldFocusNode: _searchFocusNode,),
|
||
verticalSpaceTiny,
|
||
Expanded(
|
||
child: Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 8.0 ),
|
||
child: ListView.builder(
|
||
itemCount: 50,
|
||
itemBuilder: (BuildContext context, int index) {
|
||
if(index < 5) {
|
||
return AddCategoryListItem(
|
||
name: 'Категория',
|
||
isOdd: index % 2 ==0,
|
||
key: Key('category_${index}'),
|
||
);
|
||
}
|
||
|
||
return AddProductListItem(
|
||
key: Key('product_${index}'),
|
||
ean: '1234567890123',
|
||
isOdd: index % 2 ==0,
|
||
name: 'Хлеб ржаной который необходимо покупать каждый раз когда придет мысль об этом - ${index +1}. ',
|
||
price: 75,
|
||
count: 15,
|
||
categoryName: 'Хлебобулочные изделия',
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
|
||
],
|
||
),
|
||
);
|
||
}
|
||
|
||
List<Widget> actions() {
|
||
return [
|
||
FlatButton(onPressed: () {}, child: Text('Очистить', style: TextStyle( color: Colors.black ),) ,)
|
||
];
|
||
}
|
||
|
||
}
|