Skip to content

Commit b4141c6

Browse files
committed
Implement proper TextFieldModel minimum size computation.
1 parent 4068ce0 commit b4141c6

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

lib/src/transformers/node_transformers/passive_divider_transformer.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class PassiveDividerWidget extends StatelessWidget {
8787
@override
8888
Widget build(BuildContext context) {
8989
if (node.properties.isVertical) {
90-
return SizedBox(
91-
height: node.isVerticalExpanded ? null : node.basicBoxLocal.height,
90+
return AdaptiveNodeBox(
91+
node: node,
9292
child: VerticalDivider(
9393
width: node.basicBoxLocal.width,
9494
thickness: node.properties.thickness,
@@ -98,8 +98,8 @@ class PassiveDividerWidget extends StatelessWidget {
9898
),
9999
);
100100
}
101-
return SizedBox(
102-
width: node.isHorizontalExpanded ? null : node.basicBoxLocal.width,
101+
return AdaptiveNodeBox(
102+
node: node,
103103
child: Divider(
104104
height: node.basicBoxLocal.height,
105105
thickness: node.properties.thickness,

lib/src/transformers/node_transformers/passive_text_field_transformer.dart

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
195195
signed: widget.node.properties.showSignKey)
196196
: widget.node.properties.keyboardType.toFlutter();
197197

198-
Widget field;
199-
200-
field = TextField(
198+
Widget field = TextField(
201199
focusNode: _focusNode,
202200
autocorrect: widget.node.properties.autoCorrect,
203201
autofocus: !widget.settings.isPreview && widget.node.properties.autoFocus,
@@ -246,24 +244,15 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
246244
),
247245
);
248246

249-
final double? width =
250-
widget.node.isHorizontalWrap || widget.node.isHorizontalExpanded
251-
? null
252-
: widget.node.basicBoxLocal.width;
253-
final double? height =
254-
widget.node.isVerticalWrap || widget.node.isVerticalExpanded
255-
? null
256-
: widget.node.basicBoxLocal.height;
257-
258247
if (widget.node.isHorizontalWrap) {
259-
field = IntrinsicWidth(
260-
child: field,
261-
);
248+
field = IntrinsicWidth(child: field);
249+
}
250+
if (widget.node.isVerticalWrap) {
251+
field = IntrinsicHeight(child: field);
262252
}
263253

264-
field = SizedBox(
265-
width: width,
266-
height: height,
254+
field = AdaptiveNodeBox(
255+
node: widget.node,
267256
child: field,
268257
);
269258

0 commit comments

Comments
 (0)