Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
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
abdullh.alsoleman
Front-End
Commits
47aee96c
Commit
47aee96c
authored
Jan 16, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename _Child to _ScaffoldSlot for clarity.
parent
5fdb0749
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+25
-25
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
47aee96c
...
@@ -21,7 +21,7 @@ import 'icon_button.dart';
...
@@ -21,7 +21,7 @@ import 'icon_button.dart';
const
double
_kFloatingActionButtonMargin
=
16.0
;
// TODO(hmuller): should be device dependent
const
double
_kFloatingActionButtonMargin
=
16.0
;
// TODO(hmuller): should be device dependent
const
Duration
_kFloatingActionButtonSegue
=
const
Duration
(
milliseconds:
400
);
const
Duration
_kFloatingActionButtonSegue
=
const
Duration
(
milliseconds:
400
);
enum
_
Child
{
enum
_
ScaffoldSlot
{
body
,
body
,
toolBar
,
toolBar
,
bottomSheet
,
bottomSheet
,
...
@@ -43,16 +43,16 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
...
@@ -43,16 +43,16 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tighten
(
width:
size
.
width
);
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tighten
(
width:
size
.
width
);
Size
toolBarSize
=
Size
.
zero
;
Size
toolBarSize
=
Size
.
zero
;
if
(
isChild
(
_
Child
.
toolBar
))
{
if
(
isChild
(
_
ScaffoldSlot
.
toolBar
))
{
toolBarSize
=
layoutChild
(
_
Child
.
toolBar
,
fullWidthConstraints
);
toolBarSize
=
layoutChild
(
_
ScaffoldSlot
.
toolBar
,
fullWidthConstraints
);
positionChild
(
_
Child
.
toolBar
,
Offset
.
zero
);
positionChild
(
_
ScaffoldSlot
.
toolBar
,
Offset
.
zero
);
}
}
if
(
isChild
(
_
Child
.
body
))
{
if
(
isChild
(
_
ScaffoldSlot
.
body
))
{
final
double
bodyHeight
=
size
.
height
-
toolBarSize
.
height
;
final
double
bodyHeight
=
size
.
height
-
toolBarSize
.
height
;
final
BoxConstraints
bodyConstraints
=
fullWidthConstraints
.
tighten
(
height:
bodyHeight
);
final
BoxConstraints
bodyConstraints
=
fullWidthConstraints
.
tighten
(
height:
bodyHeight
);
layoutChild
(
_
Child
.
body
,
bodyConstraints
);
layoutChild
(
_
ScaffoldSlot
.
body
,
bodyConstraints
);
positionChild
(
_
Child
.
body
,
new
Offset
(
0.0
,
toolBarSize
.
height
));
positionChild
(
_
ScaffoldSlot
.
body
,
new
Offset
(
0.0
,
toolBarSize
.
height
));
}
}
// The BottomSheet and the SnackBar are anchored to the bottom of the parent,
// The BottomSheet and the SnackBar are anchored to the bottom of the parent,
...
@@ -67,30 +67,30 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
...
@@ -67,30 +67,30 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
Size
bottomSheetSize
=
Size
.
zero
;
Size
bottomSheetSize
=
Size
.
zero
;
Size
snackBarSize
=
Size
.
zero
;
Size
snackBarSize
=
Size
.
zero
;
if
(
isChild
(
_
Child
.
bottomSheet
))
{
if
(
isChild
(
_
ScaffoldSlot
.
bottomSheet
))
{
bottomSheetSize
=
layoutChild
(
_
Child
.
bottomSheet
,
fullWidthConstraints
);
bottomSheetSize
=
layoutChild
(
_
ScaffoldSlot
.
bottomSheet
,
fullWidthConstraints
);
positionChild
(
_
Child
.
bottomSheet
,
new
Offset
((
size
.
width
-
bottomSheetSize
.
width
)
/
2.0
,
size
.
height
-
bottomSheetSize
.
height
));
positionChild
(
_
ScaffoldSlot
.
bottomSheet
,
new
Offset
((
size
.
width
-
bottomSheetSize
.
width
)
/
2.0
,
size
.
height
-
bottomSheetSize
.
height
));
}
}
if
(
isChild
(
_
Child
.
snackBar
))
{
if
(
isChild
(
_
ScaffoldSlot
.
snackBar
))
{
snackBarSize
=
layoutChild
(
_
Child
.
snackBar
,
fullWidthConstraints
);
snackBarSize
=
layoutChild
(
_
ScaffoldSlot
.
snackBar
,
fullWidthConstraints
);
positionChild
(
_
Child
.
snackBar
,
new
Offset
(
0.0
,
size
.
height
-
snackBarSize
.
height
));
positionChild
(
_
ScaffoldSlot
.
snackBar
,
new
Offset
(
0.0
,
size
.
height
-
snackBarSize
.
height
));
}
}
if
(
isChild
(
_
Child
.
floatingActionButton
))
{
if
(
isChild
(
_
ScaffoldSlot
.
floatingActionButton
))
{
final
Size
fabSize
=
layoutChild
(
_
Child
.
floatingActionButton
,
looseConstraints
);
final
Size
fabSize
=
layoutChild
(
_
ScaffoldSlot
.
floatingActionButton
,
looseConstraints
);
final
double
fabX
=
size
.
width
-
fabSize
.
width
-
_kFloatingActionButtonMargin
;
final
double
fabX
=
size
.
width
-
fabSize
.
width
-
_kFloatingActionButtonMargin
;
double
fabY
=
size
.
height
-
fabSize
.
height
-
_kFloatingActionButtonMargin
;
double
fabY
=
size
.
height
-
fabSize
.
height
-
_kFloatingActionButtonMargin
;
if
(
snackBarSize
.
height
>
0.0
)
if
(
snackBarSize
.
height
>
0.0
)
fabY
=
math
.
min
(
fabY
,
size
.
height
-
snackBarSize
.
height
-
fabSize
.
height
-
_kFloatingActionButtonMargin
);
fabY
=
math
.
min
(
fabY
,
size
.
height
-
snackBarSize
.
height
-
fabSize
.
height
-
_kFloatingActionButtonMargin
);
if
(
bottomSheetSize
.
height
>
0.0
)
if
(
bottomSheetSize
.
height
>
0.0
)
fabY
=
math
.
min
(
fabY
,
size
.
height
-
bottomSheetSize
.
height
-
fabSize
.
height
/
2.0
);
fabY
=
math
.
min
(
fabY
,
size
.
height
-
bottomSheetSize
.
height
-
fabSize
.
height
/
2.0
);
positionChild
(
_
Child
.
floatingActionButton
,
new
Offset
(
fabX
,
fabY
));
positionChild
(
_
ScaffoldSlot
.
floatingActionButton
,
new
Offset
(
fabX
,
fabY
));
}
}
if
(
isChild
(
_
Child
.
drawer
))
{
if
(
isChild
(
_
ScaffoldSlot
.
drawer
))
{
layoutChild
(
_
Child
.
drawer
,
new
BoxConstraints
.
tight
(
size
));
layoutChild
(
_
ScaffoldSlot
.
drawer
,
new
BoxConstraints
.
tight
(
size
));
positionChild
(
_
Child
.
drawer
,
Offset
.
zero
);
positionChild
(
_
ScaffoldSlot
.
drawer
,
Offset
.
zero
);
}
}
}
}
...
@@ -366,8 +366,8 @@ class ScaffoldState extends State<Scaffold> {
...
@@ -366,8 +366,8 @@ class ScaffoldState extends State<Scaffold> {
}
}
final
List
<
LayoutId
>
children
=
new
List
<
LayoutId
>();
final
List
<
LayoutId
>
children
=
new
List
<
LayoutId
>();
_addIfNonNull
(
children
,
materialBody
,
_
Child
.
body
);
_addIfNonNull
(
children
,
materialBody
,
_
ScaffoldSlot
.
body
);
_addIfNonNull
(
children
,
_modifiedToolBar
,
_
Child
.
toolBar
);
_addIfNonNull
(
children
,
_modifiedToolBar
,
_
ScaffoldSlot
.
toolBar
);
if
(
_currentBottomSheet
!=
null
||
if
(
_currentBottomSheet
!=
null
||
(
_dismissedBottomSheets
!=
null
&&
_dismissedBottomSheets
.
isNotEmpty
))
{
(
_dismissedBottomSheets
!=
null
&&
_dismissedBottomSheets
.
isNotEmpty
))
{
...
@@ -380,23 +380,23 @@ class ScaffoldState extends State<Scaffold> {
...
@@ -380,23 +380,23 @@ class ScaffoldState extends State<Scaffold> {
children:
bottomSheets
,
children:
bottomSheets
,
alignment:
const
FractionalOffset
(
0.5
,
1.0
)
// bottom-aligned, centered
alignment:
const
FractionalOffset
(
0.5
,
1.0
)
// bottom-aligned, centered
);
);
_addIfNonNull
(
children
,
stack
,
_
Child
.
bottomSheet
);
_addIfNonNull
(
children
,
stack
,
_
ScaffoldSlot
.
bottomSheet
);
}
}
if
(
_snackBars
.
isNotEmpty
)
if
(
_snackBars
.
isNotEmpty
)
_addIfNonNull
(
children
,
_snackBars
.
first
.
_widget
,
_
Child
.
snackBar
);
_addIfNonNull
(
children
,
_snackBars
.
first
.
_widget
,
_
ScaffoldSlot
.
snackBar
);
if
(
config
.
floatingActionButton
!=
null
)
{
if
(
config
.
floatingActionButton
!=
null
)
{
Widget
fab
=
new
_FloatingActionButtonTransition
(
Widget
fab
=
new
_FloatingActionButtonTransition
(
key:
new
ValueKey
<
Key
>(
config
.
floatingActionButton
.
key
),
key:
new
ValueKey
<
Key
>(
config
.
floatingActionButton
.
key
),
child:
config
.
floatingActionButton
child:
config
.
floatingActionButton
);
);
children
.
add
(
new
LayoutId
(
child:
fab
,
id:
_
Child
.
floatingActionButton
));
children
.
add
(
new
LayoutId
(
child:
fab
,
id:
_
ScaffoldSlot
.
floatingActionButton
));
}
}
if
(
config
.
drawer
!=
null
)
{
if
(
config
.
drawer
!=
null
)
{
children
.
add
(
new
LayoutId
(
children
.
add
(
new
LayoutId
(
id:
_
Child
.
drawer
,
id:
_
ScaffoldSlot
.
drawer
,
child:
new
DrawerController
(
child:
new
DrawerController
(
key:
_drawerKey
,
key:
_drawerKey
,
child:
config
.
drawer
child:
config
.
drawer
...
...
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