2017-05-28 13:13:36 -04:00
|
|
|
/*
|
|
|
|
* fluro
|
|
|
|
* A Posse Production
|
|
|
|
* http://goposse.com
|
2018-01-17 00:12:32 -05:00
|
|
|
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
2017-05-28 13:13:36 -04:00
|
|
|
* See LICENSE for distribution and usage details.
|
|
|
|
*/
|
|
|
|
import '../../config/application.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:fluro/fluro.dart';
|
2017-10-06 16:35:51 -04:00
|
|
|
import '../../config/routes.dart';
|
2017-05-28 13:13:36 -04:00
|
|
|
import '../home/home_component.dart';
|
|
|
|
|
|
|
|
class AppComponent extends StatefulWidget {
|
|
|
|
|
|
|
|
@override
|
|
|
|
State createState() {
|
|
|
|
return new AppComponentState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppComponentState extends State<AppComponent> {
|
|
|
|
|
|
|
|
static MethodChannel platform = const MethodChannel('channel:com.goposse.routersample/deeplink');
|
|
|
|
|
|
|
|
AppComponentState() {
|
2018-01-17 00:12:32 -05:00
|
|
|
final router = new Router();
|
2017-05-28 13:13:36 -04:00
|
|
|
Routes.configureRoutes(router);
|
|
|
|
Application.router = router;
|
|
|
|
configureDeepLinker();
|
|
|
|
print("Configured channel receiver in flutter ..");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void configureDeepLinker() {
|
|
|
|
platform.setMethodCallHandler((MethodCall call) async {
|
|
|
|
if (call.method == "linkReceived") {
|
|
|
|
Map<String, dynamic> passedObjs = call.arguments;
|
|
|
|
if (passedObjs != null) {
|
|
|
|
var path = passedObjs["path"];
|
|
|
|
Application.router.navigateTo(context, path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return new MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: new ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
|
|
|
home: new HomeComponent(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|