mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
- Mobile opens on a welcome screen whose headline reveals word by word, then the subtitle, the three what-you'll-do rows and the actions. 'I'll set this up later' records completion, so a rider who declines isn't asked again on every launch. Desktop keeps its rail-framed step 1. - Dark mode: colorScheme.primary is only the brand blue in the LIGHT theme, so white-on-primary icons and check marks were invisible (the Network tile above all). New onboardingAccent()/onboardingOnAccent keep the brand accent in both themes, lightened for dark. - Step 4's blocked state read as 'Virtual Shifting doesn't work here'; it now leads with 'Optional: connect your smart trainer' and says plainly that VS does work — just not with both apps on one phone. The normal step regains the design's 'Optional:' prefix too. - 'See Pro & Base options' goes through IAPManager again, so iOS/Android get RevenueCat's hosted paywall instead of the desktop fallback with placeholder 'about x €' prices (_loadRevenueCatPricing is macOS-only). The desktop paywall keeps pull-to-dismiss, now for every caller. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
67 lines
2.7 KiB
Dart
67 lines
2.7 KiB
Dart
// Regression: shadcn's DrawerOverlay is created by Scaffold, so opening a
|
|
// sheet with the page State's own context (which sits above the Scaffold)
|
|
// asserted "No DrawerOverlay found in the widget tree". The wizard must open
|
|
// all sheets through a context captured under its Scaffold.
|
|
import 'package:bike_control/gen/l10n.dart';
|
|
import 'package:bike_control/main.dart' show OtherLocalizationsDelegate;
|
|
import 'package:bike_control/pages/onboarding/onboarding_page.dart';
|
|
import 'package:bike_control/widgets/guided_operation_sheet.dart' show StageBadge;
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
|
|
import 'widget_snapshot.dart';
|
|
|
|
Future<void> main() async {
|
|
await ensureSnapshotHarness();
|
|
|
|
testWidgets('help sheet opens from the wizard page', (tester) async {
|
|
tester.view.physicalSize = const Size(380, 760) * 3.0;
|
|
tester.view.devicePixelRatio = 3.0;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
|
|
await tester.pumpWidget(
|
|
ShadcnApp(
|
|
debugShowCheckedModeBanner: false,
|
|
localizationsDelegates: [
|
|
...ShadcnLocalizations.localizationsDelegates,
|
|
const OtherLocalizationsDelegate(),
|
|
AppLocalizations.delegate,
|
|
],
|
|
supportedLocales: AppLocalizations.delegate.supportedLocales,
|
|
theme: ThemeData(colorScheme: ColorSchemes.lightSlate, radius: 0.7),
|
|
// Prod pushes the wizard as a fullscreenDialog MaterialPageRoute —
|
|
// reproduce that exactly instead of mounting it as home.
|
|
home: Builder(
|
|
builder: (context) => GhostButton(
|
|
onPressed: () => Navigator.of(context).push(
|
|
MaterialPageRoute(fullscreenDialog: true, builder: (_) => const OnboardingPage()),
|
|
),
|
|
child: const Text('open'),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
await tester.tap(find.text('open'));
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
|
|
// Mobile opens on the welcome screen — enter the wizard first.
|
|
await tester.tap(find.byType(PrimaryButton).last);
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
|
|
// Mobile header Help pill.
|
|
final help = find.byIcon(LucideIcons.lifeBuoy).first;
|
|
await tester.tap(help);
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
|
|
expect(tester.takeException(), isNull, reason: 'opening the help sheet must not crash');
|
|
// The help sheet body leads with a StageBadge — presence proves the sheet
|
|
// actually rendered inside a DrawerOverlay.
|
|
expect(find.byType(StageBadge), findsWidgets);
|
|
});
|
|
}
|