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
d312c9dc
Commit
d312c9dc
authored
Mar 29, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2970 from abarth/align_popup
Adds constants for FractionalOffsets
parents
6d8d3a0c
1ba539a6
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
48 additions
and
38 deletions
+48
-38
card_collection.dart
dev/manual_tests/card_collection.dart
+3
-3
hello_world.dart
examples/layers/rendering/hello_world.dart
+1
-1
spinning_square.dart
examples/layers/rendering/spinning_square.dart
+2
-2
full_screen_dialog_demo.dart
...es/material_gallery/lib/demo/full_screen_dialog_demo.dart
+2
-2
weather_demo.dart
examples/material_gallery/lib/demo/weather_demo.dart
+2
-2
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+2
-2
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+3
-3
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+1
-1
flexible_space_bar.dart
packages/flutter/lib/src/material/flexible_space_bar.dart
+1
-1
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+1
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+2
-2
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+1
-1
box_painter.dart
packages/flutter/lib/src/painting/box_painter.dart
+15
-4
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+3
-3
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+1
-1
transitions.dart
packages/flutter/lib/src/widgets/transitions.dart
+2
-2
box_test.dart
packages/flutter/test/rendering/box_test.dart
+1
-1
shader_mask_test.dart
packages/flutter/test/widget/shader_mask_test.dart
+5
-6
No files found.
dev/manual_tests/card_collection.dart
View file @
d312c9dc
...
...
@@ -397,8 +397,8 @@ class CardCollectionState extends State<CardCollection> {
Shader
_createShader
(
Rect
bounds
)
{
return
new
LinearGradient
(
begin:
const
FractionalOffset
(
0.0
,
0.0
)
,
end:
const
FractionalOffset
(
0.0
,
1.0
)
,
begin:
FractionalOffset
.
topLeft
,
end:
FractionalOffset
.
bottomLeft
,
colors:
<
Color
>[
const
Color
(
0x00FFFFFF
),
const
Color
(
0xFFFFFFFF
)],
stops:
<
double
>[
0.1
,
0.35
]
)
...
...
@@ -441,7 +441,7 @@ class CardCollectionState extends State<CardCollection> {
if
(
_snapToCenter
)
{
Widget
indicator
=
new
IgnorePointer
(
child:
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
0.5
)
,
alignment:
FractionalOffset
.
centerLeft
,
child:
new
Container
(
height:
1.0
,
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x80FFFFFF
))
...
...
examples/layers/rendering/hello_world.dart
View file @
d312c9dc
...
...
@@ -13,7 +13,7 @@ void main() {
// The root of our render tree is a RenderPositionedBox, which centers its
// child both vertically and horizontally.
root:
new
RenderPositionedBox
(
alignment:
const
FractionalOffset
(
0.5
,
0.5
)
,
alignment:
FractionalOffset
.
center
,
// We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling.
child:
new
RenderParagraph
(
new
TextSpan
(
text:
'Hello, world.'
))
...
...
examples/layers/rendering/spinning_square.dart
View file @
d312c9dc
...
...
@@ -27,12 +27,12 @@ void main() {
// spin.
RenderTransform
spin
=
new
RenderTransform
(
transform:
new
Matrix4
.
identity
(),
alignment:
const
FractionalOffset
(
0.5
,
0.5
)
,
alignment:
FractionalOffset
.
center
,
child:
square
);
// Finally, we center the spinning green square...
RenderBox
root
=
new
RenderPositionedBox
(
alignment:
const
FractionalOffset
(
0.5
,
0.5
)
,
alignment:
FractionalOffset
.
center
,
child:
spin
);
// and attach it to the window.
...
...
examples/material_gallery/lib/demo/full_screen_dialog_demo.dart
View file @
d312c9dc
...
...
@@ -172,7 +172,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
),
child:
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
1.0
)
,
alignment:
FractionalOffset
.
bottomLeft
,
child:
new
Text
(
'Event name'
,
style:
theme
.
textTheme
.
display2
)
)
),
...
...
@@ -182,7 +182,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
),
child:
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
1.0
)
,
alignment:
FractionalOffset
.
bottomLeft
,
child:
new
Text
(
'Location'
,
style:
theme
.
textTheme
.
title
.
copyWith
(
color:
Colors
.
black54
))
)
),
...
...
examples/material_gallery/lib/demo/weather_demo.dart
View file @
d312c9dc
...
...
@@ -285,8 +285,8 @@ class GradientNode extends NodeWithSize {
Rect
rect
=
Point
.
origin
&
size
;
Paint
gradientPaint
=
new
Paint
()..
shader
=
new
LinearGradient
(
begin:
const
FractionalOffset
(
0.0
,
0.0
)
,
end:
const
FractionalOffset
(
0.0
,
1.0
)
,
begin:
FractionalOffset
.
topLeft
,
end:
FractionalOffset
.
bottomLeft
,
colors:
<
Color
>[
colorTop
,
colorBottom
],
stops:
<
double
>[
0.0
,
1.0
]
).
createShader
(
rect
);
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
d312c9dc
...
...
@@ -187,7 +187,7 @@ class AppBar extends StatelessWidget {
padding:
new
EdgeInsets
.
only
(
left:
combinedPadding
.
left
,
right:
combinedPadding
.
right
),
child:
new
ClipRect
(
child:
new
OverflowBox
(
alignment:
const
FractionalOffset
(
0.0
,
1.0
)
,
// bottom justify
alignment:
FractionalOffset
.
bottomLeft
,
// bottom justify
minHeight:
paddedCollapsedHeight
,
maxHeight:
paddedCollapsedHeight
,
child:
new
Padding
(
...
...
@@ -203,7 +203,7 @@ class AppBar extends StatelessWidget {
appBar
=
new
Stack
(
children:
<
Widget
>[
flexibleSpace
(
context
),
new
Align
(
child:
appBar
,
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
)
new
Align
(
child:
appBar
,
alignment:
FractionalOffset
.
topLeft
)
]
);
}
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
d312c9dc
...
...
@@ -178,7 +178,7 @@ class DrawerControllerState extends State<DrawerController> {
Widget
build
(
BuildContext
context
)
{
if
(
_controller
.
status
==
AnimationStatus
.
dismissed
)
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
0.5
)
,
alignment:
FractionalOffset
.
centerLeft
,
child:
new
GestureDetector
(
key:
_gestureDetectorKey
,
onHorizontalDragUpdate:
_move
,
...
...
@@ -208,9 +208,9 @@ class DrawerControllerState extends State<DrawerController> {
)
),
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
0.5
)
,
alignment:
FractionalOffset
.
centerLeft
,
child:
new
Align
(
alignment:
const
FractionalOffset
(
1.0
,
0.5
)
,
alignment:
FractionalOffset
.
centerRight
,
widthFactor:
_controller
.
value
,
child:
new
RepaintBoundary
(
child:
new
Focus
(
...
...
packages/flutter/lib/src/material/dropdown.dart
View file @
d312c9dc
...
...
@@ -322,7 +322,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
children:
config
.
items
,
key:
indexedStackKey
,
index:
_selectedIndex
,
alignment:
const
FractionalOffset
(
0.5
,
0.0
)
alignment:
FractionalOffset
.
topCenter
),
new
Container
(
child:
new
Icon
(
icon:
Icons
.
arrow_drop_down
,
size:
36.0
),
...
...
packages/flutter/lib/src/material/flexible_space_bar.dart
View file @
d312c9dc
...
...
@@ -81,7 +81,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
end:
new
FractionalOffset
(
0.0
,
yAlignEnd
)
).
evaluate
(
scaleAndAlignCurve
),
child:
new
ScaleTransition
(
alignment:
const
FractionalOffset
(
0.0
,
1.0
)
,
alignment:
FractionalOffset
.
bottomLeft
,
scale:
new
Tween
<
double
>(
begin:
1.5
,
end:
1.0
).
animate
(
scaleAndAlignCurve
),
child:
new
Align
(
alignment:
new
FractionalOffset
(
0.0
,
1.0
),
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
d312c9dc
...
...
@@ -236,7 +236,7 @@ class _PopupMenu<T> extends StatelessWidget {
type:
MaterialType
.
card
,
elevation:
route
.
elevation
,
child:
new
Align
(
alignment:
const
FractionalOffset
(
1.0
,
0.0
)
,
alignment:
FractionalOffset
.
topRight
,
widthFactor:
width
.
evaluate
(
route
.
animation
),
heightFactor:
height
.
evaluate
(
route
.
animation
),
child:
child
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
d312c9dc
...
...
@@ -534,7 +534,7 @@ class ScaffoldState extends State<Scaffold> {
bottomSheets
.
add
(
_currentBottomSheet
.
_widget
);
Widget
stack
=
new
Stack
(
children:
bottomSheets
,
alignment:
const
FractionalOffset
(
0.5
,
1.0
)
// bottom-aligned, centered
alignment:
FractionalOffset
.
bottomCenter
);
_addIfNonNull
(
children
,
stack
,
_ScaffoldSlot
.
bottomSheet
);
}
...
...
@@ -661,7 +661,7 @@ class _PersistentBottomSheetState extends State<_PersistentBottomSheet> {
animation:
config
.
animationController
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
,
alignment:
FractionalOffset
.
topLeft
,
heightFactor:
config
.
animationController
.
value
,
child:
child
);
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
d312c9dc
...
...
@@ -111,7 +111,7 @@ class SnackBar extends StatelessWidget {
animation:
heightAnimation
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
,
alignment:
FractionalOffset
.
topLeft
,
heightFactor:
heightAnimation
.
value
,
child:
child
);
...
...
packages/flutter/lib/src/painting/box_painter.dart
View file @
d312c9dc
...
...
@@ -481,8 +481,8 @@ abstract class Gradient {
/// A 2D linear gradient.
class
LinearGradient
extends
Gradient
{
const
LinearGradient
({
this
.
begin
:
const
FractionalOffset
(
0.0
,
0.5
)
,
this
.
end
:
const
FractionalOffset
(
1.0
,
0.5
)
,
this
.
begin
:
FractionalOffset
.
centerLeft
,
this
.
end
:
FractionalOffset
.
centerRight
,
this
.
colors
,
this
.
stops
,
this
.
tileMode
:
TileMode
.
clamp
...
...
@@ -570,7 +570,7 @@ class LinearGradient extends Gradient {
/// A 2D radial gradient.
class
RadialGradient
extends
Gradient
{
const
RadialGradient
({
this
.
center
:
const
FractionalOffset
(
0.5
,
0.5
)
,
this
.
center
:
FractionalOffset
.
center
,
this
.
radius
:
0.5
,
this
.
colors
,
this
.
stops
,
...
...
@@ -856,7 +856,18 @@ class FractionalOffset {
final
double
dx
;
final
double
dy
;
static
const
FractionalOffset
zero
=
const
FractionalOffset
(
0.0
,
0.0
);
static
const
FractionalOffset
topLeft
=
const
FractionalOffset
(
0.0
,
0.0
);
static
const
FractionalOffset
topCenter
=
const
FractionalOffset
(
0.5
,
0.0
);
static
const
FractionalOffset
topRight
=
const
FractionalOffset
(
1.0
,
0.0
);
static
const
FractionalOffset
bottomLeft
=
const
FractionalOffset
(
0.0
,
1.0
);
static
const
FractionalOffset
bottomCenter
=
const
FractionalOffset
(
0.5
,
1.0
);
static
const
FractionalOffset
bottomRight
=
const
FractionalOffset
(
1.0
,
1.0
);
static
const
FractionalOffset
centerLeft
=
const
FractionalOffset
(
0.0
,
0.5
);
static
const
FractionalOffset
centerRight
=
const
FractionalOffset
(
1.0
,
0.5
);
static
const
FractionalOffset
center
=
const
FractionalOffset
(
0.5
,
0.5
);
FractionalOffset
operator
-()
{
return
new
FractionalOffset
(-
dx
,
-
dy
);
...
...
packages/flutter/lib/src/rendering/stack.dart
View file @
d312c9dc
...
...
@@ -201,7 +201,7 @@ abstract class RenderStackBase extends RenderBox
RenderBoxContainerDefaultsMixin
<
RenderBox
,
StackParentData
>
{
RenderStackBase
({
List
<
RenderBox
>
children
,
FractionalOffset
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
FractionalOffset
alignment:
FractionalOffset
.
topLeft
})
:
_alignment
=
alignment
{
addAll
(
children
);
}
...
...
@@ -440,7 +440,7 @@ abstract class RenderStackBase extends RenderBox
class
RenderStack
extends
RenderStackBase
{
RenderStack
({
List
<
RenderBox
>
children
,
FractionalOffset
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
FractionalOffset
alignment:
FractionalOffset
.
topLeft
})
:
super
(
children:
children
,
alignment:
alignment
...
...
@@ -460,7 +460,7 @@ class RenderStack extends RenderStackBase {
class
RenderIndexedStack
extends
RenderStackBase
{
RenderIndexedStack
({
List
<
RenderBox
>
children
,
FractionalOffset
alignment:
const
FractionalOffset
(
0.0
,
0.0
)
,
FractionalOffset
alignment:
FractionalOffset
.
topLeft
,
int
index:
0
})
:
_index
=
index
,
super
(
children:
children
,
...
...
packages/flutter/lib/src/widgets/dismissable.dart
View file @
d312c9dc
...
...
@@ -191,7 +191,7 @@ class _DismissableState extends State<Dismissable> {
void
_updateMoveAnimation
()
{
_moveAnimation
=
new
Tween
<
FractionalOffset
>(
begin:
FractionalOffset
.
zero
,
begin:
FractionalOffset
.
topLeft
,
end:
_directionIsXAxis
?
new
FractionalOffset
(
_dragExtent
.
sign
,
0.0
)
:
new
FractionalOffset
(
0.0
,
_dragExtent
.
sign
)
...
...
packages/flutter/lib/src/widgets/transitions.dart
View file @
d312c9dc
...
...
@@ -121,7 +121,7 @@ class ScaleTransition extends AnimatedWidget {
ScaleTransition
({
Key
key
,
Animation
<
double
>
scale
,
this
.
alignment
:
const
FractionalOffset
(
0.5
,
0.5
)
,
this
.
alignment
:
FractionalOffset
.
center
,
this
.
child
})
:
scale
=
scale
,
super
(
key:
key
,
animation:
scale
);
...
...
@@ -177,7 +177,7 @@ class RotationTransition extends AnimatedWidget {
Matrix4
transform
=
new
Matrix4
.
rotationZ
(
turnsValue
*
math
.
PI
*
2.0
);
return
new
Transform
(
transform:
transform
,
alignment:
const
FractionalOffset
(
0.5
,
0.5
)
,
alignment:
FractionalOffset
.
center
,
child:
child
);
}
...
...
packages/flutter/test/rendering/box_test.dart
View file @
d312c9dc
...
...
@@ -14,7 +14,7 @@ void main() {
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
),
gradient:
new
RadialGradient
(
center:
FractionalOffset
.
zero
,
radius:
1.8
,
center:
FractionalOffset
.
topLeft
,
radius:
1.8
,
colors:
<
Color
>[
Colors
.
yellow
[
500
],
Colors
.
blue
[
500
]]),
boxShadow:
elevationToShadow
[
3
])
);
...
...
packages/flutter/test/widget/shader_mask_test.dart
View file @
d312c9dc
...
...
@@ -10,12 +10,11 @@ import 'package:test/test.dart';
Shader
createShader
(
Rect
bounds
)
{
return
new
LinearGradient
(
begin:
const
FractionalOffset
(
0.0
,
0.0
)
,
end:
const
FractionalOffset
(
0.0
,
1.0
)
,
begin:
FractionalOffset
.
topLeft
,
end:
FractionalOffset
.
bottomLeft
,
colors:
<
Color
>[
const
Color
(
0x00FFFFFF
),
const
Color
(
0xFFFFFFFF
)],
stops:
<
double
>[
0.1
,
0.35
]
)
.
createShader
(
bounds
);
).
createShader
(
bounds
);
}
...
...
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