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