@@ -34,8 +34,9 @@ class PopupCategory<T> extends PopupEntry<T> {
34
34
class PopupMenu <T > extends StatefulWidget {
35
35
final List <PopupEntry <T >> categories;
36
36
final Function (T ) onSelect;
37
+ final bool showDescription;
37
38
38
- PopupMenu ({required this .categories, required this .onSelect});
39
+ PopupMenu ({required this .categories, required this .onSelect, this .showDescription = true });
39
40
40
41
@override
41
42
State <PopupMenu <T >> createState () =>
@@ -87,7 +88,7 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
87
88
mainAxisSize: MainAxisSize .min,
88
89
children: [
89
90
ConstrainedBox (
90
- constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: 150 ),
91
+ constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: widget.showDescription ? 150 : 200 ),
91
92
child: SingleChildScrollView (
92
93
child: Column (
93
94
children: widget.categories
@@ -96,7 +97,7 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
96
97
),
97
98
),
98
99
ConstrainedBox (
99
- constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: 150 ),
100
+ constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: widget.showDescription ? 150 : 250 ),
100
101
child: SingleChildScrollView (
101
102
child: Column (
102
103
crossAxisAlignment: CrossAxisAlignment .stretch,
@@ -122,19 +123,20 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
122
123
),
123
124
),
124
125
),
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
+ ),
135
138
),
136
139
),
137
- ),
138
140
]);
139
141
}
140
142
@@ -146,27 +148,28 @@ class _PopupMenuState<T> extends State<PopupMenu<T>> {
146
148
mainAxisSize: MainAxisSize .min,
147
149
children: [
148
150
ConstrainedBox (
149
- constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: 150 ),
151
+ constraints: BoxConstraints (maxHeight: 300 , minWidth: 150 , maxWidth: widget.showDescription ? 300 : 450 ),
150
152
child: SingleChildScrollView (
151
153
child: Column (
152
154
crossAxisAlignment: CrossAxisAlignment .stretch,
153
155
children: buildWidgets (items, inSearch: true ),
154
156
),
155
157
),
156
158
),
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
+ ),
167
171
),
168
172
),
169
- ),
170
173
],
171
174
);
172
175
}
0 commit comments