diff --git a/apps/lib/features/divination/presentation/screens/divination_processing_screen.dart b/apps/lib/features/divination/presentation/screens/divination_processing_screen.dart index 3d68cb4..401be7e 100644 --- a/apps/lib/features/divination/presentation/screens/divination_processing_screen.dart +++ b/apps/lib/features/divination/presentation/screens/divination_processing_screen.dart @@ -149,7 +149,7 @@ class _DivinationProcessingScreenState extends State if (data == null) { return; } - Navigator.of(context).pushReplacement( + Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (_) => DivinationResultScreen( data: data, @@ -157,6 +157,7 @@ class _DivinationProcessingScreenState extends State enableIntroTransition: true, ), ), + (route) => route.isFirst, ); } diff --git a/apps/lib/features/divination/presentation/screens/divination_result_screen.dart b/apps/lib/features/divination/presentation/screens/divination_result_screen.dart index 6d3de46..ecc43e5 100644 --- a/apps/lib/features/divination/presentation/screens/divination_result_screen.dart +++ b/apps/lib/features/divination/presentation/screens/divination_result_screen.dart @@ -170,12 +170,7 @@ class _DivinationResultScreenState extends State { final l10n = AppLocalizations.of(context)!; return PopScope( canPop: true, - onPopInvokedWithResult: (didPop, result) { - if (didPop) { - return; - } - _backToHome(); - }, + onPopInvokedWithResult: (didPop, result) {}, child: Scaffold( backgroundColor: colors.surface, appBar: AppBar( diff --git a/apps/lib/shared/widgets/divination/divination_shared_widgets.dart b/apps/lib/shared/widgets/divination/divination_shared_widgets.dart index 85fbe5e..d317bc5 100644 --- a/apps/lib/shared/widgets/divination/divination_shared_widgets.dart +++ b/apps/lib/shared/widgets/divination/divination_shared_widgets.dart @@ -96,6 +96,8 @@ class _DivinationGuideDialogState extends State { final PageController _pageController = PageController(); int _currentPage = 0; + bool get _isLastPage => _currentPage == widget.guideImages.length - 1; + @override void dispose() { _pageController.dispose(); @@ -105,6 +107,8 @@ class _DivinationGuideDialogState extends State { @override Widget build(BuildContext context) { final l10n = AppLocalizations.of(context)!; + final colors = Theme.of(context).colorScheme; + final swipeHint = _guideSwipeHint(Localizations.localeOf(context)); return Dialog( child: SizedBox( width: 360, @@ -139,6 +143,10 @@ class _DivinationGuideDialogState extends State { child: Text( widget.instructions[_currentPage], textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: colors.onSurfaceVariant, + height: 1.45, + ), ), ), Padding( @@ -151,8 +159,14 @@ class _DivinationGuideDialogState extends State { child: SizedBox( width: double.infinity, child: FilledButton( - onPressed: () => Navigator.of(context).pop(), - child: Text(l10n.divinationIAcknowledge), + onPressed: _isLastPage + ? () => Navigator.of(context).pop() + : null, + child: Text( + _isLastPage + ? l10n.divinationIAcknowledge + : '${_currentPage + 1} / ${widget.guideImages.length} · $swipeHint', + ), ), ), ), @@ -161,4 +175,11 @@ class _DivinationGuideDialogState extends State { ), ); } + + String _guideSwipeHint(Locale locale) { + if (locale.languageCode == 'en') { + return 'Swipe left for the next step'; + } + return '左滑查看下一步'; + } }