@@ -148,12 +148,15 @@ class _PropertyInputState extends State<_PropertyInput> {
148
148
149
149
@override
150
150
Widget build (BuildContext context) {
151
+ // TODO(elliette): Refactor to split each argument type into its own input
152
+ // widget class for readability.
153
+ final theme = Theme .of (context);
151
154
final argument = widget.argument;
152
155
final decoration = InputDecoration (
153
156
helperText: argument.isRequired ? '*required' : '' ,
154
157
errorText: argument.errorText,
155
158
isDense: true ,
156
- label: Text ( '${ argument . name }${ argument . isRequired ? '*' : '' }' ),
159
+ label: _inputLabel ( argument, theme : theme ),
157
160
border: const OutlineInputBorder (),
158
161
);
159
162
final argType = widget.argument.type;
@@ -179,7 +182,7 @@ class _PropertyInputState extends State<_PropertyInput> {
179
182
value: option,
180
183
// TODO(https://github.com/flutter/devtools/issues/8531) Handle onTap.
181
184
onTap: () {},
182
- child: Text (option),
185
+ child: Text (option, style : theme.fixedFontStyle ),
183
186
);
184
187
}).toList (),
185
188
onChanged: (newValue) async {
@@ -214,6 +217,54 @@ class _PropertyInputState extends State<_PropertyInput> {
214
217
}
215
218
}
216
219
220
+ Widget _inputLabel (EditableArgument argument, {required ThemeData theme}) {
221
+ final type = _typeForLabel (argument);
222
+ return RichText (
223
+ overflow: TextOverflow .ellipsis,
224
+ text: TextSpan (
225
+ text: type != null ? '$type ' : ':' ,
226
+ style: theme.fixedFontStyle,
227
+ children: [
228
+ TextSpan (
229
+ text: argument.name,
230
+ style: theme.fixedFontStyle.copyWith (
231
+ fontWeight: FontWeight .bold,
232
+ color: theme.colorScheme.primary,
233
+ ),
234
+ children: [
235
+ TextSpan (
236
+ text: argument.isRequired ? '*' : '' ,
237
+ style: theme.fixedFontStyle,
238
+ ),
239
+ ],
240
+ ),
241
+ ],
242
+ ),
243
+ );
244
+ }
245
+
246
+ String ? _typeForLabel (EditableArgument argument) {
247
+ String ? typeName;
248
+ switch (argument.type) {
249
+ case 'string' :
250
+ typeName = 'String' ;
251
+ break ;
252
+ case 'int' :
253
+ case 'double' :
254
+ case 'bool' :
255
+ typeName = argument.type;
256
+ break ;
257
+ case 'enum' :
258
+ typeName = argument.options? .first.split ('.' ).first;
259
+ break ;
260
+ default :
261
+ break ;
262
+ }
263
+
264
+ if (typeName == null ) return null ;
265
+ return argument.isNullable ? '$typeName ?' : typeName;
266
+ }
267
+
217
268
Future <void > _editArgument (String ? valueAsString) async {
218
269
final argName = widget.argument.name;
219
270
0 commit comments