Skip to content

Commit c26669a

Browse files
committed
fix(ui): node path is not shown fully when adding layout control
1 parent ad06059 commit c26669a

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

crates/ui/lib/views/layout/add_control_popup.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class AddControlPopup extends StatelessWidget {
6060
var shutterPresets = presets.shutters;
6161

6262
return PopupMenu<dynamic>(
63+
showDescription: false,
6364
categories: [
6465
PopupCategory(label: "New".i18n, items: [
6566
PopupItem(ControlType.BUTTON, "Button".i18n),

crates/ui/lib/widgets/popup/popup_menu.dart

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class PopupCategory<T> extends PopupEntry<T> {
3434
class PopupMenu<T> extends StatefulWidget {
3535
final List<PopupEntry<T>> categories;
3636
final Function(T) onSelect;
37+
final bool showDescription;
3738

38-
PopupMenu({required this.categories, required this.onSelect});
39+
PopupMenu({required this.categories, required this.onSelect, this.showDescription = true });
3940

4041
@override
4142
State<PopupMenu<T>> createState() =>
@@ -87,7 +88,7 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
8788
mainAxisSize: MainAxisSize.min,
8889
children: [
8990
ConstrainedBox(
90-
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: 150),
91+
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: widget.showDescription ? 150 : 200),
9192
child: SingleChildScrollView(
9293
child: Column(
9394
children: widget.categories
@@ -96,7 +97,7 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
9697
),
9798
),
9899
ConstrainedBox(
99-
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: 150),
100+
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: widget.showDescription ? 150 : 250),
100101
child: SingleChildScrollView(
101102
child: Column(
102103
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -122,19 +123,20 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
122123
),
123124
),
124125
),
125-
ConstrainedBox(
126-
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: 150),
127-
child: SingleChildScrollView(
128-
child: Padding(
129-
padding: const EdgeInsets.all(4.0),
130-
child: Column(
131-
crossAxisAlignment: CrossAxisAlignment.stretch,
132-
children: hovered?.description != null
133-
? [Text(hovered!.description!, style: TextStyle(color: Colors.white70))]
134-
: []),
126+
if (widget.showDescription)
127+
ConstrainedBox(
128+
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: 150),
129+
child: SingleChildScrollView(
130+
child: Padding(
131+
padding: const EdgeInsets.all(4.0),
132+
child: Column(
133+
crossAxisAlignment: CrossAxisAlignment.stretch,
134+
children: hovered?.description != null
135+
? [Text(hovered!.description!, style: TextStyle(color: Colors.white70))]
136+
: []),
137+
),
135138
),
136139
),
137-
),
138140
]);
139141
}
140142

@@ -146,27 +148,28 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
146148
mainAxisSize: MainAxisSize.min,
147149
children: [
148150
ConstrainedBox(
149-
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: 150),
151+
constraints: BoxConstraints(maxHeight: 300, minWidth: 150, maxWidth: widget.showDescription ? 300 : 450),
150152
child: SingleChildScrollView(
151153
child: Column(
152154
crossAxisAlignment: CrossAxisAlignment.stretch,
153155
children: buildWidgets(items, inSearch: true),
154156
),
155157
),
156158
),
157-
ConstrainedBox(
158-
constraints: BoxConstraints(maxHeight: 300, minWidth: 300, maxWidth: 300),
159-
child: SingleChildScrollView(
160-
child: Padding(
161-
padding: const EdgeInsets.all(4.0),
162-
child: Column(
163-
crossAxisAlignment: CrossAxisAlignment.stretch,
164-
children: hovered?.description != null
165-
? [Text(hovered!.description!, style: TextStyle(color: Colors.white70))]
166-
: []),
159+
if (widget.showDescription)
160+
ConstrainedBox(
161+
constraints: BoxConstraints(maxHeight: 300, minWidth: 300, maxWidth: 150),
162+
child: SingleChildScrollView(
163+
child: Padding(
164+
padding: const EdgeInsets.all(4.0),
165+
child: Column(
166+
crossAxisAlignment: CrossAxisAlignment.stretch,
167+
children: hovered?.description != null
168+
? [Text(hovered!.description!, style: TextStyle(color: Colors.white70))]
169+
: []),
170+
),
167171
),
168172
),
169-
),
170173
],
171174
);
172175
}

0 commit comments

Comments
 (0)