@@ -140,31 +140,60 @@ class _AddUpdateRecipePageState extends State<AddUpdateRecipePage> {
140
140
tooltip: AppLocalizations .of (context)! .redo,
141
141
),
142
142
),
143
- if (mobileLayout)
144
- BlocBuilder <AddUpdateRecipeCubit , AddUpdateRecipeState >(
145
- bloc: cubit,
146
- builder: (context, state) => LoadingIconButton (
147
- icon: const Icon (Icons .save_rounded),
148
- tooltip: AppLocalizations .of (context)! .save,
149
- onPressed: state.isValid () && state.hasChanges
150
- ? () async {
151
- final recipe = await cubit.saveRecipe ();
152
- if (! mounted) return ;
153
- Navigator .of (context).pop (UpdateEnum .updated);
154
- if (recipe != null &&
155
- widget.openRecipeAfterCreation) {
156
- context.go (
157
- "/household/${cubit .household .id }/recipes/details/${recipe .id }" ,
158
- extra: Tuple2 <Household , Recipe >(
159
- cubit.household,
160
- recipe,
161
- ),
162
- );
163
- }
164
- }
165
- : null ,
166
- ),
167
- ),
143
+ BlocBuilder <AddUpdateRecipeCubit , AddUpdateRecipeState >(
144
+ bloc: cubit,
145
+ builder: (context, state) => mobileLayout
146
+ ? LoadingIconButton (
147
+ icon: const Icon (Icons .save_rounded),
148
+ tooltip: AppLocalizations .of (context)! .save,
149
+ onPressed: state.isValid () && state.hasChanges
150
+ ? () async {
151
+ final recipe = await cubit.saveRecipe ();
152
+ if (! mounted) return ;
153
+ Navigator .of (context)
154
+ .pop (UpdateEnum .updated);
155
+ if (recipe != null &&
156
+ widget.openRecipeAfterCreation) {
157
+ context.go (
158
+ "/household/${cubit .household .id }/recipes/details/${recipe .id }" ,
159
+ extra: Tuple2 <Household , Recipe >(
160
+ cubit.household,
161
+ recipe,
162
+ ),
163
+ );
164
+ }
165
+ }
166
+ : null ,
167
+ )
168
+ : Padding (
169
+ padding: const EdgeInsets .only (left: 4 , right: 8 ),
170
+ child: LoadingFilledButton (
171
+ onPressed: state.isValid () && state.hasChanges
172
+ ? () async {
173
+ final recipe = await cubit.saveRecipe ();
174
+ if (! mounted) return ;
175
+ Navigator .of (context)
176
+ .pop (UpdateEnum .updated);
177
+ if (recipe != null &&
178
+ widget.openRecipeAfterCreation) {
179
+ context.go (
180
+ "/household/${cubit .household .id }/recipes/details/${recipe .id }" ,
181
+ extra: Tuple2 <Household , Recipe >(
182
+ cubit.household,
183
+ recipe,
184
+ ),
185
+ );
186
+ }
187
+ }
188
+ : null ,
189
+ child: Text (
190
+ isUpdate
191
+ ? AppLocalizations .of (context)! .save
192
+ : AppLocalizations .of (context)! .recipeAdd,
193
+ ),
194
+ ),
195
+ ),
196
+ )
168
197
],
169
198
),
170
199
body: Align (
@@ -602,45 +631,6 @@ class _AddUpdateRecipePageState extends State<AddUpdateRecipePage> {
602
631
),
603
632
),
604
633
),
605
- if (! mobileLayout)
606
- SliverPadding (
607
- padding: EdgeInsets .fromLTRB (
608
- 16 , isUpdate ? 0 : 16 , 16 , 16 ),
609
- sliver: SliverToBoxAdapter (
610
- child: BlocBuilder <AddUpdateRecipeCubit ,
611
- AddUpdateRecipeState >(
612
- bloc: cubit,
613
- builder: (context, state) =>
614
- LoadingElevatedButton (
615
- onPressed: state.isValid () && state.hasChanges
616
- ? () async {
617
- final recipe =
618
- await cubit.saveRecipe ();
619
- if (! mounted) return ;
620
- Navigator .of (context)
621
- .pop (UpdateEnum .updated);
622
- if (recipe != null &&
623
- widget.openRecipeAfterCreation) {
624
- context.go (
625
- "/household/${cubit .household .id }/recipes/details/${recipe .id }" ,
626
- extra: Tuple2 <Household , Recipe >(
627
- cubit.household,
628
- recipe,
629
- ),
630
- );
631
- }
632
- }
633
- : null ,
634
- child: Text (
635
- isUpdate
636
- ? AppLocalizations .of (context)! .save
637
- : AppLocalizations .of (context)!
638
- .recipeAdd,
639
- ),
640
- ),
641
- ),
642
- ),
643
- ),
644
634
SliverToBoxAdapter (
645
635
child: SizedBox (
646
636
height: MediaQuery .of (context).padding.bottom),
0 commit comments