Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
netrain_flutter_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邹志胜
netrain_flutter_app
Commits
72950e01
Commit
72950e01
authored
Jul 08, 2021
by
窦文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由
parent
2d266fe7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
dwMain.dart
netrain_flutter_app/lib/douwen/dwMain.dart
+4
-3
second1.dart
netrain_flutter_app/lib/douwen/second1.dart
+13
-9
No files found.
netrain_flutter_app/lib/douwen/dwMain.dart
View file @
72950e01
...
@@ -54,9 +54,10 @@ class _RouterNavigatorState extends State<RouterNavigator> {
...
@@ -54,9 +54,10 @@ class _RouterNavigatorState extends State<RouterNavigator> {
return
Container
(
return
Container
(
child:
Column
(
child:
Column
(
children:
[
children:
[
_item
(
"跳转"
,
()
{
_item
(
"跳转"
,
()
async
{
Navigator
.
push
(
var
result
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Second
()));
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Second
(
text:
""
)));
print
(
"返回值:
$result
"
);
})
})
],
],
),
),
...
...
netrain_flutter_app/lib/douwen/second1.dart
View file @
72950e01
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:http/http.dart'
;
class
Second
extends
StatelessWidget
{
Second
({
Key
key
,
@required
this
.
text
}):
super
(
key:
key
);
final
String
text
;
class
Second
extends
StatelessWidget
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
WillPopScope
(
return
WillPopScope
(
...
@@ -14,20 +21,18 @@ class Second extends StatelessWidget{
...
@@ -14,20 +21,18 @@ class Second extends StatelessWidget{
),
),
home:
Scaffold
(
home:
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
"
·2
"
),
title:
Text
(
"
哦吼2
"
),
),
),
body:
RouterNavigator
(
title:
'Flutter Demo Home Page'
),
body:
RouterNavigator
(
title:
'Flutter Demo Home Page'
),
),
),
),
),
onWillPop:
()
async
{
onWillPop:
()
async
{
Fluttertoast
.
showToast
(
msg:
"
˳"
);
Fluttertoast
.
showToast
(
msg:
"
哦吼2"
);
return
true
;
return
true
;
});
});
}
}
}
}
class
RouterNavigator
extends
StatefulWidget
{
class
RouterNavigator
extends
StatefulWidget
{
RouterNavigator
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
RouterNavigator
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
final
String
title
;
...
@@ -44,9 +49,8 @@ class _RouterNavigatorState extends State<RouterNavigator> {
...
@@ -44,9 +49,8 @@ class _RouterNavigatorState extends State<RouterNavigator> {
return
Container
(
return
Container
(
child:
Column
(
child:
Column
(
children:
[
children:
[
_item
(
"ת"
,
()
{
_item
(
"跳转"
,
()
{
Navigator
.
push
(
Navigator
.
popUntil
(
context
,
ModalRoute
.
withName
(
"/key1"
));
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Second
()));
})
})
],
],
),
),
...
...
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