Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_boost_1.22.4
Commits
b1b34f72
Commit
b1b34f72
authored
5 years ago
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dart code xservice dependency
parent
7b58b614
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
128 additions
and
175 deletions
+128
-175
lib/AIOService/NavigationService/service/NavigationServiceRegister.dart
.../NavigationService/service/NavigationServiceRegister.dart
+0
-48
lib/container/container_coordinator.dart
lib/container/container_coordinator.dart
+3
-3
lib/container/container_manager.dart
lib/container/container_manager.dart
+1
-1
lib/flutter_boost.dart
lib/flutter_boost.dart
+27
-4
lib/messaging/base/message_dispatcher.dart
lib/messaging/base/message_dispatcher.dart
+47
-0
lib/messaging/base/message_handler.dart
lib/messaging/base/message_handler.dart
+11
-13
lib/messaging/handlers/did_disappear_page_container_handler.dart
...saging/handlers/did_disappear_page_container_handler.dart
+2
-11
lib/messaging/handlers/did_init_page_container_handler.dart
lib/messaging/handlers/did_init_page_container_handler.dart
+5
-9
lib/messaging/handlers/did_show_page_container_handler.dart
lib/messaging/handlers/did_show_page_container_handler.dart
+2
-12
lib/messaging/handlers/on_native_page_result_handler.dart
lib/messaging/handlers/on_native_page_result_handler.dart
+2
-11
lib/messaging/handlers/will_dealloc_page_container_handler.dart
...ssaging/handlers/will_dealloc_page_container_handler.dart
+2
-13
lib/messaging/handlers/will_disappear_page_container_handler.dart
...aging/handlers/will_disappear_page_container_handler.dart
+2
-12
lib/messaging/handlers/will_show_page_container_handler.dart
lib/messaging/handlers/will_show_page_container_handler.dart
+2
-12
lib/messaging/message_proxy.dart
lib/messaging/message_proxy.dart
+1
-1
lib/messaging/page_result_mediator.dart
lib/messaging/page_result_mediator.dart
+1
-1
lib/messaging/service/navigation_service.dart
lib/messaging/service/navigation_service.dart
+20
-24
No files found.
lib/AIOService/NavigationService/service/NavigationServiceRegister.dart
deleted
100755 → 0
View file @
7b58b614
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'NavigationService.dart'
;
import
'../handlers/NavigationService_onNativePageResult.dart'
;
import
'../handlers/NavigationService_didShowPageContainer.dart'
;
import
'../handlers/NavigationService_willShowPageContainer.dart'
;
import
'../handlers/NavigationService_willDisappearPageContainer.dart'
;
import
'../handlers/NavigationService_didDisappearPageContainer.dart'
;
import
'../handlers/NavigationService_didInitPageContainer.dart'
;
import
'../handlers/NavigationService_willDeallocPageContainer.dart'
;
class
NavigationServiceRegister
{
static
register
(){
NavigationService
.
regsiter
();
NavigationService_onNativePageResult
.
regsiter
();
NavigationService_didShowPageContainer
.
regsiter
();
NavigationService_willShowPageContainer
.
regsiter
();
NavigationService_willDisappearPageContainer
.
regsiter
();
NavigationService_didDisappearPageContainer
.
regsiter
();
NavigationService_didInitPageContainer
.
regsiter
();
NavigationService_willDeallocPageContainer
.
regsiter
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/container/container_coordinator.dart
View file @
b1b34f72
...
...
@@ -24,7 +24,7 @@
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_boost/
AIOService/NavigationService/service/NavigationS
ervice.dart'
;
import
'package:flutter_boost/
messaging/service/navigation_s
ervice.dart'
;
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_boost/messaging/native_page_container_event_handler.dart'
;
...
...
@@ -88,7 +88,7 @@ class ContainerCoordinator implements NativePageContainerEventHandler {
void
onChannelEvent
(
dynamic
event
)
{
if
(
event
is
Map
)
{
Map
map
=
event
as
Map
;
Map
map
=
event
;
final
String
type
=
map
[
'type'
];
switch
(
type
)
{
...
...
@@ -177,7 +177,7 @@ class ContainerCoordinator implements NativePageContainerEventHandler {
FlutterBoost
.
containerManager
?.
remove
(
pageId
);
Logger
.
log
(
'native containner dealloc,
\n
manager dump:
\n
${FlutterBoost.containerManager?.dump()}
'
);
'native containner dealloc,
\n
manager dump:
\n
${FlutterBoost.containerManager?.dump()}
'
);
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/container/container_manager.dart
View file @
b1b34f72
...
...
@@ -23,7 +23,7 @@
*/
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter_boost/
AIOService/NavigationService/service/NavigationS
ervice.dart'
;
import
'package:flutter_boost/
messaging/service/navigation_s
ervice.dart'
;
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
...
...
This diff is collapsed.
Click to expand it.
lib/flutter_boost.dart
View file @
b1b34f72
...
...
@@ -24,19 +24,26 @@
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/AIOService/NavigationService/service/NavigationService.dart'
;
import
'package:flutter_boost/messaging/service/navigation_service.dart'
;
import
'package:flutter_boost/container/boost_container.dart'
;
import
'package:flutter_boost/container/container_manager.dart'
;
import
'package:flutter_boost/messaging/page_result_mediator.dart'
;
import
'package:flutter_boost/router/router.dart'
;
import
'AIOService/loader/ServiceLoader.dart'
;
import
'container/container_coordinator.dart'
;
import
'messaging/base/message_dispatcher.dart'
;
import
'messaging/handlers/did_disappear_page_container_handler.dart'
;
import
'messaging/handlers/did_show_page_container_handler.dart'
;
import
'messaging/handlers/did_init_page_container_handler.dart'
;
import
'messaging/handlers/on_native_page_result_handler.dart'
;
import
'messaging/handlers/will_dealloc_page_container_handler.dart'
;
import
'messaging/handlers/will_show_page_container_handler.dart'
;
import
'messaging/handlers/will_disappear_page_container_handler.dart'
;
import
'observers_holders.dart'
;
export
'container/boost_container.dart'
;
export
'container/container_manager.dart'
;
import
'package:flutter/services.dart'
;
typedef
Widget
PageBuilder
(
String
pageName
,
Map
params
,
String
uniqueId
);
...
...
@@ -55,9 +62,25 @@ class FlutterBoost {
final
PageResultMediator
_resultMediator
=
PageResultMediator
();
final
Router
_router
=
Router
();
final
MethodChannel
_methodChannel
=
MethodChannel
(
'flutter_boost'
);
final
MessageDispatcher
_dispatcher
=
MessageDispatcher
();
FlutterBoost
()
{
_router
.
resultMediator
=
_resultMediator
;
ServiceLoader
.
load
();
//Config message handlers
NavigationService
.
methodChannel
=
_methodChannel
;
_dispatcher
.
registerHandler
(
DidDisappearPageContainerHandler
());
_dispatcher
.
registerHandler
(
DidInitPageContainerHandler
());
_dispatcher
.
registerHandler
(
DidShowPageContainerHandler
());
_dispatcher
.
registerHandler
(
OnNativePageResultHandler
());
_dispatcher
.
registerHandler
(
WillDeallocPageContainerHandler
());
_dispatcher
.
registerHandler
(
WillShowPageContainerHandler
());
_dispatcher
.
registerHandler
(
WillDisappearPageContainerHandler
());
_methodChannel
.
setMethodCallHandler
((
MethodCall
call
){
_dispatcher
.
dispatch
(
call
);
});
}
static
FlutterBoost
get
singleton
=>
_instance
;
...
...
This diff is collapsed.
Click to expand it.
lib/messaging/base/message_dispatcher.dart
0 → 100644
View file @
b1b34f72
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Alibaba Group
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'message_handler.dart'
;
class
MessageDispatcher
{
Map
<
String
,
MessageHandler
>
_handlers
=
Map
();
Future
<
dynamic
>
dispatch
(
MethodCall
call
){
if
(
_handlers
.
containsKey
(
call
.
method
)){
return
_handlers
[
call
.
method
].
onMethodCall
(
call
);
}{
return
null
;
}
}
void
registerHandler
(
MessageHandler
handler
){
_handlers
[
handler
.
name
()]
=
handler
;
}
}
This diff is collapsed.
Click to expand it.
lib/
AIOService/loader/ServiceLoad
er.dart
→
lib/
messaging/base/message_handl
er.dart
100755 → 100644
View file @
b1b34f72
/*
* The MIT License (MIT)
*
*
* Copyright (c) 2019 Alibaba Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
...
...
@@ -22,12 +22,10 @@
* THE SOFTWARE.
*/
import
'../NavigationService/service/NavigationServiceRegister.dart'
;
class
ServiceLoader
{
static
load
(){
NavigationServiceRegister
.
register
();
}
}
\ No newline at end of file
import
'dart:async'
;
import
'package:flutter/services.dart'
;
abstract
class
MessageHandler
{
String
name
();
Future
<
dynamic
>
onMethodCall
(
MethodCall
call
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_didDisappearPageContain
er.dart
→
lib/
messaging/handlers/did_disappear_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -25,24 +25,15 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
NavigationService_didDisappearPageContainer
extends
ServiceCallHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_didDisappearPageContainer
());
}
class
DidDisappearPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"didDisappearPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_didInitPageContain
er.dart
→
lib/
messaging/handlers/did_init_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -24,14 +24,14 @@
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
class
NavigationService_didInitPageContainer
extends
ServiceCallHandler
{
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
DidInitPageContainerHandler
implements
MessageHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_didInitPageContainer
());
//
ServiceGateway.sharedInstance()
//
.registerHandler(new NavigationService_didInitPageContainer());
}
@override
...
...
@@ -39,10 +39,6 @@ class NavigationService_didInitPageContainer extends ServiceCallHandler {
return
"didInitPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_didShowPageContain
er.dart
→
lib/
messaging/handlers/did_show_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -25,25 +25,15 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
NavigationService_didShowPageContainer
extends
ServiceCallHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_didShowPageContainer
());
}
class
DidShowPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"didShowPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_onNativePageResult
.dart
→
lib/
messaging/handlers/on_native_page_result_handler
.dart
View file @
b1b34f72
...
...
@@ -24,26 +24,17 @@
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
class
NavigationService_onNativePageResult
extends
ServiceCallHandler
{
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
().
registerHandler
(
new
NavigationService_onNativePageResult
());
}
class
OnNativePageResultHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"onNativePageResult"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"uniqueId"
],
call
.
arguments
[
"key"
],
call
.
arguments
[
"resultData"
],
call
.
arguments
[
"params"
]);
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_willDeallocPageContain
er.dart
→
lib/
messaging/handlers/will_dealloc_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -25,25 +25,14 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
class
NavigationService_willDeallocPageContainer
extends
ServiceCallHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_willDeallocPageContainer
());
}
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
WillDeallocPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willDeallocPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_willDisappearPageContain
er.dart
→
lib/
messaging/handlers/will_disappear_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -25,25 +25,15 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
NavigationService_willDisappearPageContainer
extends
ServiceCallHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_willDisappearPageContainer
());
}
class
WillDisappearPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willDisappearPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/handlers/NavigationService_willShowPageContain
er.dart
→
lib/
messaging/handlers/will_show_page_container_handl
er.dart
View file @
b1b34f72
...
...
@@ -25,25 +25,15 @@ import 'dart:async';
import
'package:flutter/services.dart'
;
import
'package:flutter_boost/container/container_coordinator.dart'
;
import
'package:xservice_kit/ServiceCallHandler.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
import
'package:flutter_boost/messaging/base/message_handler.dart'
;
class
NavigationService_willShowPageContainer
extends
ServiceCallHandler
{
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
()
.
registerHandler
(
new
NavigationService_willShowPageContainer
());
}
class
WillShowPageContainerHandler
implements
MessageHandler
{
@override
String
name
()
{
return
"willShowPageContainer"
;
}
@override
String
service
()
{
return
"NavigationService"
;
}
@override
Future
<
bool
>
onMethodCall
(
MethodCall
call
)
{
return
onCall
(
call
.
arguments
[
"pageName"
],
call
.
arguments
[
"params"
],
...
...
This diff is collapsed.
Click to expand it.
lib/messaging/message_proxy.dart
View file @
b1b34f72
...
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'package:flutter_boost/
AIOService/NavigationService/service/NavigationS
ervice.dart'
;
import
'package:flutter_boost/
messaging/service/navigation_s
ervice.dart'
;
import
'dart:async'
;
abstract
class
MessageProxy
{
...
...
This diff is collapsed.
Click to expand it.
lib/messaging/page_result_mediator.dart
View file @
b1b34f72
...
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
import
'package:flutter_boost/support/logger.dart'
;
import
'package:flutter_boost/
AIOService/NavigationService/service/NavigationS
ervice.dart'
;
import
'package:flutter_boost/
messaging/service/navigation_s
ervice.dart'
;
typedef
void
PageResultHandler
(
String
key
,
Map
<
String
,
dynamic
>
result
);
typedef
VoidCallback
=
void
Function
();
...
...
This diff is collapsed.
Click to expand it.
lib/
AIOService/NavigationService/service/NavigationS
ervice.dart
→
lib/
messaging/service/navigation_s
ervice.dart
View file @
b1b34f72
...
...
@@ -22,34 +22,30 @@
* THE SOFTWARE.
*/
import
'dart:async'
;
import
'package:xservice_kit/foundation_ext/foundation_ext.dart'
;
import
'package:xservice_kit/ServiceTemplate.dart'
;
import
'package:xservice_kit/ServiceGateway.dart'
;
class
NavigationService
{
static
final
ServiceTemplate
_service
=
new
ServiceTemplate
(
"NavigationService"
);
static
void
regsiter
()
{
ServiceGateway
.
sharedInstance
().
registerService
(
_service
);
}
import
'dart:async'
;
import
'package:flutter/services.dart'
;
class
NavigationService
{
static
MethodChannel
methodChannel
;
//List event from event channel.
static
int
listenEvent
(
void
onData
(
dynamic
event
))
{
return
_service
.
listenEvent
(
onData
);
//
return _service.listenEvent(onData);
}
//Cancel event for subscription with ID.
static
void
cancelEventForSubscription
(
int
subID
)
{
_service
.
cancelEventForSubscription
(
subID
);
//
_service.cancelEventForSubscription(subID);
}
static
Future
<
bool
>
onShownContainerChanged
(
String
newName
,
String
oldName
,
Map
params
)
{
Map
<
String
,
dynamic
>
properties
=
new
Map
<
String
,
dynamic
>();
properties
[
"newName"
]=
newName
;
properties
[
"oldName"
]=
oldName
;
properties
[
"params"
]=
params
;
return
_service
.
methodChannel
()
.
invokeMethod
(
'onShownContainerChanged'
,
properties
).
then
<
bool
>((
value
){
return
BOOL
(
value
);
return
methodChannel
.
invokeMethod
(
'onShownContainerChanged'
,
properties
).
then
<
bool
>((
value
){
return
(
value
);
});
}
static
Future
<
bool
>
onFlutterPageResult
(
String
uniqueId
,
String
key
,
Map
resultData
,
Map
params
)
{
...
...
@@ -58,15 +54,15 @@
properties
[
"key"
]=
key
;
properties
[
"resultData"
]=
resultData
;
properties
[
"params"
]=
params
;
return
_service
.
methodChannel
()
.
invokeMethod
(
'onFlutterPageResult'
,
properties
).
then
<
bool
>((
value
){
return
BOOL
(
value
);
return
methodChannel
.
invokeMethod
(
'onFlutterPageResult'
,
properties
).
then
<
bool
>((
value
){
return
(
value
);
});
}
static
Future
<
Map
>
pageOnStart
(
Map
params
)
async
{
Map
<
String
,
dynamic
>
properties
=
new
Map
<
String
,
dynamic
>();
properties
[
"params"
]=
params
;
try
{
return
await
_service
.
methodChannel
()
.
invokeMethod
(
'pageOnStart'
,
properties
).
then
<
Map
>((
value
){
return
await
methodChannel
.
invokeMethod
(
'pageOnStart'
,
properties
).
then
<
Map
>((
value
){
return
value
as
Map
;
});
}
catch
(
e
)
{
...
...
@@ -79,8 +75,8 @@
properties
[
"pageName"
]=
pageName
;
properties
[
"params"
]=
params
;
properties
[
"animated"
]=
animated
;
return
_service
.
methodChannel
()
.
invokeMethod
(
'openPage'
,
properties
).
then
<
bool
>((
value
){
return
BOOL
(
value
);
return
methodChannel
.
invokeMethod
(
'openPage'
,
properties
).
then
<
bool
>((
value
){
return
(
value
);
});
}
static
Future
<
bool
>
closePage
(
String
uniqueId
,
String
pageName
,
Map
params
,
bool
animated
)
{
...
...
@@ -89,8 +85,8 @@
properties
[
"pageName"
]=
pageName
;
properties
[
"params"
]=
params
;
properties
[
"animated"
]=
animated
;
return
_service
.
methodChannel
()
.
invokeMethod
(
'closePage'
,
properties
).
then
<
bool
>((
value
){
return
BOOL
(
value
)
;
return
methodChannel
.
invokeMethod
(
'closePage'
,
properties
).
then
<
bool
>((
value
){
return
value
;
});
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment