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
0
Merge Requests
0
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
755c0093
Commit
755c0093
authored
Sep 10, 2020
by
ColdPaleLight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f2f develop
parent
5740f8d9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
12 deletions
+61
-12
ios/Classes/Boost/FlutterBoostPlugin.m
ios/Classes/Boost/FlutterBoostPlugin.m
+5
-1
lib/container/boost_container.dart
lib/container/boost_container.dart
+12
-0
lib/container/container_coordinator.dart
lib/container/container_coordinator.dart
+28
-0
lib/flutter_boost.dart
lib/flutter_boost.dart
+16
-5
lib/flutter_boost_api.dart
lib/flutter_boost_api.dart
+0
-6
No files found.
ios/Classes/Boost/FlutterBoostPlugin.m
View file @
755c0093
...
...
@@ -94,7 +94,11 @@
pageInfo
[
@"params"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fParams
;
pageInfo
[
@"uniqueId"
]
=
[
FlutterBoostPlugin
sharedInstance
].
fPageId
;
if
(
result
)
result
(
pageInfo
);
}
else
{
}
if
([
@"disablePopGesture"
isEqualToString
:
call
.
method
])
{
[
FlutterBoostPlugin
sharedInstance
].
application
.
flutterViewController
.
navigationController
.
interactivePopGestureRecognizer
.
enabled
=
NO
;
}
if
([
@"enablePopGesture"
isEqualToString
:
call
.
method
]){
[
FlutterBoostPlugin
sharedInstance
].
application
.
flutterViewController
.
navigationController
.
interactivePopGestureRecognizer
.
enabled
=
YES
;
}
else
{
result
(
FlutterMethodNotImplemented
);
}
}
...
...
lib/container/boost_container.dart
View file @
755c0093
...
...
@@ -21,6 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'container_manager.dart'
;
import
'../flutter_boost.dart'
;
...
...
@@ -201,6 +203,11 @@ class BoostContainerState extends NavigatorState {
if
(
canPop
())
{
super
.
pop
<
T
>(
result
);
if
(
Platform
.
isIOS
&&
multipleRouteMode
&&
!
canPop
())
{
FlutterBoost
.
singleton
.
channel
.
invokeMethod
<
dynamic
>(
'enablePopGesture'
,
null
);
//开启native返回手势
}
}
else
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
FlutterBoost
.
singleton
...
...
@@ -229,6 +236,11 @@ class BoostContainerState extends NavigatorState {
.
postPushRoute
(
name
,
uniqueId
,
params
,
newRoute
??
route
,
future
);
}
if
(
Platform
.
isIOS
&&
multipleRouteMode
&&
canPop
())
{
FlutterBoost
.
singleton
.
channel
.
invokeMethod
<
dynamic
>(
'disablePopGesture'
,
null
);
}
return
future
;
}
...
...
lib/container/container_coordinator.dart
View file @
755c0093
...
...
@@ -32,6 +32,17 @@ import 'boost_container.dart';
import
'../flutter_boost.dart'
;
import
'../support/logger.dart'
;
class
BoostRouteSettings
{
final
String
uniqueId
;
final
String
name
;
final
Map
params
;
const
BoostRouteSettings
({
this
.
uniqueId
,
this
.
name
,
this
.
params
});
}
typedef
BoostRouteSettings
BoostRouteSettingsBuilder
(
String
url
,
{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
});
class
ContainerCoordinator
{
static
ContainerCoordinator
get
singleton
=>
_instance
;
...
...
@@ -40,6 +51,7 @@ class ContainerCoordinator {
final
Map
<
String
,
PageBuilder
>
_pageBuilders
=
<
String
,
PageBuilder
>{};
PageBuilder
_defaultPageBuilder
;
BoostRouteSettingsBuilder
_routeSettingsBuilder
;
ContainerCoordinator
(
BoostChannel
channel
)
{
assert
(
_instance
==
null
);
...
...
@@ -94,6 +106,22 @@ class ContainerCoordinator {
return
page
;
}
BoostRouteSettings
createRouteSettings
(
String
url
,
{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
})
{
if
(
_routeSettingsBuilder
!=
null
)
{
return
_routeSettingsBuilder
(
url
,
urlParams:
urlParams
,
exts:
exts
);
}
return
BoostRouteSettings
(
uniqueId:
'
${url}
_
${DateTime.now().millisecondsSinceEpoch}
'
,
name:
url
,
params:
urlParams
);
}
void
registerRouteSettingsBuilder
(
BoostRouteSettingsBuilder
builder
)
{
_routeSettingsBuilder
=
builder
;
}
//Register a default page builder.
void
registerDefaultPageBuilder
(
PageBuilder
builder
)
{
_defaultPageBuilder
=
builder
;
...
...
lib/flutter_boost.dart
View file @
755c0093
...
...
@@ -28,6 +28,7 @@ import 'package:flutter/cupertino.dart';
import
'package:flutter/material.dart'
;
import
'container/boost_container.dart'
;
import
'container/container_coordinator.dart'
;
import
'container/container_coordinator.dart'
;
import
'container/container_manager.dart'
;
import
'channel/boost_channel.dart'
;
...
...
@@ -37,6 +38,7 @@ import 'observers_holders.dart';
export
'container/boost_container.dart'
;
export
'container/container_manager.dart'
;
export
'flutter_boost_api.dart'
;
export
'container/container_coordinator.dart'
show
BoostRouteSettings
;
typedef
Widget
PageBuilder
(
String
pageName
,
Map
params
,
String
uniqueId
);
...
...
@@ -48,6 +50,9 @@ typedef void PostPushRoute(String url, String uniqueId, Map params, Route route,
typedef
Route
FlutterBoostRouteBuilder
(
Widget
widget
);
class
FlutterBoost
{
static
final
FlutterBoost
_instance
=
FlutterBoost
();
final
GlobalKey
<
ContainerManagerState
>
containerManagerKey
=
...
...
@@ -124,6 +129,11 @@ class FlutterBoost {
ContainerCoordinator
.
singleton
.
registerPageBuilders
(
builders
);
}
///Register a route settings builder
void
registerRouteSettingsBuilder
(
BoostRouteSettingsBuilder
builder
)
{
ContainerCoordinator
.
singleton
.
registerRouteSettingsBuilder
(
builder
);
}
Future
<
Map
<
dynamic
,
dynamic
>>
open
(
String
url
,
{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
})
{
...
...
@@ -145,14 +155,15 @@ class FlutterBoost {
Map
<
String
,
dynamic
>
exts
,
FlutterBoostRouteBuilder
routeBuilder
})
{
// if(!ContainerCoordinator.singleton.isFlutterPageUrl(url)){
// return open(url, urlParams: urlParams, exts: exts);
// }
String
uniqueId
=
'
${url}
_
${DateTime.now().millisecondsSinceEpoch}
'
;
final
BoostRouteSettings
routeSettings
=
ContainerCoordinator
.
singleton
.
createRouteSettings
(
url
,
urlParams:
urlParams
,
exts:
exts
)
;
final
Widget
page
=
ContainerCoordinator
.
singleton
.
createPage
(
url
,
urlParams
,
uniqueId
);
routeSettings
.
name
,
routeSettings
.
params
,
routeSettings
.
uniqueId
);
if
(
page
==
null
)
{
return
open
(
url
,
urlParams:
urlParams
,
exts:
exts
);
}
final
Route
<
Map
<
dynamic
,
dynamic
>>
route
=
routeBuilder
!=
null
?
routeBuilder
(
page
)
...
...
lib/flutter_boost_api.dart
View file @
755c0093
...
...
@@ -7,13 +7,7 @@ import 'flutter_boost.dart';
typedef
Route
FlutterBoostRouteBuilder
(
Widget
widget
);
class
BoostRouteSettings
{
final
String
uniqueId
;
final
String
name
;
final
Map
params
;
const
BoostRouteSettings
({
this
.
uniqueId
,
this
.
name
,
this
.
params
});
}
typedef
BoostRouteSettings
BoostRouteSettingsBuilder
(
String
url
,
{
Map
<
String
,
dynamic
>
urlParams
,
Map
<
String
,
dynamic
>
exts
});
...
...
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