引导、通知栏计时

This commit is contained in:
ytc1012
2025-11-24 10:33:09 +08:00
parent 149d1ed6cd
commit 2c6ced5c14
7 changed files with 496 additions and 28 deletions

View File

@@ -110,6 +110,24 @@ class _SettingsScreenState extends State<SettingsScreen> {
_showAboutDialog();
},
),
const Divider(color: AppColors.divider),
ListTile(
contentPadding: EdgeInsets.zero,
title: Text(
'Reset Onboarding',
style: AppTextStyles.bodyText.copyWith(
color: AppColors.textSecondary,
),
),
trailing: const Icon(
Icons.refresh,
size: 16,
color: AppColors.textSecondary,
),
onTap: () {
_resetOnboarding();
},
),
],
),
@@ -318,4 +336,40 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
);
}
void _resetOnboarding() async {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Reset Onboarding?'),
content: Text(
'This will show the onboarding screens again when you restart the app.',
style: AppTextStyles.bodyText,
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
TextButton(
onPressed: () async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove('onboarding_completed');
if (!context.mounted) return;
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Onboarding reset. Restart the app to see it again.'),
duration: Duration(seconds: 3),
),
);
},
child: const Text('Reset'),
),
],
),
);
}
}