A whole lot of stuff

This commit is contained in:
Courtney Arnold 2026-08-18 11:04:58 -05:00
parent faf319322a
commit ad850d2be6
50 changed files with 3013 additions and 213 deletions

View file

@ -1,9 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import '../screens/data_settings_screen.dart';
import '../screens/faq_screen.dart';
import '../services/onboarding_keys.dart';
import 'onboarding_tour_overlay.dart';
const _backedUpFaqQuestion = 'Is my data backed up?';
/// Shown right after a fuel entry is saved (see
/// `ConfirmFuelEntryScreen._save`) when no cloud backup is configured yet —
/// nudges the user toward Settings > Data before they forget and eventually
@ -21,6 +25,19 @@ Future<bool> showBackupReminderDialog(BuildContext context) async {
'Would you like to set up a backup method now?',
),
actions: [
TextButton(
onPressed: () {
// Resolves as "not now" (they didn't choose to set backup up
// directly), but still takes them somewhere useful about it.
Navigator.of(context).pop(false);
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const FaqScreen(initiallyExpandedQuestion: _backedUpFaqQuestion),
),
);
},
child: const Text('Learn More'),
),
TextButton(onPressed: () => Navigator.of(context).pop(false), child: const Text('Not Now')),
FilledButton(onPressed: () => Navigator.of(context).pop(true), child: const Text('Set Up Backup')),
],
@ -80,6 +97,34 @@ class _SpotlightedDataSettingsScreenState extends State<_SpotlightedDataSettings
await Future.delayed(const Duration(milliseconds: 16));
}
if (!mounted) return;
// This screen was reached via Navigator.push (see openCloudBackupSetup
// below) — wait for that push transition to fully settle before
// capturing the card's position, or the spotlight ends up shifted by
// however far the slide-in hadn't yet finished. ModalRoute.of(context)
// correctly resolves to that pushed route here, since this State's
// context lives inside it.
await waitForRouteTransition(ModalRoute.of(context)?.animation);
if (!mounted) return;
// The route's own AnimationController reports AnimationStatus.completed
// at this point, but empirically the render tree's transforms (from
// FadeForwardsPageTransitionsBuilder's SlideTransition, the actual
// Android default as of Flutter 3.44) still reflect a mid-transition
// position for a few more frames after that — confirmed by walking the
// RenderObject ancestor chain and finding an active
// RenderFractionalTranslation still present, with a position matching
// the transition's *starting* offset rather than its resting
// Offset.zero. These extra frames give it time to actually settle
// before the spotlight measures anything. SchedulerBinding.endOfFrame
// (rather than a bare Future.delayed) so this genuinely waits on real
// frames — in a widget test, tester.pumpAndSettle() only keeps pumping
// while something has an actual frame scheduled, which a bare delay
// timer doesn't count as once the route's own transition has already
// finished.
for (var i = 0; i < 10; i++) {
if (!mounted) return;
await SchedulerBinding.instance.endOfFrame;
}
if (!mounted) return;
_entry = OverlayEntry(
builder: (_) => OnboardingTourOverlay(