Files
GSFV2/gsf/lib/view_model/app_tour_controller.dart
2024-04-10 12:51:20 +05:30

307 lines
9.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gsp_app/views/theme.dart';
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
class AppTourController extends GetxController {
final navDrawer = GlobalKey();
final notifications = GlobalKey();
// final settings = GlobalKey();
final home = GlobalKey();
final Sessions = GlobalKey();
final bioMaker = GlobalKey();
final myRanking = GlobalKey();
final myProfile = GlobalKey();
void startAppTour(BuildContext context, VoidCallback laterAction) {
TutorialCoachMark(
colorShadow: const Color.fromARGB(255, 20, 31, 0),
opacityShadow: 0.975,
textStyleSkip: const TextStyle(
fontWeight: FontWeight.w700,
fontFamily: "Poppins",
color: ColorConstants.kPrimaryColor,
fontSize: 16,
),
targets: [
//nav drawer
TargetFocus(
identify: "navigationDrawer",
keyTarget: navDrawer,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.bottom,
builder: (context, controller) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
Text(
"Click here to open a drawer and explore option like,",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
SizedBox(height: 18),
Text(
"1. View/Edit Profile",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
SizedBox(height: 8),
// Text(
// "2. Visit GSF Instagram Page",
// style: TextStyle(
// color: Colors.white,
// fontSize: 16,
// ),
// ),
// SizedBox(height: 8),
Text(
"2. About GSF",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
SizedBox(height: 8),
Text(
"3. Watch Bites",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
SizedBox(height: 8),
Text(
"4. View Frequently Asked Questions",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
SizedBox(height: 8),
Text(
"5. Contact Us",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
// SizedBox(height: 8),
// Text(
// "7. Switch Between Light / Dark Theme",
// style: TextStyle(
// color: Colors.white,
// fontSize: 16,
// ),
// ),
SizedBox(height: 8),
Text(
"6. Logout from the Application",
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
],
);
},
),
],
),
//notifications
TargetFocus(
identify: "notifications",
keyTarget: notifications,
alignSkip: Alignment.topLeft,
contents: [
TargetContent(
align: ContentAlign.bottom,
builder: (context, controller) {
return const Align(
alignment: Alignment.topRight,
child: Text(
"Click here to view notification",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
//settings
// TargetFocus(
// identify: "settings",
// keyTarget: settings,
// alignSkip: Alignment.topLeft,
// contents: [
// TargetContent(
// align: ContentAlign.bottom,
// builder: (context, controller) {
// return const Align(
// alignment: Alignment.topRight,
// child: Text(
// "Click here to change settings",
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.w600,
// fontFamily: "SFPRO",
// fontSize: 18,
// ),
// ),
// );
// },
// ),
// ],
// ),
//home
TargetFocus(
identify: "home",
keyTarget: home,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.top,
builder: (context, controller) {
return const Align(
alignment: Alignment.centerLeft,
child: Text(
"Click here to visit home page",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
//live session
TargetFocus(
identify: "Sessions",
keyTarget: Sessions,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.top,
builder: (context, controller) {
return const Align(
alignment: Alignment.centerLeft,
child: Text(
"Click here to watch live Sessions",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
//Bio maker
TargetFocus(
identify: "bioMaker",
keyTarget: bioMaker,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.top,
builder: (context, controller) {
return const Align(
alignment: Alignment.centerLeft,
child: Text(
"Click here to connect your scale",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
//My ranking
TargetFocus(
identify: "myRanking",
keyTarget: myRanking,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.top,
builder: (context, controller) {
return const Align(
alignment: Alignment.centerLeft,
child: Text(
"Click here to view leaderboard",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
//profile
TargetFocus(
identify: "myProfile",
keyTarget: myProfile,
alignSkip: Alignment.topRight,
contents: [
TargetContent(
align: ContentAlign.top,
builder: (context, controller) {
return const Align(
alignment: Alignment.centerLeft,
child: Text(
"Click here for visiting bites section",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontFamily: "SFPRO",
fontSize: 18,
),
),
);
},
),
],
),
],
onSkip: laterAction,
onFinish: laterAction,
).show(context: context);
}
}