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