showOnce static method
Future<bool>
showOnce(
- BuildContext context, {
- required String id,
- required List<
NmTourPage> pages,
Shows the tour unless it was completed before under id; returns whether it was shown.
Implementation
static Future<bool> showOnce(BuildContext context, {required String id, required List<NmTourPage> pages}) async {
final prefs = await SharedPreferences.getInstance();
final key = 'nm_tour_seen_$id';
if (prefs.getBool(key) ?? false) return false;
if (!context.mounted) return false;
await showDialog<void>(
context: context,
barrierDismissible: false,
builder: (ctx) => NmFeatureTour(
pages: pages,
onComplete: () {
prefs.setBool(key, true);
Navigator.of(ctx).pop();
},
),
);
return true;
}