148 lines
4.2 KiB
Dart
148 lines
4.2 KiB
Dart
|
|
import 'package:aman_kassa_flutter/core/models/ProductDao.dart';
|
|
import 'package:aman_kassa_flutter/redux/actions/main_actions.dart';
|
|
import 'package:aman_kassa_flutter/redux/store.dart';
|
|
import 'package:aman_kassa_flutter/shared/app_colors.dart';
|
|
import 'package:aman_kassa_flutter/shared/shared_styles.dart';
|
|
import 'package:aman_kassa_flutter/views/home/tabs/kassaView/CatalogBottomSheet.dart';
|
|
import 'package:aman_kassa_flutter/views/home/tabs/kassaView/ProductAddBottomSheet.dart';
|
|
import 'package:aman_kassa_flutter/widgets/components/ProductListItem.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
List<String> litems = [
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4",
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4",
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4",
|
|
"1"
|
|
];
|
|
|
|
class KassaTab extends StatelessWidget {
|
|
|
|
final int index;
|
|
|
|
KassaTab(this.index);
|
|
|
|
Widget buildItem(BuildContext ctxt, int index) {
|
|
return ProductListItem(
|
|
item: new ProductDao(name: 'Наименование', count: 123, price: 2332.02),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.all(4),
|
|
child: Column(
|
|
children: <Widget>[
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4.0),
|
|
child: RaisedButton(
|
|
padding: EdgeInsets.all(8),
|
|
color: primaryColor,
|
|
child: Text(
|
|
"Добавить",
|
|
style: buttonBigTitleTextStyle,
|
|
),
|
|
onPressed: () { showModalBottomSheetCatalog(context, 'add');},
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4.0),
|
|
child: RaisedButton(
|
|
padding: EdgeInsets.all(8),
|
|
color: greenColor,
|
|
child: Text(
|
|
"Каталог",
|
|
style: buttonBigTitleTextStyle,
|
|
),
|
|
onPressed: () { showModalBottomSheetCatalog(context, 'catalog');},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
child: ListView.builder(
|
|
itemCount: litems.length,
|
|
itemBuilder: (BuildContext ctxt, int index) =>
|
|
buildItem(ctxt, index)),
|
|
),
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4.0),
|
|
child: RaisedButton(
|
|
padding: EdgeInsets.all(8),
|
|
color: redColor,
|
|
child: Text(
|
|
"Возврат",
|
|
style: buttonBigTitleTextStyle,
|
|
),
|
|
onPressed: () => null,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4.0),
|
|
child: RaisedButton(
|
|
padding: EdgeInsets.all(8),
|
|
color: greenColor,
|
|
child: Text(
|
|
"Оплата",
|
|
style: buttonBigTitleTextStyle,
|
|
),
|
|
onPressed: () => null,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
void showModalBottomSheetCatalog(BuildContext context, String action) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (context){
|
|
return DraggableScrollableSheet(
|
|
initialChildSize: 0.8,
|
|
maxChildSize: 0.95,
|
|
minChildSize: 0.5,
|
|
builder: (BuildContext context, ScrollController scrollController) {
|
|
if( action == 'add') {
|
|
return ProductAddBottomSheet();
|
|
} else {
|
|
return CatalogBottomSheet(scrollController: scrollController,);
|
|
}
|
|
},
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
|
|
}
|