|
|
@ -25,7 +25,8 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> { |
|
|
|
final context, |
|
|
|
final context, |
|
|
|
final valuesSnapshot, |
|
|
|
final valuesSnapshot, |
|
|
|
) => |
|
|
|
) => |
|
|
|
ListTile( |
|
|
|
LayoutBuilder( |
|
|
|
|
|
|
|
builder: (final context, final constraints) => ListTile( |
|
|
|
title: Text( |
|
|
|
title: Text( |
|
|
|
option.label(context), |
|
|
|
option.label(context), |
|
|
|
style: enabledSnapshot.data ?? false |
|
|
|
style: enabledSnapshot.data ?? false |
|
|
@ -33,13 +34,22 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> { |
|
|
|
: Theme.of(context).textTheme.subtitle1!.copyWith(color: Theme.of(context).disabledColor), |
|
|
|
: Theme.of(context).textTheme.subtitle1!.copyWith(color: Theme.of(context).disabledColor), |
|
|
|
), |
|
|
|
), |
|
|
|
trailing: valuesSnapshot.hasData |
|
|
|
trailing: valuesSnapshot.hasData |
|
|
|
? DropdownButton<T>( |
|
|
|
? Container( |
|
|
|
|
|
|
|
constraints: BoxConstraints( |
|
|
|
|
|
|
|
maxWidth: constraints.maxWidth * 0.5, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child: IntrinsicWidth( |
|
|
|
|
|
|
|
child: DropdownButton<T>( |
|
|
|
|
|
|
|
isExpanded: true, |
|
|
|
value: value, |
|
|
|
value: value, |
|
|
|
items: valuesSnapshot.data!.keys |
|
|
|
items: valuesSnapshot.data!.keys |
|
|
|
.map( |
|
|
|
.map( |
|
|
|
(final k) => DropdownMenuItem( |
|
|
|
(final k) => DropdownMenuItem( |
|
|
|
value: k, |
|
|
|
value: k, |
|
|
|
child: Text(valuesSnapshot.data![k]!(context)), |
|
|
|
child: Text( |
|
|
|
|
|
|
|
valuesSnapshot.data![k]!(context), |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
) |
|
|
|
.toList(), |
|
|
|
.toList(), |
|
|
@ -48,10 +58,13 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> { |
|
|
|
await option.set(value as T); |
|
|
|
await option.set(value as T); |
|
|
|
} |
|
|
|
} |
|
|
|
: null, |
|
|
|
: null, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
) |
|
|
|
) |
|
|
|
: null, |
|
|
|
: null, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|