Updates example project to support array parameters.

This commit is contained in:
Tudor Luca 2018-02-16 16:00:59 +02:00
parent 70a71b6df6
commit 72a059bc0e
1 changed files with 11 additions and 12 deletions

View File

@ -11,10 +11,10 @@ import 'package:flutter/painting.dart';
import 'package:fluro/fluro.dart'; import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
var demoRouteHandler = new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { var demoRouteHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String message = params["message"]; String message = params["message"]?.first;
String colorHex = params["color_hex"]; String colorHex = params["color_hex"]?.first;
String result = params["result"]; String result = params["result"]?.first;
Color color = new Color(0xFFFFFFFF); Color color = new Color(0xFFFFFFFF);
if (colorHex != null && colorHex.length > 0) { if (colorHex != null && colorHex.length > 0) {
color = new Color(ColorHelpers.fromHexString(colorHex)); color = new Color(ColorHelpers.fromHexString(colorHex));
@ -22,11 +22,12 @@ var demoRouteHandler = new Handler(handlerFunc: (BuildContext context, Map<Strin
return new DemoSimpleComponent(message: message, color: color, result: result); return new DemoSimpleComponent(message: message, color: color, result: result);
}); });
var demoFunctionHandler = new Handler(type: HandlerType.function, var demoFunctionHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, dynamic> params) type: HandlerType.function,
{ handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String message = params["message"]; String message = params["message"]?.first;
showDialog(context: context, showDialog(
context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text( title: new Text(
"Hey Hey!", "Hey Hey!",
@ -52,6 +53,4 @@ var demoFunctionHandler = new Handler(type: HandlerType.function,
); );
}); });
var deepLinkHandler = new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { var deepLinkHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {});
});