Commit 14524c51 authored by 卢克's avatar 卢克 Committed by GitHub

Merge pull request #611 from noborder/master_fork

add analysis_options.yaml and fix error
parents caa962a3 de5d109f
# Specify analysis options.
#
# Until there are meta linter rules, each desired lint must be explicitly enabled.
# See: https://github.com/dart-lang/linter/issues/288
#
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
# See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
#
# There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file:
#
# - analysis_options.yaml (this file)
# - packages/flutter/lib/analysis_options_user.yaml
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
#
# This file contains the analysis options used by Flutter tools, such as IntelliJ,
# Android Studio, and the `flutter analyze` command.
analyzer:
strong-mode:
implicit-dynamic: false
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
# treat missing returns as a warning (not a hint)
missing_return: warning
# allow having TODOs in the code
todo: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
exclude:
- "bin/cache/**"
# the following two are relative to the stocks example and the flutter package respectively
# see https://github.com/dart-lang/sdk/issues/28463
- "lib/i18n/messages_*.dart"
- "lib/src/http/**"
- "example/**"
- "example_swift/**"
- "test/**"
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
# - avoid_as # required for implicit-casts: true
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catching_errors # we do this commonly
- avoid_classes_with_only_static_members
# - avoid_double_and_int_checks # only useful when targeting JS runtime
- avoid_empty_else
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested
- avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # there are plenty of valid reasons to return null
# - avoid_returning_null_for_future # not yet tested
- avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested
# - avoid_shadowing_type_parameters # not yet tested
# - avoid_single_cascade_in_expression_statements # not yet tested
- avoid_slow_async_io
- avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
# - cascade_invocations # not yet tested
# - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not yet tested
# - diagnostic_describe_all_properties # not yet tested
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
# - file_names # not yet tested
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not yet tested
- library_names
- library_prefixes
# - lines_longer_than_80_chars # not yet tested
- list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
# - null_closures # not yet tested
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
# - prefer_asserts_with_message # not yet tested
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # not yet tested
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
- prefer_final_fields
# - prefer_final_in_for_each # not yet tested
- prefer_final_locals
# - prefer_for_elements_to_map_fromIterable # not yet tested
- prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # not yet tested
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
# - provide_deprecation_message # not yet tested
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters
- slash_for_doc_comments
# - sort_child_properties_last # not yet tested
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # too many false positives
# - unnecessary_await_in_return # not yet tested
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_this
- unrelated_type_equality_checks
# - unsafe_html # not yet tested
- use_full_hex_values_for_flutter_colors
# - use_function_type_syntax_for_parameters # not yet tested
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps
# - void_checks # not yet tested
Future<Map<String,dynamic>> open(String url,{Map<String,dynamic> urlParams,Map<String,dynamic> exts}){
}
void close(String id,{Map<String,dynamic> result,Map<String,dynamic> exts}){
}
\ No newline at end of file
...@@ -42,7 +42,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -42,7 +42,7 @@ class FirstRouteWidget extends StatelessWidget {
child: Text('Present second route'), child: Text('Present second route'),
onPressed: () { onPressed: () {
print("Present second page!"); print("Present second page!");
FlutterBoost.singleton.open("second",urlParams:{"present":true}).then((Map value) { FlutterBoost.singleton.open("second",urlParams:<dynamic,dynamic>{"present":true}).then((Map value) {
print( print(
"call me when page is finished. did recieve second route result $value"); "call me when page is finished. did recieve second route result $value");
}); });
...@@ -90,7 +90,7 @@ class SecondRouteWidget extends StatelessWidget { ...@@ -90,7 +90,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings = BoostContainerSettings settings =
BoostContainer.of(context).settings; BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId, FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"}); result: <dynamic,dynamic>{"result": "data from second"});
}, },
child: Text('Go back with result!'), child: Text('Go back with result!'),
), ),
...@@ -206,7 +206,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -206,7 +206,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://nativePage", urlParams: { .open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -223,7 +223,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -223,7 +223,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("first", urlParams: { .open("first", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -240,7 +240,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -240,7 +240,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("second", urlParams: { .open("second", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -257,7 +257,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -257,7 +257,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("tab", urlParams: { .open("tab", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -274,7 +274,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -274,7 +274,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://flutterPage", urlParams: { .open("sample://flutterPage", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -288,8 +288,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -288,8 +288,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
onTap: () { onTap: () {
Navigator.push(context, Navigator.push<dynamic>(context,
MaterialPageRoute(builder: (_) => PushWidget())); MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
}, },
), ),
...@@ -303,8 +303,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -303,8 +303,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
onTap: () { onTap: () {
Navigator.push(context, Navigator.push<dynamic>(context,
MaterialPageRoute(builder: (_) => PlatformRouteWidget())); MaterialPageRoute<dynamic>(builder: (_) => PlatformRouteWidget()));
}, },
), ),
InkWell( InkWell(
......
...@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> { ...@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> {
if (_node.hasFocus) { if (_node.hasFocus) {
print('showBottomSheet'); print('showBottomSheet');
_controller = Scaffold.of(context) _controller = Scaffold.of(context)
.showBottomSheet((BuildContext ctx) => Container( .showBottomSheet<dynamic>((BuildContext ctx) => Container(
width: double.infinity, width: double.infinity,
height: 36.0, height: 36.0,
color: Colors.deepPurple, color: Colors.deepPurple,
......
Future<Map<String,dynamic>> open(String url,{Map<String,dynamic> urlParams,Map<String,dynamic> exts}){
}
void close(String id,{Map<String,dynamic> result,Map<String,dynamic> exts}){
}
\ No newline at end of file
...@@ -38,7 +38,7 @@ class SecondRouteWidget extends StatelessWidget { ...@@ -38,7 +38,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings = BoostContainerSettings settings =
BoostContainer.of(context).settings; BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId, FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"}); result: <dynamic,dynamic>{"result": "data from second"});
}, },
child: Text('Go back with result!'), child: Text('Go back with result!'),
), ),
...@@ -102,7 +102,7 @@ class FlutterRouteWidget extends StatelessWidget { ...@@ -102,7 +102,7 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => onTap: () =>
FlutterBoost.singleton.open("sample://nativePage", urlParams: { FlutterBoost.singleton.open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -119,7 +119,7 @@ class FlutterRouteWidget extends StatelessWidget { ...@@ -119,7 +119,7 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => onTap: () =>
FlutterBoost.singleton.open("sample://flutterPage", urlParams: { FlutterBoost.singleton.open("sample://flutterPage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -133,8 +133,8 @@ class FlutterRouteWidget extends StatelessWidget { ...@@ -133,8 +133,8 @@ class FlutterRouteWidget extends StatelessWidget {
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
onTap: () { onTap: () {
Navigator.push( Navigator.push<dynamic>(
context, MaterialPageRoute(builder: (_) => PushWidget())); context, MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
}, },
), ),
InkWell( InkWell(
......
...@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> { ...@@ -134,7 +134,7 @@ class _TestTextFieldState extends State<TestTextField> {
if (_node.hasFocus) { if (_node.hasFocus) {
print('showBottomSheet'); print('showBottomSheet');
_controller = Scaffold.of(context) _controller = Scaffold.of(context)
.showBottomSheet((BuildContext ctx) => Container( .showBottomSheet<dynamic>((BuildContext ctx) => Container(
width: double.infinity, width: double.infinity,
height: 36.0, height: 36.0,
color: Colors.deepPurple, color: Colors.deepPurple,
......
name: flutter_boost_example name: example_swift
description: Demonstrates how to use the flutter_boost plugin. description: Demonstrates how to use the flutter_boost plugin.
# The following defines the version and build number for your application. # The following defines the version and build number for your application.
......
...@@ -36,7 +36,7 @@ class BoostChannel { ...@@ -36,7 +36,7 @@ class BoostChannel {
final Set<MethodHandler> _methodHandlers = Set(); final Set<MethodHandler> _methodHandlers = Set();
BoostChannel() { BoostChannel() {
_methodChannel.setMethodCallHandler((MethodCall call){ _methodChannel.setMethodCallHandler((MethodCall call) {
if (call.method == "__event__") { if (call.method == "__event__") {
String name = call.arguments["name"]; String name = call.arguments["name"];
Map arg = call.arguments["arguments"]; Map arg = call.arguments["arguments"];
...@@ -46,13 +46,13 @@ class BoostChannel { ...@@ -46,13 +46,13 @@ class BoostChannel {
l(name, arg); l(name, arg);
} }
} }
}else{ } else {
for(MethodHandler handler in _methodHandlers) { for (MethodHandler handler in _methodHandlers) {
handler(call); handler(call);
} }
} }
return Future.value(); return Future<dynamic>.value();
}); });
} }
...@@ -62,31 +62,33 @@ class BoostChannel { ...@@ -62,31 +62,33 @@ class BoostChannel {
} }
if (arguments == null) { if (arguments == null) {
arguments = Map(); arguments = Map<dynamic, dynamic>();
} }
Map msg = Map(); Map msg = Map<dynamic, dynamic>();
msg["name"] = name; msg["name"] = name;
msg["arguments"] = arguments; msg["arguments"] = arguments;
_methodChannel.invokeMethod("__event__", msg); _methodChannel.invokeMethod<dynamic>("__event__", msg);
} }
Future<T> invokeMethod<T>(String method, [ dynamic arguments ]) async { Future<T> invokeMethod<T>(String method, [dynamic arguments]) async {
assert(method != "__event__"); assert(method != "__event__");
return _methodChannel.invokeMethod<T>(method,arguments); return _methodChannel.invokeMethod<T>(method, arguments);
} }
Future<List<T>> invokeListMethod<T>(String method, [ dynamic arguments ]) async { Future<List<T>> invokeListMethod<T>(String method,
[dynamic arguments]) async {
assert(method != "__event__"); assert(method != "__event__");
return _methodChannel.invokeListMethod<T>(method,arguments); return _methodChannel.invokeListMethod<T>(method, arguments);
} }
Future<Map<K, V>> invokeMapMethod<K, V>(String method, [ dynamic arguments ]) async { Future<Map<K, V>> invokeMapMethod<K, V>(String method,
[dynamic arguments]) async {
assert(method != "__event__"); assert(method != "__event__");
return _methodChannel.invokeMapMethod<K, V>(method,arguments); return _methodChannel.invokeMapMethod<K, V>(method, arguments);
} }
VoidCallback addEventListener(String name, EventListener listener) { VoidCallback addEventListener(String name, EventListener listener) {
...@@ -110,7 +112,7 @@ class BoostChannel { ...@@ -110,7 +112,7 @@ class BoostChannel {
_methodHandlers.add(handler); _methodHandlers.add(handler);
return (){ return () {
_methodHandlers.remove(handler); _methodHandlers.remove(handler);
}; };
} }
......
...@@ -156,7 +156,6 @@ class BoostContainerState extends NavigatorState { ...@@ -156,7 +156,6 @@ class BoostContainerState extends NavigatorState {
@override @override
void didUpdateWidget(Navigator oldWidget) { void didUpdateWidget(Navigator oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
} }
@override @override
...@@ -190,6 +189,7 @@ class BoostContainerState extends NavigatorState { ...@@ -190,6 +189,7 @@ class BoostContainerState extends NavigatorState {
break; break;
} }
} }
return false;
} }
@override @override
...@@ -259,13 +259,10 @@ class ContainerElement extends StatefulElement { ...@@ -259,13 +259,10 @@ class ContainerElement extends StatefulElement {
} }
class ContainerNavigatorObserver extends NavigatorObserver { class ContainerNavigatorObserver extends NavigatorObserver {
static final Set<NavigatorObserver> boostObservers = Set<NavigatorObserver>();
static final Set<NavigatorObserver> boostObservers =
Set<NavigatorObserver>();
ContainerNavigatorObserver(); ContainerNavigatorObserver();
factory ContainerNavigatorObserver.bindContainerManager() => factory ContainerNavigatorObserver.bindContainerManager() =>
ContainerNavigatorObserver(); ContainerNavigatorObserver();
...@@ -307,4 +304,3 @@ class ContainerNavigatorObserver extends NavigatorObserver { ...@@ -307,4 +304,3 @@ class ContainerNavigatorObserver extends NavigatorObserver {
} }
} }
} }
...@@ -266,13 +266,11 @@ class ContainerCoordinator { ...@@ -266,13 +266,11 @@ class ContainerCoordinator {
} }
bool _nativeContainerWillDealloc(String name, Map params, String pageId) { bool _nativeContainerWillDealloc(String name, Map params, String pageId) {
try{ try {
performContainerLifeCycle(_createContainerSettings(name, params, pageId), performContainerLifeCycle(_createContainerSettings(name, params, pageId),
ContainerLifeCycle.Destroy); ContainerLifeCycle.Destroy);
} catch (e){ } catch (e) {
Logger.log( Logger.log('nativeContainerWillDealloc error: ${e}');
'nativeContainerWillDealloc error: ${e}' );
} }
FlutterBoost.containerManager?.remove(pageId); FlutterBoost.containerManager?.remove(pageId);
......
...@@ -76,7 +76,6 @@ class ContainerManagerState extends State<BoostContainerManager> { ...@@ -76,7 +76,6 @@ class ContainerManagerState extends State<BoostContainerManager> {
bool get foreground => _foreground; bool get foreground => _foreground;
//Number of containers. //Number of containers.
int get containerCounts => _offstage.length; int get containerCounts => _offstage.length;
...@@ -138,7 +137,8 @@ class ContainerManagerState extends State<BoostContainerManager> { ...@@ -138,7 +137,8 @@ class ContainerManagerState extends State<BoostContainerManager> {
properties['newName'] = now; properties['newName'] = now;
properties['oldName'] = old; properties['oldName'] = old;
FlutterBoost.singleton.channel.invokeMethod('onShownContainerChanged',properties); FlutterBoost.singleton.channel
.invokeMethod<dynamic>('onShownContainerChanged', properties);
} }
void _refreshOverlayEntries() { void _refreshOverlayEntries() {
...@@ -345,4 +345,3 @@ class _ContainerOverlayEntry extends OverlayEntry { ...@@ -345,4 +345,3 @@ class _ContainerOverlayEntry extends OverlayEntry {
super.remove(); super.remove();
} }
} }
...@@ -44,7 +44,6 @@ typedef void PostPushRoute( ...@@ -44,7 +44,6 @@ typedef void PostPushRoute(
String url, String uniqueId, Map params, Route route, Future result); String url, String uniqueId, Map params, Route route, Future result);
class FlutterBoost { class FlutterBoost {
static final FlutterBoost _instance = FlutterBoost(); static final FlutterBoost _instance = FlutterBoost();
final GlobalKey<ContainerManagerState> containerManagerKey = final GlobalKey<ContainerManagerState> containerManagerKey =
GlobalKey<ContainerManagerState>(); GlobalKey<ContainerManagerState>();
...@@ -58,21 +57,16 @@ class FlutterBoost { ...@@ -58,21 +57,16 @@ class FlutterBoost {
static TransitionBuilder init( static TransitionBuilder init(
{TransitionBuilder builder, {TransitionBuilder builder,
PrePushRoute prePush, PrePushRoute prePush,
PostPushRoute postPush}) { PostPushRoute postPush}) {
if (Platform.isAndroid) {
if(Platform.isAndroid){ WidgetsBinding.instance.addPostFrameCallback((_) {
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo) {
WidgetsBinding.instance.addPostFrameCallback((_){
singleton.channel.invokeMethod<Map>('pageOnStart').then((Map pageInfo){
if (pageInfo == null || pageInfo.isEmpty) return; if (pageInfo == null || pageInfo.isEmpty) return;
if (pageInfo.containsKey("name") && if (pageInfo.containsKey("name") &&
pageInfo.containsKey("params") && pageInfo.containsKey("params") &&
pageInfo.containsKey("uniqueId")) { pageInfo.containsKey("uniqueId")) {
ContainerCoordinator.singleton.nativeContainerDidShow( ContainerCoordinator.singleton.nativeContainerDidShow(
pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]); pageInfo["name"], pageInfo["params"], pageInfo["uniqueId"]);
} }
...@@ -80,7 +74,6 @@ class FlutterBoost { ...@@ -80,7 +74,6 @@ class FlutterBoost {
}); });
} }
return (BuildContext context, Widget child) { return (BuildContext context, Widget child) {
assert(child is Navigator, 'child must be Navigator, what is wrong?'); assert(child is Navigator, 'child must be Navigator, what is wrong?');
...@@ -102,7 +95,7 @@ class FlutterBoost { ...@@ -102,7 +95,7 @@ class FlutterBoost {
BoostChannel get channel => _boostChannel; BoostChannel get channel => _boostChannel;
FlutterBoost(){ FlutterBoost() {
ContainerCoordinator(_boostChannel); ContainerCoordinator(_boostChannel);
} }
...@@ -116,30 +109,29 @@ class FlutterBoost { ...@@ -116,30 +109,29 @@ class FlutterBoost {
ContainerCoordinator.singleton.registerPageBuilders(builders); ContainerCoordinator.singleton.registerPageBuilders(builders);
} }
Future<Map<dynamic,dynamic>> open(String url,{Map<dynamic,dynamic> urlParams,Map<dynamic,dynamic> exts}){ Future<Map<dynamic, dynamic>> open(String url,
{Map<dynamic, dynamic> urlParams, Map<dynamic, dynamic> exts}) {
Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>(); Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>();
properties["url"] = url; properties["url"] = url;
properties["urlParams"] = urlParams; properties["urlParams"] = urlParams;
properties["exts"] = exts; properties["exts"] = exts;
return channel.invokeMethod<Map<dynamic,dynamic>>( return channel.invokeMethod<Map<dynamic, dynamic>>('openPage', properties);
'openPage', properties);
} }
Future<bool> close(String id,{Map<dynamic,dynamic> result,Map<dynamic,dynamic> exts}){ Future<bool> close(String id,
{Map<dynamic, dynamic> result, Map<dynamic, dynamic> exts}) {
assert(id != null); assert(id != null);
BoostContainerSettings settings = containerManager?.onstageSettings; BoostContainerSettings settings = containerManager?.onstageSettings;
Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>(); Map<dynamic, dynamic> properties = new Map<dynamic, dynamic>();
if(exts == null){ if (exts == null) {
exts = Map<dynamic,dynamic>(); exts = Map<dynamic, dynamic>();
} }
exts["params"] = settings.params; exts["params"] = settings.params;
if(!exts.containsKey("animated")){ if (!exts.containsKey("animated")) {
exts["animated"] = true; exts["animated"] = true;
} }
...@@ -155,28 +147,30 @@ class FlutterBoost { ...@@ -155,28 +147,30 @@ class FlutterBoost {
return channel.invokeMethod<bool>('closePage', properties); return channel.invokeMethod<bool>('closePage', properties);
} }
Future<bool> closeCurrent({Map<String,dynamic> result,Map<String,dynamic> exts}) { Future<bool> closeCurrent(
{Map<String, dynamic> result, Map<String, dynamic> exts}) {
BoostContainerSettings settings = containerManager?.onstageSettings; BoostContainerSettings settings = containerManager?.onstageSettings;
if(exts == null){ if (exts == null) {
exts = Map<String,dynamic>(); exts = Map<String, dynamic>();
} }
exts["params"] = settings.params; exts["params"] = settings.params;
if(!exts.containsKey("animated")){ if (!exts.containsKey("animated")) {
exts["animated"] = true; exts["animated"] = true;
} }
return close(settings.uniqueId,result: result,exts: exts); return close(settings.uniqueId, result: result, exts: exts);
} }
Future<bool> closeByContext(BuildContext context,{Map<String,dynamic> result,Map<String,dynamic> exts}) { Future<bool> closeByContext(BuildContext context,
{Map<String, dynamic> result, Map<String, dynamic> exts}) {
BoostContainerSettings settings = containerManager?.onstageSettings; BoostContainerSettings settings = containerManager?.onstageSettings;
if(exts == null){ if (exts == null) {
exts = Map<String,dynamic>(); exts = Map<String, dynamic>();
} }
exts["params"] = settings.params; exts["params"] = settings.params;
if(!exts.containsKey("animated")){ if (!exts.containsKey("animated")) {
exts["animated"] = true; exts["animated"] = true;
} }
return close(settings.uniqueId,result: result,exts: exts); return close(settings.uniqueId, result: result, exts: exts);
} }
///register for Container changed callbacks ///register for Container changed callbacks
...@@ -191,6 +185,4 @@ class FlutterBoost { ...@@ -191,6 +185,4 @@ class FlutterBoost {
///register callbacks for Navigators push & pop ///register callbacks for Navigators push & pop
void addBoostNavigatorObserver(NavigatorObserver observer) => void addBoostNavigatorObserver(NavigatorObserver observer) =>
ContainerNavigatorObserver.boostObservers.add(observer); ContainerNavigatorObserver.boostObservers.add(observer);
} }
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
class Logger { class Logger {
static void log(String msg) { static void log(String msg) {
assert((){ assert(() {
print('FlutterBoost#$msg'); print('FlutterBoost#$msg');
return true; return true;
}()); }());
......
...@@ -11,9 +11,8 @@ dependencies: ...@@ -11,9 +11,8 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
pedantic: ^1.8.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mockito: 4.1.1 mockito: 4.1.1
......
...@@ -22,10 +22,10 @@ void main() { ...@@ -22,10 +22,10 @@ void main() {
response = null; response = null;
test('sendEvent successfully', () async { test('sendEvent successfully', () async {
Map msg1 = Map(); Map msg1 = Map<dynamic,dynamic>();
BoostChannel().sendEvent("name", msg1); BoostChannel().sendEvent("name", msg1);
Map msg = Map(); Map msg = Map<dynamic,dynamic>();
msg["name"] = "name"; msg["name"] = "name";
msg["arguments"] = msg1; msg["arguments"] = msg1;
...@@ -38,9 +38,9 @@ void main() { ...@@ -38,9 +38,9 @@ void main() {
test('invokeMethod successfully', () async { test('invokeMethod successfully', () async {
Map msg = {}; Map msg = <dynamic,dynamic>{};
msg["test"] = "test"; msg["test"] = "test";
BoostChannel().invokeMethod("__event__1", msg); BoostChannel().invokeMethod<dynamic>("__event__1", msg);
// expect(e, isException); // expect(e, isException);
...@@ -52,9 +52,9 @@ void main() { ...@@ -52,9 +52,9 @@ void main() {
test('invokeListMethod successfully', () async { test('invokeListMethod successfully', () async {
Map msg = {}; Map msg = <dynamic,dynamic>{};
msg["test"] = "test"; msg["test"] = "test";
var bb = await BoostChannel().invokeListMethod("__event__1", msg); var bb = await BoostChannel().invokeListMethod<dynamic>("__event__1", msg);
expect( expect(
log, log,
...@@ -64,9 +64,9 @@ void main() { ...@@ -64,9 +64,9 @@ void main() {
test('invokeMapMethod successfully', () async { test('invokeMapMethod successfully', () async {
Map msg = {}; Map msg = <dynamic,dynamic>{};
msg["test"] = "test"; msg["test"] = "test";
BoostChannel().invokeMapMethod("__event__1", msg); BoostChannel().invokeMapMethod<dynamic,dynamic>("__event__1", msg);
expect( expect(
log, log,
...@@ -75,9 +75,9 @@ void main() { ...@@ -75,9 +75,9 @@ void main() {
}); });
test('invokeMapMethod successfully', () async { test('invokeMapMethod successfully', () async {
Map msg = {}; Map msg = <dynamic,dynamic>{};
msg["test"] = "test"; msg["test"] = "test";
BoostChannel().invokeMapMethod("__event__1", msg); BoostChannel().invokeMapMethod<dynamic,dynamic>("__event__1", msg);
expect( expect(
log, log,
......
...@@ -49,8 +49,8 @@ void main() { ...@@ -49,8 +49,8 @@ void main() {
testWidgets( testWidgets(
'obtain BoostPageRoute through the `BoostPageRoute.of(context)` method', 'obtain BoostPageRoute through the `BoostPageRoute.of(context)` method',
(WidgetTester tester) async { (WidgetTester tester) async {
var boostPageRoute; dynamic boostPageRoute;
var boostPageRouteFindByOfMethod; dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
builder: (context) { builder: (context) {
return FloatingActionButton( return FloatingActionButton(
onPressed: () { onPressed: () {
boostPageRouteFindByOfMethod = BoostPageRoute.of(context); boostPageRouteFindByOfMethod = BoostPageRoute.of<dynamic>(context);
}, },
); );
}, },
...@@ -83,12 +83,12 @@ void main() { ...@@ -83,12 +83,12 @@ void main() {
'try to find BoostPageRoute through the `BoostPageRoute.of(context)` method, ' 'try to find BoostPageRoute through the `BoostPageRoute.of(context)` method, '
'but it doesn\'t exist, the method should throw an Exception', 'but it doesn\'t exist, the method should throw an Exception',
(WidgetTester tester) async { (WidgetTester tester) async {
var contextCache; dynamic contextCache;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute( return MaterialPageRoute<dynamic>(
settings: settings, settings: settings,
builder: (context) => Builder( builder: (context) => Builder(
builder: (context) => FloatingActionButton( builder: (context) => FloatingActionButton(
...@@ -103,14 +103,14 @@ void main() { ...@@ -103,14 +103,14 @@ void main() {
); );
await tester.tap(find.byType(FloatingActionButton)); await tester.tap(find.byType(FloatingActionButton));
expect(() => BoostPageRoute.of(contextCache), throwsException); expect(() => BoostPageRoute.of<dynamic>(contextCache), throwsException);
}); });
testWidgets( testWidgets(
'obtain BoostPageRoute through the `BoostPageRoute.tryOf(context)` method', 'obtain BoostPageRoute through the `BoostPageRoute.tryOf(context)` method',
(WidgetTester tester) async { (WidgetTester tester) async {
var boostPageRoute; dynamic boostPageRoute;
var boostPageRouteFindByOfMethod; dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
return FloatingActionButton( return FloatingActionButton(
onPressed: () { onPressed: () {
boostPageRouteFindByOfMethod = boostPageRouteFindByOfMethod =
BoostPageRoute.tryOf(context); BoostPageRoute.tryOf<dynamic>(context);
}, },
); );
}, },
...@@ -145,19 +145,19 @@ void main() { ...@@ -145,19 +145,19 @@ void main() {
'try to find BoostPageRoute through the `BoostPageRoute.tryOf(context)` method, ' 'try to find BoostPageRoute through the `BoostPageRoute.tryOf(context)` method, '
'but it doesn\'t exist, the method should return null', 'but it doesn\'t exist, the method should return null',
(WidgetTester tester) async { (WidgetTester tester) async {
var boostPageRouteFindByOfMethod; dynamic boostPageRouteFindByOfMethod;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute( return MaterialPageRoute<dynamic>(
settings: settings, settings: settings,
builder: (BuildContext context) => Builder( builder: (BuildContext context) => Builder(
builder: (context) { builder: (context) {
return FloatingActionButton( return FloatingActionButton(
onPressed: () { onPressed: () {
boostPageRouteFindByOfMethod = boostPageRouteFindByOfMethod =
BoostPageRoute.tryOf(context); BoostPageRoute.tryOf<dynamic>(context);
}, },
); );
}, },
......
...@@ -20,12 +20,12 @@ class MockBoostChannel extends BoostChannel implements Mock { ...@@ -20,12 +20,12 @@ class MockBoostChannel extends BoostChannel implements Mock {
VoidCallback addEventListener(String name, EventListener listener) { VoidCallback addEventListener(String name, EventListener listener) {
_testEventListener = listener; _testEventListener = listener;
super.addEventListener(name, listener); return super.addEventListener(name, listener);
} }
VoidCallback addMethodHandler(MethodHandler handler) { VoidCallback addMethodHandler(MethodHandler handler) {
_testHandler = handler; _testHandler = handler;
super.addMethodHandler(handler); return super.addMethodHandler(handler);
} }
} }
...@@ -39,9 +39,9 @@ void main() { ...@@ -39,9 +39,9 @@ void main() {
MockBoostChannel boostChannel = MockBoostChannel(); MockBoostChannel boostChannel = MockBoostChannel();
ContainerCoordinator(boostChannel); ContainerCoordinator(boostChannel);
final Map arguments = {}; final Map arguments =<dynamic,dynamic> {};
arguments["pageName"] = "pageName"; arguments["pageName"] = "pageName";
arguments["params"] = {}; arguments["params"] = <dynamic,dynamic>{};
arguments["uniqueId"] = "xxxxx"; arguments["uniqueId"] = "xxxxx";
MethodCall call = MethodCall('didInitPageContainer', arguments); MethodCall call = MethodCall('didInitPageContainer', arguments);
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
Map arg = {'type': 'backPressedCallback'}; Map arg = <dynamic,dynamic>{'type': 'backPressedCallback'};
try { try {
boostChannel.testEventListener("lifecycle", arg); boostChannel.testEventListener("lifecycle", arg);
} catch (e) { } catch (e) {
...@@ -106,21 +106,21 @@ void main() { ...@@ -106,21 +106,21 @@ void main() {
Map arg2 = {'type': 'foreground'}; Map arg2 = <dynamic,dynamic>{'type': 'foreground'};
try { try {
boostChannel.testEventListener("lifecycle", arg2); boostChannel.testEventListener("lifecycle", arg2);
} catch (e) { } catch (e) {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
Map arg3 = {'type': 'background'}; Map arg3 = <dynamic,dynamic>{'type': 'background'};
try { try {
boostChannel.testEventListener("lifecycle", arg3); boostChannel.testEventListener("lifecycle", arg3);
} catch (e) { } catch (e) {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
Map arg4 = {'type': 'scheduleFrame'}; Map arg4 = <dynamic,dynamic>{'type': 'scheduleFrame'};
try { try {
boostChannel.testEventListener("lifecycle", arg4); boostChannel.testEventListener("lifecycle", arg4);
} catch (e) { } catch (e) {
......
...@@ -34,13 +34,13 @@ void main() { ...@@ -34,13 +34,13 @@ void main() {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
try { try {
FlutterBoost.singleton.closeCurrent(result: {}, exts: {}); FlutterBoost.singleton.closeCurrent(result: <String,dynamic>{}, exts: <String,dynamic>{});
} catch (e) { } catch (e) {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
try { try {
FlutterBoost.singleton.closeByContext(null, result: {}, exts: {}); FlutterBoost.singleton.closeByContext(null, result: <String,dynamic>{}, exts: <String,dynamic>{});
} catch (e) { } catch (e) {
expect(e, isNoSuchMethodError); expect(e, isNoSuchMethodError);
} }
......
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
); );
//open firt page //open firt page
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000"); .nativeContainerDidShow("first", <dynamic,dynamic>{}, "1000000");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
//open second page firt(1000000)->second(2000000) //open second page firt(1000000)->second(2000000)
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000000"); .nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000000");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
// second page ,but pageId is 2000001 firt(1000000)->second(2000001) // second page ,but pageId is 2000001 firt(1000000)->second(2000001)
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001"); .nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000001");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -107,7 +107,7 @@ void main() { ...@@ -107,7 +107,7 @@ void main() {
//reopen firt page second(2000001)->firt(1000000) //reopen firt page second(2000001)->firt(1000000)
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000"); .nativeContainerDidShow("first",<dynamic,dynamic> {}, "1000000");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
// reopen second page and pageId is 2000001 firt(1000000)->second(2000001) // reopen second page and pageId is 2000001 firt(1000000)->second(2000001)
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001"); .nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000001");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
// open second(2000003) // open second(2000003)
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000003"); .nativeContainerDidShow("second", <dynamic,dynamic>{}, "2000003");
await tester.idle(); await tester.idle();
......
...@@ -30,7 +30,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -30,7 +30,7 @@ class FirstRouteWidget extends StatelessWidget {
child: Text('Present second route'), child: Text('Present second route'),
onPressed: () { onPressed: () {
print("Present second page!"); print("Present second page!");
FlutterBoost.singleton.open("second",urlParams:{"present":true}).then((Map value) { FlutterBoost.singleton.open("second",urlParams:<dynamic,dynamic>{"present":true}).then((Map value) {
print( print(
"call me when page is finished. did recieve second route result $value"); "call me when page is finished. did recieve second route result $value");
}); });
...@@ -78,7 +78,7 @@ class SecondRouteWidget extends StatelessWidget { ...@@ -78,7 +78,7 @@ class SecondRouteWidget extends StatelessWidget {
BoostContainerSettings settings = BoostContainerSettings settings =
BoostContainer.of(context).settings; BoostContainer.of(context).settings;
FlutterBoost.singleton.close(settings.uniqueId, FlutterBoost.singleton.close(settings.uniqueId,
result: {"result": "data from second"}); result:<dynamic,dynamic>{"result": "data from second"});
}, },
child: Text('Go back with result!'), child: Text('Go back with result!'),
), ),
...@@ -172,7 +172,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -172,7 +172,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://nativePage", urlParams: { .open("sample://nativePage", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -189,7 +189,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -189,7 +189,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("first", urlParams: { .open("first", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -206,7 +206,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -206,7 +206,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("second", urlParams: { .open("second", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -223,7 +223,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -223,7 +223,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("tab", urlParams: { .open("tab", urlParams: <dynamic,dynamic>{
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -240,7 +240,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -240,7 +240,7 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://flutterPage", urlParams: { .open("sample://flutterPage", urlParams:<dynamic,dynamic> {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -254,8 +254,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -254,8 +254,8 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
onTap: () { onTap: () {
Navigator.push(context, Navigator.push<dynamic>(context,
MaterialPageRoute(builder: (_) => PushWidget())); MaterialPageRoute<dynamic>(builder: (_) => PushWidget()));
}, },
), ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment