diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index ec5490a..fa863b6 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -36,6 +36,23 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/main.dart b/lib/main.dart
index 7c6edeb..4215b16 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:movielab/constants/themes.dart';
import 'package:movielab/pages/main/profile/profile_controller.dart';
+import 'package:movielab/pages/show/show_page/show_page.dart';
import 'constants/routes.dart';
import 'models/hive/hive_helper/register_adapters.dart';
import 'models/hive/models/show_preview.dart';
@@ -22,9 +23,16 @@ void main() async {
runApp(const App());
}
-class App extends StatelessWidget {
+class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _AppState();
+}
+
+class _AppState extends State {
final String initRoute = splashScreenRoute;
+
@override
Widget build(BuildContext context) {
return MaterialApp(
@@ -32,6 +40,21 @@ class App extends StatelessWidget {
debugShowCheckedModeBanner: false,
theme: AppThemes.darkTheme,
initialRoute: initRoute,
+ onUnknownRoute: (settings) {
+ // ToDo: Setup deep link for iOS.
+ // ToDo: Improve router for Android(not launched).
+ final matches =
+ RegExp(r'(^\/title\/)(tt\d*)').firstMatch(settings.name.toString());
+ if (matches?.group(1).toString() == "/title/" &&
+ matches?.group(2).toString() != null) {
+ return MaterialPageRoute(
+ builder: (BuildContext context) =>
+ ShowPage(id: matches!.group(2).toString()),
+ );
+ }
+ return MaterialPageRoute(
+ builder: (BuildContext context) => const SplashScreen());
+ },
routes: {
splashScreenRoute: (context) => const SplashScreen(),
homeScreenRoute: (context) => const MainPage(),
@@ -51,12 +74,11 @@ Future? initializeHive() async {
Hive.openBox('artists');
}
-Future? initializeGetX() {
+Future? initializeGetX() async {
// Initialize the controllers
Get.put(MainController());
Get.put(HomeDataController());
Get.put(SearchBarController());
Get.put(ProfileController());
Get.put(CacheData());
- return null;
}
diff --git a/lib/pages/splash/splash_screen.dart b/lib/pages/splash/splash_screen.dart
index b7d5e95..3ee7103 100644
--- a/lib/pages/splash/splash_screen.dart
+++ b/lib/pages/splash/splash_screen.dart
@@ -11,7 +11,8 @@ import 'get_initial_data.dart';
import 'get_user_data.dart';
class SplashScreen extends StatefulWidget {
- const SplashScreen({Key? key}) : super(key: key);
+ const SplashScreen({Key? key, this.then}) : super(key: key);
+ final VoidCallback? then;
@override
State createState() => _SplashScreenState();