Skip to content

Commit f3dfe13

Browse files
committed
No children shrink-wrapping #1 [EXP]
- Implement ButtonLayoutModel.
1 parent 5aac9bd commit f3dfe13

3 files changed

Lines changed: 2 additions & 30 deletions

File tree

lib/src/api/models/size.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SizeC with SerializableMixin, EquatableMixin {
2727
final double height;
2828

2929
/// An empty size, one with a zero width and a zero height.
30-
static SizeC zero = const SizeC(0, 0);
30+
static const SizeC zero = SizeC(0, 0);
3131

3232
/// Creates a [SizeC] with the given [width] and [height].
3333
const SizeC(this.width, this.height);

lib/src/api/nodes/button_node.dart

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -131,34 +131,6 @@ class ButtonNode extends SceneNode with CustomPropertiesMixin {
131131
super.multipleVariables,
132132
});
133133

134-
@override
135-
BoxConstraintsModel internalConstraints({
136-
required SizeFit horizontalFit,
137-
required SizeFit verticalFit,
138-
}) {
139-
final double iconSize =
140-
properties.icon.show ? (properties.icon.size ?? 24) : 0;
141-
final double gap =
142-
!properties.buttonType.isIconButton && properties.icon.show
143-
? properties.gap
144-
: 0;
145-
// 8 - padding.vertical is used for compact visual density.
146-
final SizeC minSize =
147-
SizeC(iconSize + gap, iconSize + (8 - padding.vertical));
148-
149-
return super
150-
.internalConstraints(
151-
horizontalFit: horizontalFit,
152-
verticalFit: verticalFit,
153-
)
154-
.union(
155-
BoxConstraintsModel(
156-
minWidth: minSize.width,
157-
minHeight: minSize.height,
158-
),
159-
);
160-
}
161-
162134
@override
163135
List<TriggerType> get triggerTypes =>
164136
[TriggerType.click, TriggerType.longPress];

lib/src/api/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class ITextSizeCalculator {
3131
/// Returns the smallest possible width a [TextNode] can have given the
3232
/// constraints of its current [NodeBox].
3333
/// The details are dependant on the implementation.
34-
double getBestTextWidthAtCurrentNodeBox();
34+
double getBestTextWidthAtCurrentNodeBox(double internalBoxWidth);
3535

3636
/// Returns The minimum height of a defined [TextNode].
3737
/// The details are dependant on the implementation.

0 commit comments

Comments
 (0)