Skip to content

Commit 0119410

Browse files
committed
fix(shopinbit): fix double display name prompt, skip service overview for returning users
1 parent 0e7898a commit 0119410

1 file changed

Lines changed: 68 additions & 24 deletions

File tree

lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dart

Lines changed: 68 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import '../../../db/isar/main_db.dart';
1010
import '../../../models/shopinbit/shopinbit_order_model.dart';
1111
import '../../../notifications/show_flush_bar.dart';
1212
import '../../../pages/shopinbit/shopinbit_step_1.dart';
13+
import '../../../pages/shopinbit/shopinbit_step_2.dart';
1314
import '../../../pages/shopinbit/shopinbit_tickets_view.dart';
1415
import '../../../providers/desktop/current_desktop_menu_item.dart';
1516
import '../../../services/shopinbit/shopinbit_service.dart';
@@ -89,6 +90,7 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
8990
void _showShopDialog(BuildContext context) async {
9091
final service = ShopInBitService.instance;
9192
final model = ShopInBitOrderModel();
93+
bool isFirstRun = false;
9294

9395
if (!service.loadSetupComplete()) {
9496
// First-time user: show setup.
@@ -98,6 +100,7 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
98100
builder: (_) => _ShopInBitDesktopSetupDialog(model: model),
99101
);
100102
if (completed != true) return; // user cancelled
103+
isFirstRun = true;
101104
} else {
102105
// Returning user: restore display name.
103106
final savedName = service.loadDisplayName();
@@ -106,30 +109,63 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
106109
}
107110
}
108111

109-
// Show warning dialog.
110112
if (!mounted) return;
111-
showDialog<void>(
112-
context: context,
113-
barrierDismissible: false,
114-
builder: (dialogContext) => DesktopDialog(
115-
maxWidth: 550,
116-
maxHeight: 300,
117-
child: Padding(
118-
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
119-
child: Column(
120-
crossAxisAlignment: CrossAxisAlignment.start,
121-
children: [
122-
Text("ShopinBit", style: STextStyles.desktopH2(dialogContext)),
123-
const SizedBox(height: 16),
124-
RichText(
125-
text: TextSpan(
126-
style: STextStyles.desktopTextSmall(dialogContext),
113+
114+
if (isFirstRun) {
115+
// First run: show service overview then go directly to Step2
116+
// (name was just entered in setup dialog, no need to show Step1 again).
117+
showDialog<void>(
118+
context: context,
119+
barrierDismissible: false,
120+
builder: (dialogContext) => DesktopDialog(
121+
maxWidth: 550,
122+
maxHeight: 300,
123+
child: Padding(
124+
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
125+
child: Column(
126+
crossAxisAlignment: CrossAxisAlignment.start,
127+
children: [
128+
Text("ShopinBit", style: STextStyles.desktopH2(dialogContext)),
129+
const SizedBox(height: 16),
130+
RichText(
131+
text: TextSpan(
132+
style: STextStyles.desktopTextSmall(dialogContext),
133+
children: const [
134+
TextSpan(
135+
text:
136+
"Please note the following before proceeding:"
137+
"\n\n\u2022 Minimum order amount: 1,000 EUR"
138+
"\n\u2022 Service fee: 10% of the order total",
139+
),
140+
],
141+
),
142+
),
143+
const Spacer(),
144+
Row(
145+
mainAxisAlignment: MainAxisAlignment.center,
127146
children: [
128-
const TextSpan(
129-
text:
130-
"Please note the following before proceeding:"
131-
"\n\n\u2022 Minimum order amount: 1,000 EUR"
132-
"\n\u2022 Service fee: 10% of the order total",
147+
SecondaryButton(
148+
width: 200,
149+
buttonHeight: ButtonHeight.l,
150+
label: "Cancel",
151+
onPressed: () {
152+
Navigator.of(dialogContext, rootNavigator: true).pop();
153+
},
154+
),
155+
const SizedBox(width: 20),
156+
PrimaryButton(
157+
width: 200,
158+
buttonHeight: ButtonHeight.l,
159+
label: "Continue",
160+
onPressed: () async {
161+
Navigator.of(dialogContext, rootNavigator: true).pop();
162+
await showDialog<void>(
163+
context: context,
164+
barrierDismissible: false,
165+
builder: (_) => ShopInBitStep2(model: model),
166+
);
167+
if (mounted) setState(() {});
168+
},
133169
),
134170
],
135171
),
@@ -166,8 +202,16 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
166202
],
167203
),
168204
),
169-
),
170-
);
205+
);
206+
} else {
207+
// Returning user: go directly to Step1 (skip service overview dialog).
208+
await showDialog<void>(
209+
context: context,
210+
barrierDismissible: false,
211+
builder: (_) => ShopInBitStep1(model: model),
212+
);
213+
if (mounted) setState(() {});
214+
}
171215
}
172216

173217
@override

0 commit comments

Comments
 (0)