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
cc1af3af
Unverified
Commit
cc1af3af
authored
Jul 08, 2020
by
Mehmet Fidanboylu
Committed by
GitHub
Jul 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Expose height and width factor in AnimatedAlign (#60836)" (#61109)
This reverts commit
e8e1eb51
.
parent
0cff6542
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
163 deletions
+0
-163
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+0
-23
align_test.dart
packages/flutter/test/widgets/align_test.dart
+0
-66
animated_align_test.dart
packages/flutter/test/widgets/animated_align_test.dart
+0
-74
No files found.
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
cc1af3af
...
...
@@ -882,14 +882,10 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget {
Key
key
,
@required
this
.
alignment
,
this
.
child
,
this
.
heightFactor
=
1.0
,
this
.
widthFactor
=
1.0
,
Curve
curve
=
Curves
.
linear
,
@required
Duration
duration
,
VoidCallback
onEnd
,
})
:
assert
(
alignment
!=
null
),
assert
(
widthFactor
==
null
||
widthFactor
>=
0.0
),
assert
(
heightFactor
==
null
||
heightFactor
>=
0.0
),
super
(
key:
key
,
curve:
curve
,
duration:
duration
,
onEnd:
onEnd
);
/// How to align the child.
...
...
@@ -915,16 +911,6 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget {
/// {@macro flutter.widgets.child}
final
Widget
child
;
/// If non-null, sets its height to the child's height multiplied by this factor.
///
/// Can be both greater and less than 1.0 but must be positive. Defaults to 1.0.
final
double
heightFactor
;
/// If non-null, sets its width to the child's width multiplied by this factor.
///
/// Can be both greater and less than 1.0 but must be positive. Defaults to 1.0.
final
double
widthFactor
;
@override
_AnimatedAlignState
createState
()
=>
_AnimatedAlignState
();
...
...
@@ -937,23 +923,16 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget {
class
_AnimatedAlignState
extends
AnimatedWidgetBaseState
<
AnimatedAlign
>
{
AlignmentGeometryTween
_alignment
;
Tween
<
double
>
_heightFactorTween
;
Tween
<
double
>
_widthFactorTween
;
@override
void
forEachTween
(
TweenVisitor
<
dynamic
>
visitor
)
{
_alignment
=
visitor
(
_alignment
,
widget
.
alignment
,
(
dynamic
value
)
=>
AlignmentGeometryTween
(
begin:
value
as
AlignmentGeometry
))
as
AlignmentGeometryTween
;
_heightFactorTween
=
visitor
(
_heightFactorTween
,
widget
.
heightFactor
,
(
dynamic
value
)
=>
Tween
<
double
>(
begin:
value
as
double
))
as
Tween
<
double
>;
_widthFactorTween
=
visitor
(
_widthFactorTween
,
widget
.
widthFactor
,
(
dynamic
value
)
=>
Tween
<
double
>(
begin:
value
as
double
))
as
Tween
<
double
>;
}
@override
Widget
build
(
BuildContext
context
)
{
return
Align
(
alignment:
_alignment
.
evaluate
(
animation
),
heightFactor:
_heightFactorTween
.
evaluate
(
animation
),
widthFactor:
_widthFactorTween
.
evaluate
(
animation
),
child:
widget
.
child
,
);
}
...
...
@@ -962,8 +941,6 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
void
debugFillProperties
(
DiagnosticPropertiesBuilder
description
)
{
super
.
debugFillProperties
(
description
);
description
.
add
(
DiagnosticsProperty
<
AlignmentGeometryTween
>(
'alignment'
,
_alignment
,
defaultValue:
null
));
description
.
add
(
DiagnosticsProperty
<
Tween
<
double
>>(
'widthFactor'
,
_widthFactorTween
,
defaultValue:
null
));
description
.
add
(
DiagnosticsProperty
<
Tween
<
double
>>(
'heightFactor'
,
_heightFactorTween
,
defaultValue:
null
));
}
}
...
...
packages/flutter/test/widgets/align_test.dart
View file @
cc1af3af
...
...
@@ -112,70 +112,4 @@ void main() {
expect
(
size
.
width
,
equals
(
800.0
));
expect
(
size
.
height
,
equals
(
10.0
));
});
testWidgets
(
'Align widthFactor'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
inner
=
GlobalKey
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
Align
(
widthFactor:
0.5
,
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
Align
(
key:
inner
,
widthFactor:
0.5
,
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
],
),
),
);
final
RenderBox
box
=
inner
.
currentContext
.
findRenderObject
()
as
RenderBox
;
expect
(
box
.
size
.
width
,
equals
(
50.0
));
});
testWidgets
(
'Align heightFactor'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
inner
=
GlobalKey
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Align
(
alignment:
Alignment
.
center
,
heightFactor:
0.5
,
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
Align
(
key:
inner
,
alignment:
Alignment
.
center
,
heightFactor:
0.5
,
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
],
),
),
);
final
RenderBox
box
=
inner
.
currentContext
.
findRenderObject
()
as
RenderBox
;
expect
(
box
.
size
.
height
,
equals
(
50.0
));
});
}
packages/flutter/test/widgets/animated_align_test.dart
View file @
cc1af3af
...
...
@@ -59,78 +59,4 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byKey
(
target
)),
const
Size
(
100.0
,
200.0
));
expect
(
tester
.
getTopRight
(
find
.
byKey
(
target
)),
const
Offset
(
800.0
,
400.0
));
});
testWidgets
(
'AnimatedAlign widthFactor'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
inner
=
GlobalKey
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
AnimatedAlign
(
alignment:
Alignment
.
center
,
curve:
Curves
.
ease
,
widthFactor:
0.5
,
duration:
const
Duration
(
milliseconds:
200
),
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
AnimatedAlign
(
key:
inner
,
alignment:
Alignment
.
center
,
curve:
Curves
.
ease
,
widthFactor:
0.5
,
duration:
const
Duration
(
milliseconds:
200
),
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
],
),
),
);
final
RenderBox
box
=
inner
.
currentContext
.
findRenderObject
()
as
RenderBox
;
expect
(
box
.
size
,
equals
(
const
Size
(
50.0
,
100
)));
});
testWidgets
(
'AnimatedAlign heightFactor'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
inner
=
GlobalKey
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
AnimatedAlign
(
alignment:
Alignment
.
center
,
curve:
Curves
.
ease
,
heightFactor:
0.5
,
duration:
const
Duration
(
milliseconds:
200
),
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
AnimatedAlign
(
key:
inner
,
alignment:
Alignment
.
center
,
curve:
Curves
.
ease
,
heightFactor:
0.5
,
duration:
const
Duration
(
milliseconds:
200
),
child:
Container
(
height:
100.0
,
width:
100.0
,
),
),
],
),
),
);
final
RenderBox
box
=
inner
.
currentContext
.
findRenderObject
()
as
RenderBox
;
expect
(
box
.
size
,
equals
(
const
Size
(
100.0
,
50
)));
});
}
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