.github
.vscode
android
assets
buildtools
ios
lib
database
models
pods
screens
services
widgets
account
chat
content
post
realms
tour
techincal_review_intro.dart
tour.dart
alert.dart
app_scaffold.dart
check_in.dart
check_in.g.dart
context_menu.dart
response.dart
firebase_options.dart
main.dart
route.dart
route.gr.dart
linux
macos
web
windows
.gitignore
.metadata
README.md
analysis_options.yaml
build.yaml
devtools_options.yaml
firebase.json
pubspec.lock
pubspec.yaml
37 lines
1.0 KiB
Dart
37 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:island/services/tour.dart';
|
|
|
|
const List<String> kStartTours = ['technical_review_intro'];
|
|
|
|
class TourTriggerWidget extends HookConsumerWidget {
|
|
final Widget child;
|
|
const TourTriggerWidget({super.key, required this.child});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final tourStatus = ref.watch(tourStatusNotifierProvider.notifier);
|
|
|
|
useEffect(() {
|
|
Future(() async {
|
|
for (final tour in kStartTours) {
|
|
final widget = await tourStatus.showTour(tour);
|
|
if (widget != null) {
|
|
if (!context.mounted) return;
|
|
await showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
useRootNavigator: true,
|
|
context: context,
|
|
builder: (context) => widget,
|
|
);
|
|
}
|
|
}
|
|
});
|
|
return null;
|
|
}, [tourStatus]);
|
|
|
|
return child;
|
|
}
|
|
}
|