Browse Source

settings,neon: Fix UI for long account names

pull/58/head
jld3103 2 years ago
parent
commit
3dfcd7963e
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 4
      packages/neon/lib/src/pages/home/home.dart
  2. 14
      packages/neon/lib/src/widgets/account_tile.dart
  3. 61
      packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart

4
packages/neon/lib/src/pages/home/home.dart

@ -378,9 +378,7 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe
if (accounts.length > 1) ...[ if (accounts.length > 1) ...[
Text( Text(
account.client.humanReadableID, account.client.humanReadableID,
style: Theme.of(context).textTheme.bodySmall!.copyWith( style: Theme.of(context).textTheme.bodySmall!,
color: Theme.of(context).colorScheme.onPrimary,
),
), ),
], ],
], ],

14
packages/neon/lib/src/widgets/account_tile.dart

@ -50,11 +50,14 @@ class AccountTile extends StatelessWidget {
Row( Row(
children: [ children: [
if (userDetailsData != null) ...[ if (userDetailsData != null) ...[
Text( Flexible(
userDetailsData.getDisplayName()!, child: Text(
style: Theme.of(context).textTheme.bodyLarge!.copyWith( userDetailsData.getDisplayName()!,
color: textColor, style: Theme.of(context).textTheme.bodyLarge!.copyWith(
), color: textColor,
),
overflow: TextOverflow.ellipsis,
),
), ),
], ],
if (userDetailsLoading) ...[ if (userDetailsLoading) ...[
@ -88,6 +91,7 @@ class AccountTile extends StatelessWidget {
style: Theme.of(context).textTheme.bodySmall!.copyWith( style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: textColor, color: textColor,
), ),
overflow: TextOverflow.ellipsis,
), ),
); );
} }

61
packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart

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

Loading…
Cancel
Save