mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-26 17:56:28 +08:00
Fit aspect when performing layout.
This commit is contained in:
@ -12,12 +12,6 @@ abstract class RiveRenderBox extends RenderBox {
|
||||
Alignment _alignment;
|
||||
bool _useIntrinsicSize = false;
|
||||
|
||||
@override
|
||||
Size computeDryLayout(BoxConstraints constraints) {
|
||||
return constraints
|
||||
.constrainSizeAndAttemptToPreserveAspectRatio(_intrinsicSize);
|
||||
}
|
||||
|
||||
bool get useIntrinsicSize => _useIntrinsicSize;
|
||||
set useIntrinsicSize(bool value) {
|
||||
if (_useIntrinsicSize == value) {
|
||||
@ -63,7 +57,8 @@ abstract class RiveRenderBox extends RenderBox {
|
||||
@override
|
||||
void performLayout() {
|
||||
if (!sizedByParent) {
|
||||
size = constraints.constrain(_intrinsicSize);
|
||||
size = constraints
|
||||
.constrainSizeAndAttemptToPreserveAspectRatio(_intrinsicSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,9 +67,6 @@ abstract class RiveRenderBox extends RenderBox {
|
||||
|
||||
@override
|
||||
void performResize() {
|
||||
if (_useIntrinsicSize) {
|
||||
super.performResize();
|
||||
}
|
||||
size = constraints.biggest;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user