@@ -12,7 +12,9 @@ import 'package:on_time_front/presentation/onboarding/schedule_spare_time/cubit/
1212import 'package:on_time_front/presentation/onboarding/schedule_spare_time/screens/schedule_spare_time_form.dart' ;
1313import 'package:on_time_front/presentation/onboarding/cubit/onboarding_cubit.dart' ;
1414import 'package:on_time_front/presentation/onboarding/preparation_order/cubit/preparation_order_cubit.dart' ;
15+ import 'package:on_time_front/presentation/shared/components/modal_wide_button.dart' ;
1516import 'package:on_time_front/presentation/shared/components/step_progress.dart' ;
17+ import 'package:on_time_front/presentation/shared/components/two_action_dialog.dart' ;
1618import 'package:on_time_front/l10n/app_localizations.dart' ;
1719
1820class OnboardingScreen extends StatelessWidget {
@@ -22,10 +24,7 @@ class OnboardingScreen extends StatelessWidget {
2224 Widget build (BuildContext context) {
2325 return BlocProvider (
2426 create: (context) => getIt.get <OnboardingCubit >(),
25- child: Scaffold (
26- resizeToAvoidBottomInset: false ,
27- body: _OnboardingForm (),
28- ),
27+ child: Scaffold (resizeToAvoidBottomInset: false , body: _OnboardingForm ()),
2928 );
3029 }
3130}
@@ -91,47 +90,50 @@ class _OnboardingFormState extends State<_OnboardingForm>
9190 ),
9291 ),
9392 ],
94- child: Builder (builder: (context) {
95- return Column (
96- children: < Widget > [
97- _AppBar (
98- tabController: _tabController,
99- onUpdateCurrentPageIndex: _updateCurrentPageIndex,
100- ),
101- Expanded (
102- child: PageView (
103- physics: const NeverScrollableScrollPhysics (),
104- controller: _pageViewController,
105- onPageChanged: _handlePageViewChanged,
106- children: < Widget > [
107- PreparationNameForm (),
108- PreparationOrderForm (),
109- PreparationTimeForm (),
110- ScheduleSpareTimeForm (),
111- ],
93+ child: Builder (
94+ builder: (context) {
95+ return Column (
96+ children: < Widget > [
97+ _AppBar (
98+ tabController: _tabController,
99+ onUpdateCurrentPageIndex: _updateCurrentPageIndex,
100+ ),
101+ Expanded (
102+ child: PageView (
103+ physics: const NeverScrollableScrollPhysics (),
104+ controller: _pageViewController,
105+ onPageChanged: _handlePageViewChanged,
106+ children: < Widget > [
107+ PreparationNameForm (),
108+ PreparationOrderForm (),
109+ PreparationTimeForm (),
110+ ScheduleSpareTimeForm (),
111+ ],
112+ ),
112113 ),
113- ),
114- SizedBox (
114+ SizedBox (
115115 height: 58 ,
116116 width: double .infinity,
117117 child: ElevatedButton (
118- onPressed: ! _isSubmitting &&
119- context.select ((OnboardingCubit cubit) =>
120- cubit.state.isValid)
118+ onPressed:
119+ ! _isSubmitting &&
120+ context.select (
121+ (OnboardingCubit cubit) => cubit.state.isValid,
122+ )
121123 ? () => _onNextPageButtonClicked (context)
122124 : null ,
123125 child: _isSubmitting
124126 ? const SizedBox .square (
125127 dimension: 24 ,
126- child: CircularProgressIndicator (
127- strokeWidth: 2 ,
128- ),
128+ child: CircularProgressIndicator (strokeWidth: 2 ),
129129 )
130130 : Text (AppLocalizations .of (context)! .next),
131- )),
132- ],
133- );
134- }),
131+ ),
132+ ),
133+ ],
134+ );
135+ },
136+ ),
135137 ),
136138 ),
137139 );
@@ -162,9 +164,15 @@ class _OnboardingFormState extends State<_OnboardingForm>
162164 await context.read <OnboardingCubit >().onboardingFormSubmitted ();
163165 } catch (_) {
164166 if (! context.mounted) return ;
165- ScaffoldMessenger .of (context).showSnackBar (
166- SnackBar (
167- content: Text (AppLocalizations .of (context)! .error),
167+ final l10n = AppLocalizations .of (context)! ;
168+ await showTwoActionDialog (
169+ context,
170+ config: TwoActionDialogConfig (
171+ title: l10n.error,
172+ primaryAction: DialogActionConfig (
173+ label: l10n.ok,
174+ variant: ModalWideButtonVariant .destructive,
175+ ),
168176 ),
169177 );
170178 } finally {
@@ -242,9 +250,7 @@ class _AppBar extends StatelessWidget {
242250 ),
243251 ),
244252 ),
245- SizedBox (
246- width: iconButtonSize,
247- )
253+ SizedBox (width: iconButtonSize),
248254 ],
249255 );
250256 }
0 commit comments