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
b4c7737e
Commit
b4c7737e
authored
Apr 13, 2020
by
AlexVincent525
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
Improve code in example/main.dart .
parent
50022e7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
example/lib/main.dart
example/lib/main.dart
+31
-18
No files found.
example/lib/main.dart
View file @
b4c7737e
...
...
@@ -16,25 +16,29 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
'embeded'
:
(
pageName
,
params
,
_
)
=>
EmbeddedFirstRouteWidget
(),
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'firstFirst'
:
(
pageName
,
params
,
_
)
=>
FirstFirstRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
'secondStateful'
:
(
pageName
,
params
,
_
)
=>
SecondStatefulRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'platformView'
:
(
pageName
,
params
,
_
)
=>
PlatformRouteWidget
(),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
FlutterBoost
.
singleton
.
registerPageBuilders
(<
String
,
PageBuilder
>{
'embeded'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
EmbeddedFirstRouteWidget
(),
'first'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FirstRouteWidget
(),
'firstFirst'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FirstFirstRouteWidget
(),
'second'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
SecondRouteWidget
(),
'secondStateful'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
SecondStatefulRouteWidget
(),
'tab'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
TabRouteWidget
(),
'platformView'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
PlatformRouteWidget
(),
'flutterFragment'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FragmentRouteWidget
(
params
),
///可以在native层通过 getContainerParams 来传递参数
'flutterPage'
:
(
pageName
,
params
,
_
)
{
print
(
"flutterPage params:
$params
"
);
'flutterPage'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
{
print
(
'flutterPage params:
$params
'
);
return
FlutterRouteWidget
(
params:
params
);
},
});
FlutterBoost
.
singleton
.
addBoostNavigatorObserver
(
TestBoostNavigatorObserver
());
FlutterBoost
.
singleton
.
addBoostNavigatorObserver
(
TestBoostNavigatorObserver
());
}
@override
...
...
@@ -46,23 +50,32 @@ class _MyAppState extends State<MyApp> {
}
void
_onRoutePushed
(
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{}
String
pageName
,
String
uniqueId
,
Map
<
String
,
dynamic
>
params
,
Route
<
dynamic
>
route
,
Future
<
dynamic
>
_
,
)
{}
}
class
TestBoostNavigatorObserver
extends
NavigatorObserver
{
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didPush"
);
print
(
'flutterboost#didPush'
);
}
@override
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didPop"
);
print
(
'flutterboost#didPop'
);
}
@override
void
didRemove
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didRemove"
);
print
(
'flutterboost#didRemove'
);
}
@override
void
didReplace
({
Route
<
dynamic
>
newRoute
,
Route
<
dynamic
>
oldRoute
})
{
print
(
"flutterboost#didReplace"
);
print
(
'flutterboost#didReplace'
);
}
}
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