Skip to content

Commit

Permalink
feat: App Showcase implemented.
Browse files Browse the repository at this point in the history
  • Loading branch information
AritraBiswas9788 committed Aug 14, 2024
1 parent e99a7ff commit 43b387c
Show file tree
Hide file tree
Showing 15 changed files with 2,319 additions and 1,709 deletions.
39 changes: 33 additions & 6 deletions lib/components/navisland.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:latlong2/latlong.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:super_liquid_galaxy_controller/controllers/lg_connection.dart';
import 'package:super_liquid_galaxy_controller/controllers/showcase_controller.dart';
import 'package:super_liquid_galaxy_controller/data_class/coordinate.dart';
import 'package:super_liquid_galaxy_controller/screens/geoquest.dart';
import 'package:super_liquid_galaxy_controller/screens/kml_builder.dart';
Expand All @@ -13,7 +14,7 @@ import 'package:super_liquid_galaxy_controller/screens/tour_builder.dart';
import 'package:super_liquid_galaxy_controller/utils/balloongenerator.dart';
import 'package:super_liquid_galaxy_controller/utils/galaxy_colors.dart';
import 'package:super_liquid_galaxy_controller/utils/kmlgenerator.dart';

import 'package:showcaseview/showcaseview.dart';
import '../generated/assets.dart';
import '../utils/constants.dart';

Expand All @@ -30,6 +31,7 @@ class NavIsland extends StatelessWidget {
Function() changePlanet;

int i =0;
ShowcaseController showcaseController = Get.find();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -95,7 +97,12 @@ class NavIsland extends StatelessWidget {
{
await changePlanet();
}
Get.to(() => PoiExploration());
Get.to(() => ShowCaseWidget(
builder: (BuildContext context) { return PoiExploration(); },
onFinish: (){
showcaseController.setPOICompleted();
},
));
},
borderRadius: BorderRadius.circular(15),
child: Container(
Expand Down Expand Up @@ -142,7 +149,12 @@ class NavIsland extends StatelessWidget {
{
await changePlanet();
}
Get.to(() => TourBuilder());
Get.to(() =>ShowCaseWidget(
builder: (BuildContext context) { return TourBuilder(); },
onFinish: (){
showcaseController.setToursCompleted();
},
));
},
borderRadius: BorderRadius.circular(15),
child: Container(
Expand Down Expand Up @@ -201,7 +213,12 @@ class NavIsland extends StatelessWidget {
{
await changePlanet();
}
Get.to(()=>GeoQuest());
Get.to(()=>ShowCaseWidget(
builder: (BuildContext context) { return GeoQuest(); },
onFinish: (){
showcaseController.setGeoQuestCompleted();
},
));



Expand Down Expand Up @@ -291,7 +308,12 @@ class NavIsland extends StatelessWidget {
{
await changePlanet();
}
Get.to(() => MapController());
Get.to(() => ShowCaseWidget(
builder: (BuildContext context) { return MapController(); },
onFinish: (){
showcaseController.setMapsCompleted();
},
));
},
borderRadius: BorderRadius.circular(15),
child: Container(
Expand Down Expand Up @@ -354,7 +376,12 @@ class NavIsland extends StatelessWidget {
{
await changePlanet();
}
Get.to(() => KmlUploader());
Get.to(() => ShowCaseWidget(
builder: (BuildContext context) { return KmlUploader(); },
onFinish: (){
showcaseController.setKmlBuilderCompleted();
},
));
},
borderRadius: BorderRadius.circular(15),
child: Container(
Expand Down
152 changes: 152 additions & 0 deletions lib/controllers/showcase_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class ShowcaseController extends GetxController {
bool _isFirstLaunchDashboard = true;
bool _isFirstLaunchSettings = true;
bool _isFirstLaunchKmlBuilder = true;
bool _isFirstLaunchGeoQuest = true;
bool _isFirstLaunchMaps = true;
bool _isFirstLaunchTours = true;
bool _isFirstLaunchPOI = true;

void fetchFirstLaunch() async
{
SharedPreferences preferences = await SharedPreferences.getInstance();
var isFirst = preferences.getString('first_time_dashboard');
if(isFirst == null ||isFirst == 'true') {
_isFirstLaunchDashboard = true;
} else {
_isFirstLaunchDashboard = false;
}
isFirst = preferences.getString('first_time_settings');
if(isFirst == null || isFirst == 'true') {
_isFirstLaunchSettings = true;
} else {
_isFirstLaunchSettings = false;
}
isFirst = preferences.getString('first_time_kml_builder');

if(isFirst == null || isFirst == 'true') {
_isFirstLaunchKmlBuilder = true;
} else {
_isFirstLaunchKmlBuilder = false;
}

isFirst = preferences.getString('first_time_geoquest');

if(isFirst == null || isFirst == 'true') {
_isFirstLaunchGeoQuest = true;
} else {
_isFirstLaunchGeoQuest = false;
}

isFirst = preferences.getString('first_time_maps');

if(isFirst == null || isFirst == 'true') {
_isFirstLaunchMaps = true;
} else {
_isFirstLaunchMaps = false;
}

isFirst = preferences.getString('first_time_tours');

if(isFirst == null || isFirst == 'true') {
_isFirstLaunchTours = true;
} else {
_isFirstLaunchTours = false;
}

isFirst = preferences.getString('first_time_poi');

if(isFirst == null || isFirst == 'true') {
_isFirstLaunchPOI = true;
} else {
_isFirstLaunchPOI = false;
}

print("$_isFirstLaunchDashboard,$_isFirstLaunchSettings");
}

bool isFirstLaunchDashboard()
{
return _isFirstLaunchDashboard;
}

bool isFirstLaunchSettings()
{
return _isFirstLaunchSettings;
}
bool isFirstLaunchKmlBuilder()
{
return _isFirstLaunchKmlBuilder;
}
bool isFirstLaunchGeoQuest()
{
return _isFirstLaunchGeoQuest;
}
bool isFirstLaunchMap()
{
return _isFirstLaunchMaps;
}
bool isFirstLaunchTours()
{
return _isFirstLaunchTours;
}
bool isFirstLaunchPOI()
{
return _isFirstLaunchPOI;
}


setDashboardCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_dashboard', "false");
_isFirstLaunchDashboard = false;
print("set-dashboard-done");
}

setSettingsCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_settings', "false");
_isFirstLaunchSettings = false;
print("set-settings-done");
}

setKmlBuilderCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_kml_builder', "false");
_isFirstLaunchKmlBuilder = false;
print("set-kml-builder-done");
}

setGeoQuestCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_geoquest', "false");
_isFirstLaunchGeoQuest = false;
print("set-poi-done");
}

setMapsCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_maps', "false");
_isFirstLaunchMaps = false;
print("set-maps-done");
}

setToursCompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_tours', "false");
_isFirstLaunchTours = false;
print("set-tours-done");
}

setPOICompleted() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.setString('first_time_poi', "false");
_isFirstLaunchPOI = false;
print("set-poi-done");
}


}
6 changes: 6 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
import 'package:super_liquid_galaxy_controller/controllers/geoquest_controller.dart';
import 'package:super_liquid_galaxy_controller/controllers/showcase_controller.dart';
import 'package:super_liquid_galaxy_controller/data_class/coordinate.dart';
import 'package:super_liquid_galaxy_controller/data_class/place_info.dart';
import 'package:super_liquid_galaxy_controller/screens/dashboard.dart';
Expand All @@ -16,6 +17,7 @@ import 'package:super_liquid_galaxy_controller/controllers/map_movement_controll
import 'package:super_liquid_galaxy_controller/controllers/poi_controller.dart';
import 'package:super_liquid_galaxy_controller/controllers/speech_controller.dart';
import 'package:super_liquid_galaxy_controller/controllers/tour_controller.dart';
import 'package:showcaseview/showcaseview.dart';
import 'package:super_liquid_galaxy_controller/utils/wikidatafetcher.dart';

AndroidMapRenderer mapRenderer = AndroidMapRenderer.platformDefault;
Expand All @@ -31,11 +33,15 @@ void main() {
Get.lazyPut(() => TourController(),fenix: true);
Get.lazyPut(() => PoiController(),fenix: true);
Get.lazyPut(() => GeoQuestController(),fenix: true);
Get.lazyPut(() => ShowcaseController(),fenix: true);

// Get.lazyPut(() => WikiDataFetcher(), fenix: true);

LGConnection client = Get.find();
client.connectToLG();
ShowcaseController showcaseController = Get.find();
showcaseController.fetchFirstLaunch();

SystemChrome.setPreferredOrientations([
// Lock orientation to landscape
DeviceOrientation.landscapeRight,
Expand Down
Loading

0 comments on commit 43b387c

Please sign in to comment.