Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
d1d91c59
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d1d91c59
编写于
7月 23, 2015
作者:
H
Hixie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a dialog to the address book app to test scoped focus.
上级
2cfc2042
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
69 addition
and
14 deletion
+69
-14
sky/sdk/example/address_book/lib/main.dart
sky/sdk/example/address_book/lib/main.dart
+69
-14
未找到文件。
sky/sdk/example/address_book/lib/main.dart
浏览文件 @
d1d91c59
...
...
@@ -7,11 +7,14 @@ import 'package:sky/theme/colors.dart' as colors;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/default_text_style.dart'
;
import
'package:sky/widgets/dialog.dart'
;
import
'package:sky/widgets/floating_action_button.dart'
;
import
'package:sky/widgets/flat_button.dart'
;
import
'package:sky/widgets/focus.dart'
;
import
'package:sky/widgets/icon.dart'
;
import
'package:sky/widgets/icon_button.dart'
;
import
'package:sky/widgets/material.dart'
;
import
'package:sky/widgets/navigator.dart'
;
import
'package:sky/widgets/scaffold.dart'
;
import
'package:sky/widgets/scrollable_viewport.dart'
;
import
'package:sky/widgets/task_description.dart'
;
...
...
@@ -51,17 +54,23 @@ class Field extends Component {
class
AddressBookApp
extends
App
{
Widget
buildToolBar
()
{
Widget
buildToolBar
(
Navigator
navigator
)
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/arrow_back"
),
right:
[
new
IconButton
(
icon:
"navigation/check"
)]
);
}
Widget
buildFloatingActionButton
()
{
Widget
buildFloatingActionButton
(
Navigator
navigator
)
{
return
new
FloatingActionButton
(
child:
new
Icon
(
type:
'image/photo_camera'
,
size:
24
),
backgroundColor:
Theme
.
of
(
this
).
accentColor
backgroundColor:
Theme
.
of
(
this
).
accentColor
,
onPressed:
()
{
showDialog
=
true
;
navigator
.
pushState
(
this
,
(
_
)
{
showDialog
=
false
;
});
}
);
}
...
...
@@ -71,8 +80,10 @@ class AddressBookApp extends App {
static
final
GlobalKey
addressKey
=
new
GlobalKey
();
static
final
GlobalKey
ringtoneKey
=
new
GlobalKey
();
static
final
GlobalKey
noteKey
=
new
GlobalKey
();
static
final
GlobalKey
fillKey
=
new
GlobalKey
();
static
final
GlobalKey
emoticonKey
=
new
GlobalKey
();
Widget
buildBody
()
{
Widget
buildBody
(
Navigator
navigator
)
{
return
new
Material
(
child:
new
ScrollableBlock
([
new
AspectRatio
(
...
...
@@ -91,12 +102,59 @@ class AddressBookApp extends App {
);
}
Widget
buildMain
()
{
return
new
Scaffold
(
toolbar:
buildToolBar
(),
body:
buildBody
(),
floatingActionButton:
buildFloatingActionButton
()
);
bool
showDialog
=
false
;
Widget
buildMain
(
Navigator
navigator
)
{
List
<
Widget
>
layers
=
[
new
Focus
(
initialFocus:
nameKey
,
child:
new
Scaffold
(
toolbar:
buildToolBar
(
navigator
),
body:
buildBody
(
navigator
),
floatingActionButton:
buildFloatingActionButton
(
navigator
)
)
)
];
if
(
showDialog
)
{
layers
.
add
(
new
Focus
(
initialFocus:
fillKey
,
child:
new
Dialog
(
title:
new
Text
(
"Describe your picture"
),
content:
new
ScrollableBlock
([
new
Field
(
inputKey:
fillKey
,
icon:
"editor/format_color_fill"
,
placeholder:
"Color"
),
new
Field
(
inputKey:
emoticonKey
,
icon:
"editor/insert_emoticon"
,
placeholder:
"Emotion"
),
]),
onDismiss:
navigator
.
pop
,
actions:
[
new
FlatButton
(
child:
new
Text
(
'DISCARD'
),
onPressed:
()
{
navigator
.
pop
();
}
),
new
FlatButton
(
child:
new
Text
(
'SAVE'
),
onPressed:
()
{
navigator
.
pop
();
}
),
]
)
));
}
return
new
Stack
(
layers
);
}
NavigationState
_navigationState
;
void
initState
()
{
_navigationState
=
new
NavigationState
([
new
Route
(
name:
'/'
,
builder:
(
navigator
,
route
)
=>
buildMain
(
navigator
)
),
]);
super
.
initState
();
}
Widget
build
()
{
...
...
@@ -111,10 +169,7 @@ class AddressBookApp extends App {
style:
typography
.
error
,
// if you see this, you've forgotten to correctly configure the text style!
child:
new
TaskDescription
(
label:
'Address Book'
,
child:
new
Focus
(
initialFocus:
nameKey
,
child:
buildMain
()
)
child:
new
Navigator
(
_navigationState
)
)
)
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录