引导、通知栏计时
This commit is contained in:
@@ -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'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user