Skip to content

Commit 391f00a

Browse files
committed
Text max_lines
1 parent 6a6ae7f commit 391f00a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

client/lib/controls/list_tile.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class ListTileControl extends StatelessWidget {
5454
selected: selected,
5555
dense: dense,
5656
onTap: onPressed,
57+
enabled: !disabled,
5758
leading: leadingCtrls.isNotEmpty
5859
? createControl(control, leadingCtrls.first.id, disabled)
5960
: null,

client/lib/controls/text.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class TextControl extends StatelessWidget {
1818

1919
String text = control.attrString("value", "")!;
2020
bool noWrap = control.attrBool("noWrap", false)!;
21+
int? maxLines = control.attrInt("maxLines");
2122

2223
TextStyle? style;
2324
var styleName = control.attrString("style", null);
@@ -50,11 +51,13 @@ class TextControl extends StatelessWidget {
5051
control.attrBool("selectable", false)!
5152
? SelectableText(
5253
text,
54+
maxLines: maxLines,
5355
style: style,
5456
textAlign: textAlign,
5557
)
5658
: Text(
5759
text,
60+
maxLines: maxLines,
5861
softWrap: !noWrap,
5962
style: style,
6063
textAlign: textAlign,

sdk/python/flet/text.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(
5252
weight: FontWeight = None,
5353
italic: bool = None,
5454
style: str = None,
55+
max_lines: int = None,
5556
overflow: TextOverflow = None,
5657
selectable: bool = None,
5758
no_wrap: bool = None,
@@ -79,6 +80,7 @@ def __init__(
7980
self.italic = italic
8081
self.no_wrap = no_wrap
8182
self.style = style
83+
self.max_lines = max_lines
8284
self.overflow = overflow
8385
self.selectable = selectable
8486
self.color = color
@@ -166,6 +168,16 @@ def selectable(self):
166168
def selectable(self, value: Optional[bool]):
167169
self._set_attr("selectable", value)
168170

171+
# max_lines
172+
@property
173+
def max_lines(self):
174+
return self._get_attr("maxLines")
175+
176+
@max_lines.setter
177+
@beartype
178+
def max_lines(self, value: Optional[int]):
179+
self._set_attr("maxLines", value)
180+
169181
# overflow
170182
@property
171183
def overflow(self):

0 commit comments

Comments
 (0)