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
196c7b05
Commit
196c7b05
authored
Mar 30, 2020
by
余玠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加dispose的用例
parent
efea291c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
6 deletions
+157
-6
example/lib/main.dart
example/lib/main.dart
+1
-0
example/lib/simple_page_widgets.dart
example/lib/simple_page_widgets.dart
+156
-6
No files found.
example/lib/main.dart
View file @
196c7b05
...
...
@@ -23,6 +23,7 @@ class _MyAppState extends State<MyApp> {
FlutterBoost
.
singleton
.
registerPageBuilders
({
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'firstFirst'
:
(
pageName
,
params
,
_
)
=>
FirstFirstRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
...
...
example/lib/simple_page_widgets.dart
View file @
196c7b05
import
'package:flutter/material.dart'
;
import
'package:flutter_boost2/flutter_boost.dart'
;
class
FirstRouteWidget
extends
StatelessWidget
{
class
FirstRouteWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
{
return
new
_FirstRouteWidgetState
();
}
}
class
_FirstRouteWidgetState
extends
State
<
FirstRouteWidget
>
with
WidgetsBindingObserver
{
_FirstRouteWidgetState
();
@override
void
initState
()
{
print
(
'initState'
);
super
.
initState
();
WidgetsBinding
.
instance
.
addObserver
(
this
);
}
@override
void
didChangeDependencies
()
{
print
(
'didChangeDependencies'
);
super
.
didChangeDependencies
();
}
@override
void
didUpdateWidget
(
FirstRouteWidget
oldWidget
)
{
print
(
'didUpdateWidget'
);
super
.
didUpdateWidget
(
oldWidget
);
}
@override
void
deactivate
()
{
print
(
'deactivate'
);
super
.
deactivate
();
}
@override
void
dispose
()
{
print
(
'[XDEBUG] - FirstRouteWidget is disposing~'
);
WidgetsBinding
.
instance
.
removeObserver
(
this
);
super
.
dispose
();
}
@override
void
didChangeAppLifecycleState
(
AppLifecycleState
state
)
{
switch
(
state
)
{
case
AppLifecycleState
.
inactive
:
print
(
'AppLifecycleState.inactive'
);
break
;
case
AppLifecycleState
.
paused
:
print
(
'AppLifecycleState.paused'
);
break
;
case
AppLifecycleState
.
resumed
:
print
(
'AppLifecycleState.resumed'
);
break
;
case
AppLifecycleState
.
suspending
:
print
(
'AppLifecycleState.suspending'
);
break
;
}
super
.
didChangeAppLifecycleState
(
state
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'First Route'
),
),
body:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
RaisedButton
(
child:
Text
(
'Open second route'
),
onPressed:
()
{
print
(
"open second page!"
);
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
print
(
"call me when page is finished. did recieve second route result
$value
"
);
});
},
),
RaisedButton
(
child:
Text
(
'Open FF route'
),
onPressed:
()
{
print
(
"open FF page!"
);
FlutterBoost
.
singleton
.
open
(
"firstFirst"
).
then
((
Map
value
)
{
print
(
"call me when page is finished. did recieve FF route result
$value
"
);
});
},
),
RaisedButton
(
child:
Text
(
'Present second route'
),
onPressed:
()
{
print
(
"Present second page!"
);
FlutterBoost
.
singleton
.
open
(
"second"
,
urlParams:
<
String
,
dynamic
>{
"present"
:
true
}).
then
((
Map
value
)
{
print
(
"call me when page is finished. did recieve second route result
$value
"
);
});
},
),
],
),
),
);
}
}
class
FirstFirstRouteWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
{
return
new
_FirstFirstRouteWidgetState
();
}
}
class
_FirstFirstRouteWidgetState
extends
State
<
FirstFirstRouteWidget
>{
_FirstFirstRouteWidgetState
();
@override
void
initState
()
{
print
(
'initState'
);
super
.
initState
();
}
@override
void
didChangeDependencies
()
{
print
(
'didChangeDependencies'
);
super
.
didChangeDependencies
();
}
@override
void
didUpdateWidget
(
FirstFirstRouteWidget
oldWidget
)
{
print
(
'didUpdateWidget'
);
super
.
didUpdateWidget
(
oldWidget
);
}
@override
void
deactivate
()
{
print
(
'deactivate'
);
super
.
deactivate
();
}
@override
void
dispose
()
{
print
(
'[XDEBUG] - FirstFirstRouteWidget is disposing~'
);
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
...
...
@@ -10,13 +160,13 @@ class FirstRouteWidget extends StatelessWidget {
),
body:
Center
(
child:
RaisedButton
(
child:
Text
(
'Open
second
route'
),
child:
Text
(
'Open
first
route'
),
onPressed:
()
{
print
(
"open
second page
!"
);
FlutterBoost
.
singleton
.
open
(
"
second
"
).
then
((
Map
value
){
print
(
"did recieve
second
route result"
);
print
(
"did recieve
second
route result
$value
"
);
print
(
"open
first page again
!"
);
FlutterBoost
.
singleton
.
open
(
"
first
"
).
then
((
Map
value
){
print
(
"did recieve
first
route result"
);
print
(
"did recieve
first
route result
$value
"
);
});
},
...
...
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