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
2d266fe7
Commit
2d266fe7
authored
Jul 07, 2021
by
窦文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
奇怪的问题又增加了
parent
c89d948f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
0 deletions
+138
-0
dwMain.dart
netrain_flutter_app/lib/douwen/dwMain.dart
+74
-0
second1.dart
netrain_flutter_app/lib/douwen/second1.dart
+64
-0
No files found.
netrain_flutter_app/lib/douwen/dwMain.dart
0 → 100644
View file @
2d266fe7
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'second1.dart'
;
void
main
(
)
{
runApp
(
MyApp
());
// runApp(Login());
// runApp(TestPage());
print
(
"启动"
);
}
class
MyApp
extends
StatelessWidget
{
// This widget is the root of your application.
@override
Widget
build
(
BuildContext
context
)
{
return
WillPopScope
(
child:
MaterialApp
(
title:
'Flutter Demo'
,
initialRoute:
"/key1"
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
visualDensity:
VisualDensity
.
adaptivePlatformDensity
,
),
home:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
"路由"
),
),
body:
RouterNavigator
(
title:
'Flutter Demo Home Page'
),
),
// routes: <String, WidgetBuilder>{"/key2": (context) => second()},
),
onWillPop:
()
async
{
Fluttertoast
.
showToast
(
msg:
"退出"
);
return
true
;
});
}
}
class
RouterNavigator
extends
StatefulWidget
{
RouterNavigator
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
@override
_RouterNavigatorState
createState
()
=>
_RouterNavigatorState
();
}
class
_RouterNavigatorState
extends
State
<
RouterNavigator
>
{
bool
byName
=
false
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
child:
Column
(
children:
[
_item
(
"跳转"
,
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Second
()));
})
],
),
);
}
_item
(
String
title
,
VoidCallback
onPressed
)
{
return
Container
(
child:
RaisedButton
(
onPressed:
onPressed
,
child:
Text
(
title
),
),
);
}
}
netrain_flutter_app/lib/douwen/second1.dart
0 → 100644
View file @
2d266fe7
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
class
Second
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
WillPopScope
(
child:
MaterialApp
(
title:
'Flutter Demo'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
visualDensity:
VisualDensity
.
adaptivePlatformDensity
,
),
home:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
"·2"
),
),
body:
RouterNavigator
(
title:
'Flutter Demo Home Page'
),
),
),
onWillPop:
()
async
{
Fluttertoast
.
showToast
(
msg:
"˳"
);
return
true
;
});
}
}
class
RouterNavigator
extends
StatefulWidget
{
RouterNavigator
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
@override
_RouterNavigatorState
createState
()
=>
_RouterNavigatorState
();
}
class
_RouterNavigatorState
extends
State
<
RouterNavigator
>
{
bool
byName
=
false
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
child:
Column
(
children:
[
_item
(
"ת"
,
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Second
()));
})
],
),
);
}
_item
(
String
title
,
VoidCallback
onPressed
)
{
return
Container
(
child:
RaisedButton
(
onPressed:
onPressed
,
child:
Text
(
title
),
),
);
}
}
\ No newline at end of file
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