remove quantity from new item form and fix fabs
This commit is contained in:
parent
a7b890c119
commit
f094883840
|
@ -25,11 +25,7 @@ class ItemFormCubit extends FormCubit {
|
||||||
initalValue: 100,
|
initalValue: 100,
|
||||||
);
|
);
|
||||||
|
|
||||||
quantity = FieldCubit(
|
super.addFields([title, description, price]);
|
||||||
initalValue: 1,
|
|
||||||
);
|
|
||||||
|
|
||||||
super.addFields([title, description, price, quantity]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -38,13 +34,11 @@ class ItemFormCubit extends FormCubit {
|
||||||
print('title: ${title.state.value}');
|
print('title: ${title.state.value}');
|
||||||
print('description: ${description.state.value}');
|
print('description: ${description.state.value}');
|
||||||
print('price: ${price.state.value}');
|
print('price: ${price.state.value}');
|
||||||
print('quantity: ${quantity.state.value}');
|
|
||||||
|
|
||||||
final Item item = Item(
|
final Item item = Item(
|
||||||
title: title.state.value,
|
title: title.state.value,
|
||||||
description: description.state.value,
|
description: description.state.value,
|
||||||
price: price.state.value,
|
price: price.state.value,
|
||||||
quantity: quantity.state.value,
|
|
||||||
id: cubit.state.items.isEmpty ? 0 : cubit.state.items.last.id + 1,
|
id: cubit.state.items.isEmpty ? 0 : cubit.state.items.last.id + 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -54,7 +48,6 @@ class ItemFormCubit extends FormCubit {
|
||||||
late FieldCubit<String> title;
|
late FieldCubit<String> title;
|
||||||
late FieldCubit<String> description;
|
late FieldCubit<String> description;
|
||||||
late FieldCubit<int> price;
|
late FieldCubit<int> price;
|
||||||
late FieldCubit<int> quantity;
|
|
||||||
|
|
||||||
final ItemsCubit cubit;
|
final ItemsCubit cubit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class AddCourierFab extends StatelessWidget {
|
||||||
const AddCourierFab({super.key});
|
const AddCourierFab({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
Widget build(final BuildContext context) => FloatingActionButton(
|
||||||
heroTag: 'new_courier_fab',
|
heroTag: 'new_courier_fab',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
|
|
|
@ -5,7 +5,7 @@ class AddItemFab extends StatelessWidget {
|
||||||
const AddItemFab({super.key});
|
const AddItemFab({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
Widget build(final BuildContext context) => FloatingActionButton(
|
||||||
heroTag: 'new_item_fab',
|
heroTag: 'new_item_fab',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
|
|
|
@ -4,7 +4,7 @@ class AddOrderFab extends StatelessWidget {
|
||||||
const AddOrderFab({super.key});
|
const AddOrderFab({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
Widget build(final BuildContext context) => FloatingActionButton(
|
||||||
heroTag: 'new_order_fab',
|
heroTag: 'new_order_fab',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
|
|
|
@ -60,15 +60,6 @@ class ItemsDetails extends StatelessWidget {
|
||||||
labelText: 'Цена',
|
labelText: 'Цена',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
CubitFormIntField(
|
|
||||||
formFieldCubit:
|
|
||||||
context.read<ItemFormCubit>().quantity,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
alignLabelWithHint: false,
|
|
||||||
labelText: 'Количество',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
|
|
|
@ -90,27 +90,11 @@ class _RootPageState extends State<RootPage> with TickerProviderStateMixin {
|
||||||
bottomNavigationBar: BrandTabBar(
|
bottomNavigationBar: BrandTabBar(
|
||||||
controller: tabController,
|
controller: tabController,
|
||||||
),
|
),
|
||||||
floatingActionButton: SizedBox(
|
floatingActionButton: tabController.index == 0
|
||||||
height: 104 + 16,
|
? const AddItemFab()
|
||||||
child: Column(
|
: tabController.index == 1
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
? const AddCourierFab()
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
: const AddOrderFab(),
|
||||||
children: [
|
|
||||||
ScaleTransition(
|
|
||||||
scale: _animationItems,
|
|
||||||
child: const AddItemFab(),
|
|
||||||
),
|
|
||||||
ScaleTransition(
|
|
||||||
scale: _animationCouriers,
|
|
||||||
child: const AddCourierFab(),
|
|
||||||
),
|
|
||||||
ScaleTransition(
|
|
||||||
scale: _animationOrders,
|
|
||||||
child: const AddOrderFab(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue