Compare commits
1 Commits
main
...
fix/neon_d
Author | SHA1 | Date |
---|---|---|
jld3103 | ea0f008dcf | 1 year ago |
@ -0,0 +1,33 @@ |
|||||||
|
// ignore_for_file: public_member_api_docs |
||||||
|
import 'package:flutter/rendering.dart'; |
||||||
|
import 'package:flutter/widgets.dart'; |
||||||
|
|
||||||
|
/// NOTE ref: https://github.com/flutter/flutter/issues/71687 & https://gist.github.com/matthew-carroll/65411529a5fafa1b527a25b7130187c6 |
||||||
|
/// Same as `IntrinsicHeight` except that when this widget is instructed |
||||||
|
/// to `computeDryLayout()`, it doesn't invoke that on its child, instead |
||||||
|
/// it computes the child's intrinsic height. |
||||||
|
/// |
||||||
|
/// This widget is useful in situations where the `child` does not |
||||||
|
/// support dry layout, e.g., `TextField` as of 01/02/2021. |
||||||
|
class DryIntrinsicHeight extends SingleChildRenderObjectWidget { |
||||||
|
const DryIntrinsicHeight({ |
||||||
|
super.key, |
||||||
|
super.child, |
||||||
|
}); |
||||||
|
|
||||||
|
@override |
||||||
|
RenderDryIntrinsicHeight createRenderObject(final BuildContext context) => RenderDryIntrinsicHeight(); |
||||||
|
} |
||||||
|
|
||||||
|
class RenderDryIntrinsicHeight extends RenderIntrinsicHeight { |
||||||
|
@override |
||||||
|
Size computeDryLayout(final BoxConstraints constraints) { |
||||||
|
if (child != null) { |
||||||
|
final height = child!.computeMinIntrinsicHeight(constraints.maxWidth); |
||||||
|
final width = child!.computeMinIntrinsicWidth(height); |
||||||
|
return Size(width, height); |
||||||
|
} else { |
||||||
|
return Size.zero; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.4 KiB |