| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /*
- * fluro
- * Created by Yakka
- * https://theyakka.com
- *
- * Copyright (c) 2019 Yakka, LLC. All rights reserved.
- * See LICENSE for distribution and usage details.
- */
- import '../helpers/color_helpers.dart';
- import '../components/demo/demo_simple_component.dart';
- import '../components/home/home_component.dart';
- import 'package:flutter/painting.dart';
- import 'package:fluro/fluro.dart';
- import 'package:flutter/material.dart';
- var rootHandler = Handler(
- handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
- return HomeComponent();
- });
- var demoRouteHandler = Handler(
- handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
- String? message = params["message"]?.first;
- String? colorHex = params["color_hex"]?.first;
- String? result = params["result"]?.first;
- Color color = Color(0xFFFFFFFF);
- if (colorHex != null && colorHex.length > 0) {
- color = Color(ColorHelpers.fromHexString(colorHex));
- }
- return DemoSimpleComponent(
- message: message ?? 'Testing', color: color, result: result);
- });
- var demoFunctionHandler = Handler(
- type: HandlerType.function,
- handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
- String? message = params["message"]?.first;
- showDialog(
- context: context!,
- builder: (context) {
- return AlertDialog(
- title: Text(
- "Hey Hey!",
- style: TextStyle(
- color: const Color(0xFF00D6F7),
- fontFamily: "Lazer84",
- fontSize: 22.0,
- ),
- ),
- content: Text("$message"),
- actions: <Widget>[
- Padding(
- padding: EdgeInsets.only(bottom: 8.0, right: 8.0),
- child: TextButton(
- onPressed: () {
- Navigator.of(context).pop(true);
- },
- child: Text("OK"),
- ),
- ),
- ],
- );
- },
- );
- return;
- });
- /// Handles deep links into the app
- /// To test on Android:
- ///
- /// `adb shell am start -W -a android.intent.action.VIEW -d "fluro://deeplink?path=/message&mesage=fluro%20rocks%21%21" com.theyakka.fluro`
- var deepLinkHandler = Handler(
- handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
- String? colorHex = params["color_hex"]?.first;
- String? result = params["result"]?.first;
- Color color = Color(0xFFFFFFFF);
- if (colorHex != null && colorHex.length > 0) {
- color = Color(ColorHelpers.fromHexString(colorHex));
- }
- return DemoSimpleComponent(
- message: "DEEEEEP LINK!!!", color: color, result: result);
- });
|