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
0044ea2d
Commit
0044ea2d
authored
Oct 02, 2017
by
Adam Barth
Committed by
GitHub
Oct 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace usage of FractionalOffset with Alignment (#12348)
Alignment will eventually replace FractionalOffset.
parent
2b126bcd
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
62 additions
and
62 deletions
+62
-62
keyboard_resize.dart
dev/integration_tests/ui/lib/keyboard_resize.dart
+1
-1
card_collection.dart
dev/manual_tests/lib/card_collection.dart
+3
-3
color_testing_demo.dart
dev/manual_tests/lib/color_testing_demo.dart
+2
-2
app_bar_bottom.dart
examples/catalog/lib/app_bar_bottom.dart
+1
-1
home.dart
examples/flutter_gallery/lib/demo/animation/home.dart
+2
-2
widgets.dart
examples/flutter_gallery/lib/demo/animation/widgets.dart
+4
-4
contacts_demo.dart
examples/flutter_gallery/lib/demo/contacts_demo.dart
+2
-2
cupertino_buttons_demo.dart
...er_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
+1
-1
bottom_navigation_demo.dart
...ter_gallery/lib/demo/material/bottom_navigation_demo.dart
+3
-3
buttons_demo.dart
examples/flutter_gallery/lib/demo/material/buttons_demo.dart
+4
-4
cards_demo.dart
examples/flutter_gallery/lib/demo/material/cards_demo.dart
+1
-1
drawer_demo.dart
examples/flutter_gallery/lib/demo/material/drawer_demo.dart
+5
-5
expansion_panels_demo.dart
...tter_gallery/lib/demo/material/expansion_panels_demo.dart
+1
-1
full_screen_dialog_demo.dart
...er_gallery/lib/demo/material/full_screen_dialog_demo.dart
+2
-2
grid_list_demo.dart
...les/flutter_gallery/lib/demo/material/grid_list_demo.dart
+1
-1
selection_controls_demo.dart
...er_gallery/lib/demo/material/selection_controls_demo.dart
+3
-3
tabs_demo.dart
examples/flutter_gallery/lib/demo/material/tabs_demo.dart
+2
-2
text_form_field_demo.dart
...utter_gallery/lib/demo/material/text_form_field_demo.dart
+1
-1
pesto_demo.dart
examples/flutter_gallery/lib/demo/pesto_demo.dart
+4
-4
shrine_home.dart
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
+1
-1
shrine_order.dart
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+2
-2
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+1
-1
hello_world.dart
examples/layers/rendering/hello_world.dart
+1
-1
spinning_square.dart
examples/layers/rendering/spinning_square.dart
+2
-2
spinning_mixed.dart
examples/layers/widgets/spinning_mixed.dart
+1
-1
alignment_test.dart
packages/flutter/test/painting/alignment_test.dart
+6
-6
finders.dart
packages/flutter_test/lib/src/finders.dart
+4
-4
finders_test.dart
packages/flutter_test/test/finders_test.dart
+1
-1
No files found.
dev/integration_tests/ui/lib/keyboard_resize.dart
View file @
0044ea2d
...
...
@@ -44,7 +44,7 @@ class _MyHomePageState extends State<MyHomePage> {
return
new
Scaffold
(
body:
new
Stack
(
fit:
StackFit
.
expand
,
alignment:
FractionalOffse
t
.
bottomCenter
,
alignment:
Alignmen
t
.
bottomCenter
,
children:
<
Widget
>[
new
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
...
...
dev/manual_tests/lib/card_collection.dart
View file @
0044ea2d
...
...
@@ -224,7 +224,7 @@ class CardCollectionState extends State<CardCollection> {
flexibleSpace:
new
Container
(
padding:
const
EdgeInsets
.
only
(
left:
72.0
),
height:
128.0
,
alignment:
const
FractionalOffset
(
0.0
,
0.7
5
),
alignment:
const
Alignment
(-
1.0
,
0.
5
),
child:
new
Text
(
'Swipe Away:
${_cardModels.length}
'
,
style:
Theme
.
of
(
context
).
primaryTextTheme
.
title
),
),
);
...
...
@@ -330,8 +330,8 @@ class CardCollectionState extends State<CardCollection> {
Shader
_createShader
(
Rect
bounds
)
{
return
new
LinearGradient
(
begin:
FractionalOffset
.
topLeft
,
end:
FractionalOffset
.
bottomLeft
,
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
colors:
<
Color
>[
const
Color
(
0x00FFFFFF
),
const
Color
(
0xFFFFFFFF
)],
stops:
<
double
>[
0.1
,
0.35
],
)
...
...
dev/manual_tests/lib/color_testing_demo.dart
View file @
0044ea2d
...
...
@@ -64,8 +64,8 @@ class GradientRow extends StatelessWidget {
height:
100.0
,
decoration:
new
BoxDecoration
(
gradient:
new
LinearGradient
(
begin:
FractionalOffse
t
.
topLeft
,
end:
FractionalOffse
t
.
bottomRight
,
begin:
Alignmen
t
.
topLeft
,
end:
Alignmen
t
.
bottomRight
,
colors:
<
Color
>[
leftColor
,
rightColor
],
),
),
...
...
examples/catalog/lib/app_bar_bottom.dart
View file @
0044ea2d
...
...
@@ -55,7 +55,7 @@ class _AppBarBottomSampleState extends State<AppBarBottomSample> with SingleTick
data:
Theme
.
of
(
context
).
copyWith
(
accentColor:
Colors
.
white
),
child:
new
Container
(
height:
48.0
,
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
child:
new
TabPageSelector
(
controller:
_tabController
),
),
),
...
...
examples/flutter_gallery/lib/demo/animation/home.dart
View file @
0044ea2d
...
...
@@ -169,7 +169,7 @@ class _AllSectionsLayout extends MultiChildLayoutDelegate {
this
.
selectedIndex
,
});
final
FractionalOffse
t
translation
;
final
Alignmen
t
translation
;
final
double
tColumnToRow
;
final
double
tCollapsed
;
final
int
cardCount
;
...
...
@@ -349,7 +349,7 @@ class _AllSectionsView extends AnimatedWidget {
return
new
CustomMultiChildLayout
(
delegate:
new
_AllSectionsLayout
(
translation:
new
FractionalOffset
(
selectedIndex
.
value
-
sectionIndex
,
0
.0
),
translation:
new
Alignment
((
selectedIndex
.
value
-
sectionIndex
)
*
2.0
-
1.0
,
-
1
.0
),
tColumnToRow:
tColumnToRow
,
tCollapsed:
tCollapsed
,
cardCount:
sections
.
length
,
...
...
examples/flutter_gallery/lib/demo/animation/widgets.dart
View file @
0044ea2d
...
...
@@ -25,8 +25,8 @@ class SectionCard extends StatelessWidget {
decoration:
new
BoxDecoration
(
borderRadius:
new
BorderRadius
.
circular
(
4.0
),
gradient:
new
LinearGradient
(
begin:
FractionalOffset
.
top
Left
,
end:
FractionalOffset
.
top
Right
,
begin:
Alignment
.
center
Left
,
end:
Alignment
.
center
Right
,
colors:
<
Color
>[
section
.
leftColor
,
section
.
rightColor
,
...
...
@@ -82,7 +82,7 @@ class SectionTitle extends StatelessWidget {
opacity:
opacity
,
child:
new
Transform
(
transform:
new
Matrix4
.
identity
()..
scale
(
scale
),
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
child:
new
Stack
(
children:
<
Widget
>[
new
Positioned
(
...
...
@@ -136,7 +136,7 @@ class SectionDetailView extends StatelessWidget {
package:
detail
.
imageAssetPackage
,
),
fit:
BoxFit
.
cover
,
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
),
),
);
...
...
examples/flutter_gallery/lib/demo/contacts_demo.dart
View file @
0044ea2d
...
...
@@ -166,8 +166,8 @@ class ContactsDemoState extends State<ContactsDemo> {
const
DecoratedBox
(
decoration:
const
BoxDecoration
(
gradient:
const
LinearGradient
(
begin:
const
FractionalOffset
(
0.5
,
0
.0
),
end:
const
FractionalOffset
(
0.5
,
0.30
),
begin:
const
Alignment
(
0.0
,
-
1
.0
),
end:
const
Alignment
(
0.0
,
-
0.4
),
colors:
const
<
Color
>[
const
Color
(
0x60000000
),
const
Color
(
0x00000000
)],
),
),
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
View file @
0044ea2d
...
...
@@ -39,7 +39,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
:
' '
),
const
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
)),
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
View file @
0044ea2d
...
...
@@ -47,9 +47,9 @@ class NavigationIconView {
return
new
FadeTransition
(
opacity:
_animation
,
child:
new
SlideTransition
(
position:
new
FractionalOffse
tTween
(
begin:
const
FractionalOffset
(
0.0
,
0.02
),
// Small offset from the top
.
end:
FractionalOffset
.
topLeft
,
position:
new
Alignmen
tTween
(
begin:
const
Alignment
(
0.0
,
0.4
),
// Slightly down
.
end:
Alignment
.
center
,
).
animate
(
_animation
),
child:
new
IconTheme
(
data:
new
IconThemeData
(
...
...
examples/flutter_gallery/lib/demo/material/buttons_demo.dart
View file @
0044ea2d
...
...
@@ -90,7 +90,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildRaisedButton
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -111,7 +111,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildFlatButton
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -213,7 +213,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildIconButton
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -237,7 +237,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildActionButton
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
FloatingActionButton
(
child:
const
Icon
(
Icons
.
add
),
onPressed:
()
{
...
...
examples/flutter_gallery/lib/demo/material/cards_demo.dart
View file @
0044ea2d
...
...
@@ -85,7 +85,7 @@ class TravelDestinationItem extends StatelessWidget {
right:
16.0
,
child:
new
FittedBox
(
fit:
BoxFit
.
scaleDown
,
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
child:
new
Text
(
destination
.
title
,
style:
titleStyle
,
),
...
...
examples/flutter_gallery/lib/demo/material/drawer_demo.dart
View file @
0044ea2d
...
...
@@ -25,7 +25,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
AnimationController
_controller
;
Animation
<
double
>
_drawerContentsOpacity
;
Animation
<
FractionalOffse
t
>
_drawerDetailsPosition
;
Animation
<
Alignmen
t
>
_drawerDetailsPosition
;
bool
_showDrawerContents
=
true
;
@override
...
...
@@ -39,9 +39,9 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
parent:
new
ReverseAnimation
(
_controller
),
curve:
Curves
.
fastOutSlowIn
,
);
_drawerDetailsPosition
=
new
FractionalOffse
tTween
(
begin:
const
FractionalOffset
(
0.0
,
-
1
.0
),
end:
const
FractionalOffset
(
0.0
,
0.0
)
,
_drawerDetailsPosition
=
new
Alignmen
tTween
(
begin:
const
Alignment
(
0.0
,
-
2
.0
),
end:
Alignment
.
center
,
).
animate
(
new
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
fastOutSlowIn
,
...
...
@@ -80,7 +80,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
appBar:
new
AppBar
(
leading:
new
IconButton
(
icon:
new
Icon
(
_backIcon
()),
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
tooltip:
'Back'
,
onPressed:
()
{
Navigator
.
pop
(
context
);
...
...
examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
View file @
0044ea2d
...
...
@@ -51,7 +51,7 @@ class DualHeaderWithHint extends StatelessWidget {
margin:
const
EdgeInsets
.
only
(
left:
24.0
),
child:
new
FittedBox
(
fit:
BoxFit
.
scaleDown
,
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
child:
new
Text
(
name
,
style:
textTheme
.
body1
.
copyWith
(
fontSize:
15.0
),
...
...
examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
View file @
0044ea2d
...
...
@@ -165,7 +165,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
decoration:
new
BoxDecoration
(
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
),
alignment:
FractionalOffse
t
.
bottomLeft
,
alignment:
Alignmen
t
.
bottomLeft
,
child:
new
Text
(
'Event name'
,
style:
theme
.
textTheme
.
display2
)
),
new
Container
(
...
...
@@ -173,7 +173,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
decoration:
new
BoxDecoration
(
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
),
alignment:
FractionalOffse
t
.
bottomLeft
,
alignment:
Alignmen
t
.
bottomLeft
,
child:
new
Text
(
'Location'
,
style:
theme
.
textTheme
.
title
.
copyWith
(
color:
Colors
.
black54
))
),
new
Column
(
...
...
examples/flutter_gallery/lib/demo/material/grid_list_demo.dart
View file @
0044ea2d
...
...
@@ -54,7 +54,7 @@ class _GridTitleText extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
FittedBox
(
fit:
BoxFit
.
scaleDown
,
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
child:
new
Text
(
text
),
);
}
...
...
examples/flutter_gallery/lib/demo/material/selection_controls_demo.dart
View file @
0044ea2d
...
...
@@ -75,7 +75,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildCheckbox
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -109,7 +109,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildRadio
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -161,7 +161,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildSwitch
()
{
return
new
Align
(
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
examples/flutter_gallery/lib/demo/material/tabs_demo.dart
View file @
0044ea2d
...
...
@@ -107,8 +107,8 @@ class _CardDataItem extends StatelessWidget {
children:
<
Widget
>[
new
Align
(
alignment:
page
.
id
==
'L'
?
FractionalOffse
t
.
centerLeft
:
FractionalOffse
t
.
centerRight
,
?
Alignmen
t
.
centerLeft
:
Alignmen
t
.
centerRight
,
child:
new
CircleAvatar
(
child:
new
Text
(
'
${page.id}
'
)),
),
new
SizedBox
(
...
...
examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
View file @
0044ea2d
...
...
@@ -188,7 +188,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
),
new
Container
(
padding:
const
EdgeInsets
.
all
(
20.0
),
alignment:
const
FractionalOffset
(
0.5
,
0.5
)
,
alignment:
Alignment
.
center
,
child:
new
RaisedButton
(
child:
const
Text
(
'SUBMIT'
),
onPressed:
_handleSubmitted
,
...
...
examples/flutter_gallery/lib/demo/pesto_demo.dart
View file @
0044ea2d
...
...
@@ -211,7 +211,7 @@ class _PestoLogoState extends State<PestoLogo> {
Widget
build
(
BuildContext
context
)
{
return
new
Transform
(
transform:
new
Matrix4
.
identity
()..
scale
(
widget
.
height
/
kLogoHeight
),
alignment:
FractionalOffse
t
.
topCenter
,
alignment:
Alignmen
t
.
topCenter
,
child:
new
SizedBox
(
width:
kLogoWidth
,
child:
new
Stack
(
...
...
@@ -362,8 +362,8 @@ class _RecipePageState extends State<RecipePage> {
background:
new
DecoratedBox
(
decoration:
new
BoxDecoration
(
gradient:
new
LinearGradient
(
begin:
const
FractionalOffset
(
0.5
,
0
.0
),
end:
const
FractionalOffset
(
0.5
,
0.40
),
begin:
const
Alignment
(
0.0
,
-
1
.0
),
end:
const
Alignment
(
0.0
,
-
0.2
),
colors:
<
Color
>[
const
Color
(
0x60000000
),
const
Color
(
0x00000000
)],
),
),
...
...
@@ -450,7 +450,7 @@ class RecipeSheet extends StatelessWidget {
package:
recipe
.
ingredientsImagePackage
,
width:
32.0
,
height:
32.0
,
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
fit:
BoxFit
.
scaleDown
)
),
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
View file @
0044ea2d
...
...
@@ -320,7 +320,7 @@ class _ProductItem extends StatelessWidget {
new
Column
(
children:
<
Widget
>[
new
Align
(
alignment:
FractionalOffse
t
.
centerRight
,
alignment:
Alignmen
t
.
centerRight
,
child:
new
_ProductPriceItem
(
product:
product
),
),
new
Container
(
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
View file @
0044ea2d
...
...
@@ -85,7 +85,7 @@ class _VendorItem extends StatelessWidget {
new
SizedBox
(
height:
24.0
,
child:
new
Align
(
alignment:
FractionalOffse
t
.
bottomLeft
,
alignment:
Alignmen
t
.
bottomLeft
,
child:
new
Text
(
vendor
.
name
,
style:
theme
.
vendorTitleStyle
),
),
),
...
...
@@ -174,7 +174,7 @@ class _Heading extends StatelessWidget {
product
.
imageAsset
,
package:
product
.
imageAssetPackage
,
fit:
BoxFit
.
contain
,
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
),
),
),
...
...
examples/flutter_gallery/lib/gallery/home.dart
View file @
0044ea2d
...
...
@@ -138,7 +138,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
child:
new
Container
(
height:
48.0
,
padding:
const
EdgeInsets
.
only
(
left:
16.0
),
alignment:
FractionalOffse
t
.
centerLeft
,
alignment:
Alignmen
t
.
centerLeft
,
child:
new
Text
(
galleryItem
.
category
,
style:
headerStyle
)
),
)
...
...
examples/layers/rendering/hello_world.dart
View file @
0044ea2d
...
...
@@ -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:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
// We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling.
child:
new
RenderParagraph
(
...
...
examples/layers/rendering/spinning_square.dart
View file @
0044ea2d
...
...
@@ -34,12 +34,12 @@ void main() {
// spin.
final
RenderTransform
spin
=
new
RenderTransform
(
transform:
new
Matrix4
.
identity
(),
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
child:
square
);
// Finally, we center the spinning green square...
final
RenderBox
root
=
new
RenderPositionedBox
(
alignment:
FractionalOffse
t
.
center
,
alignment:
Alignmen
t
.
center
,
child:
spin
);
// and attach it to the window.
...
...
examples/layers/widgets/spinning_mixed.dart
View file @
0044ea2d
...
...
@@ -100,7 +100,7 @@ void main() {
flexRoot
.
add
(
proxy
);
addFlexChildSolidColor
(
flexRoot
,
const
Color
(
0xFF0000FF
),
flex:
1
);
transformBox
=
new
RenderTransform
(
child:
flexRoot
,
transform:
new
Matrix4
.
identity
(),
alignment:
FractionalOffse
t
.
center
);
transformBox
=
new
RenderTransform
(
child:
flexRoot
,
transform:
new
Matrix4
.
identity
(),
alignment:
Alignmen
t
.
center
);
final
RenderPadding
root
=
new
RenderPadding
(
padding:
const
EdgeInsets
.
all
(
80.0
),
child:
transformBox
);
binding
.
renderView
.
child
=
root
;
...
...
packages/flutter/test/painting/alignment_test.dart
View file @
0044ea2d
...
...
@@ -14,14 +14,14 @@ void approxExpect(Alignment a, Alignment b) {
void
main
(
)
{
test
(
'Alignment control test'
,
()
{
const
Alignment
offse
t
=
const
Alignment
(
0.5
,
0.25
);
const
Alignment
alignmen
t
=
const
Alignment
(
0.5
,
0.25
);
expect
(
offse
t
,
hasOneLineDescription
);
expect
(
offse
t
.
hashCode
,
equals
(
const
Alignment
(
0.5
,
0.25
).
hashCode
));
expect
(
alignmen
t
,
hasOneLineDescription
);
expect
(
alignmen
t
.
hashCode
,
equals
(
const
Alignment
(
0.5
,
0.25
).
hashCode
));
expect
(
offse
t
/
2.0
,
const
Alignment
(
0.25
,
0.125
));
expect
(
offse
t
~/
2.0
,
const
Alignment
(
0.0
,
0.0
));
expect
(
offse
t
%
5.0
,
const
Alignment
(
0.5
,
0.25
));
expect
(
alignmen
t
/
2.0
,
const
Alignment
(
0.25
,
0.125
));
expect
(
alignmen
t
~/
2.0
,
const
Alignment
(
0.0
,
0.0
));
expect
(
alignmen
t
%
5.0
,
const
Alignment
(
0.5
,
0.25
));
});
test
(
'Alignment.lerp()'
,
()
{
...
...
packages/flutter_test/lib/src/finders.dart
View file @
0044ea2d
...
...
@@ -290,7 +290,7 @@ abstract class Finder {
///
/// The [at] parameter specifies the location relative to the size of the
/// target element where the hit test is performed.
Finder
hitTestable
({
FractionalOffset
at:
FractionalOffse
t
.
center
})
=>
new
_HitTestableFinder
(
this
,
at
);
Finder
hitTestable
({
Alignment
at:
Alignmen
t
.
center
})
=>
new
_HitTestableFinder
(
this
,
at
);
@override
String
toString
()
{
...
...
@@ -336,10 +336,10 @@ class _LastFinder extends Finder {
}
class
_HitTestableFinder
extends
Finder
{
_HitTestableFinder
(
this
.
parent
,
this
.
offse
t
);
_HitTestableFinder
(
this
.
parent
,
this
.
alignmen
t
);
final
Finder
parent
;
final
FractionalOffset
offse
t
;
final
Alignment
alignmen
t
;
@override
String
get
description
=>
'
${parent.description}
(considering only hit-testable ones)'
;
...
...
@@ -349,7 +349,7 @@ class _HitTestableFinder extends Finder {
for
(
final
Element
candidate
in
parent
.
apply
(
candidates
))
{
final
RenderBox
box
=
candidate
.
renderObject
;
assert
(
box
!=
null
);
final
Offset
absoluteOffset
=
box
.
localToGlobal
(
offse
t
.
alongSize
(
box
.
size
));
final
Offset
absoluteOffset
=
box
.
localToGlobal
(
alignmen
t
.
alongSize
(
box
.
size
));
final
HitTestResult
hitResult
=
new
HitTestResult
();
WidgetsBinding
.
instance
.
hitTest
(
hitResult
,
absoluteOffset
);
for
(
final
HitTestEntry
entry
in
hitResult
.
path
)
{
...
...
packages/flutter_test/test/finders_test.dart
View file @
0044ea2d
...
...
@@ -29,7 +29,7 @@ void main() {
)),
);
expect
(
find
.
byType
(
GestureDetector
),
findsNWidgets
(
2
));
final
Finder
hitTestable
=
find
.
byType
(
GestureDetector
).
hitTestable
(
at:
const
FractionalOffset
(
0.5
,
0.5
)
);
final
Finder
hitTestable
=
find
.
byType
(
GestureDetector
).
hitTestable
(
at:
Alignment
.
center
);
expect
(
hitTestable
,
findsOneWidget
);
expect
(
tester
.
widget
(
hitTestable
).
key
,
const
ValueKey
<
int
>(
0
));
});
...
...
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