fix(shopinbit): fix double display name prompt, skip service overview for returning users
What changed, and why it matters
This commit fixes a user-interface flow bug in the desktop ShopinBit feature. Previously, first-time users were asked for their display name twice and had to go through an extra service overview screen. Now, first-time users enter their name once in setup, see the service overview, and then go straight to the order step. Returning users skip the overview and go directly to the order step. There is no security-relevant change.
No security action needed. This is a routine UX bug fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors _showShopDialog() in desktop_shopinbit_view.dart. It introduces an isFirstRun boolean, branches the dialog flow based on whether ShopInBitService.loadSetupComplete() is true, and imports shopinbit_step_2.dart. First-run users see a setup dialog, then the service overview/warning dialog, then ShopInBitStep2. Returning users bypass the overview and show ShopInBitStep1. The diff is purely UI/UX flow control with no input validation, authentication, cryptography, or data handling changes.
Changed components
lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dartInspect captured patch +68 / −24
diff --git a/lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dart b/lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dart
index b30ba6b..5f25e98 100644
--- a/lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dart
+++ b/lib/pages_desktop_specific/more_view/sub_widgets/desktop_shopinbit_view.dart
@@ -10,6 +10,7 @@ import '../../../db/isar/main_db.dart';
import '../../../models/shopinbit/shopinbit_order_model.dart';
import '../../../notifications/show_flush_bar.dart';
import '../../../pages/shopinbit/shopinbit_step_1.dart';
+import '../../../pages/shopinbit/shopinbit_step_2.dart';
import '../../../pages/shopinbit/shopinbit_tickets_view.dart';
import '../../../providers/desktop/current_desktop_menu_item.dart';
import '../../../services/shopinbit/shopinbit_service.dart';
@@ -89,6 +90,7 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
void _showShopDialog(BuildContext context) async {
final service = ShopInBitService.instance;
final model = ShopInBitOrderModel();
+ bool isFirstRun = false;
if (!service.loadSetupComplete()) {
// First-time user: show setup.
@@ -98,6 +100,7 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
builder: (_) => _ShopInBitDesktopSetupDialog(model: model),
);
if (completed != true) return; // user cancelled
+ isFirstRun = true;
} else {
// Returning user: restore display name.
final savedName = service.loadDisplayName();
@@ -106,30 +109,63 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
}
}
- // Show warning dialog.
if (!mounted) return;
- showDialog<void>(
- context: context,
- barrierDismissible: false,
- builder: (dialogContext) => DesktopDialog(
- maxWidth: 550,
- maxHeight: 300,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text("ShopinBit", style: STextStyles.desktopH2(dialogContext)),
- const SizedBox(height: 16),
- RichText(
- text: TextSpan(
- style: STextStyles.desktopTextSmall(dialogContext),
+
+ if (isFirstRun) {
+ // First run: show service overview then go directly to Step2
+ // (name was just entered in setup dialog, no need to show Step1 again).
+ showDialog<void>(
+ context: context,
+ barrierDismissible: false,
+ builder: (dialogContext) => DesktopDialog(
+ maxWidth: 550,
+ maxHeight: 300,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text("ShopinBit", style: STextStyles.desktopH2(dialogContext)),
+ const SizedBox(height: 16),
+ RichText(
+ text: TextSpan(
+ style: STextStyles.desktopTextSmall(dialogContext),
+ children: const [
+ TextSpan(
+ text:
+ "Please note the following before proceeding:"
+ "\n\n\u2022 Minimum order amount: 1,000 EUR"
+ "\n\u2022 Service fee: 10% of the order total",
+ ),
+ ],
+ ),
+ ),
+ const Spacer(),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- const TextSpan(
- text:
- "Please note the following before proceeding:"
- "\n\n\u2022 Minimum order amount: 1,000 EUR"
- "\n\u2022 Service fee: 10% of the order total",
+ SecondaryButton(
+ width: 200,
+ buttonHeight: ButtonHeight.l,
+ label: "Cancel",
+ onPressed: () {
+ Navigator.of(dialogContext, rootNavigator: true).pop();
+ },
+ ),
+ const SizedBox(width: 20),
+ PrimaryButton(
+ width: 200,
+ buttonHeight: ButtonHeight.l,
+ label: "Continue",
+ onPressed: () async {
+ Navigator.of(dialogContext, rootNavigator: true).pop();
+ await showDialog<void>(
+ context: context,
+ barrierDismissible: false,
+ builder: (_) => ShopInBitStep2(model: model),
+ );
+ if (mounted) setState(() {});
+ },
),
],
),
@@ -166,8 +202,16 @@ class _DesktopServicesViewState extends ConsumerState<DesktopShopInBitView> {
],
),
),
- ),
- );
+ );
+ } else {
+ // Returning user: go directly to Step1 (skip service overview dialog).
+ await showDialog<void>(
+ context: context,
+ barrierDismissible: false,
+ builder: (_) => ShopInBitStep1(model: model),
+ );
+ if (mounted) setState(() {});
+ }
}
@override
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.