| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * fluro
- * A Posse Production
- * http://goposse.com
- * Copyright (c) 2018 Posse Productions LLC. All rights reserved.
- * 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';
- import '../../config/routes.dart';
- 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() {
- final router = new Router();
- 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(),
- );
- }
- }
|