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. 6
      packages/neon/lib/src/widgets/account_tile.dart
  3. 19
      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) ...[
Text(
account.client.humanReadableID,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.onPrimary,
),
style: Theme.of(context).textTheme.bodySmall!,
),
],
],

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

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

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

@ -25,7 +25,8 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> {
final context,
final valuesSnapshot,
) =>
ListTile(
LayoutBuilder(
builder: (final context, final constraints) => ListTile(
title: Text(
option.label(context),
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),
),
trailing: valuesSnapshot.hasData
? DropdownButton<T>(
? 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)),
child: Text(
valuesSnapshot.data![k]!(context),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
@ -48,10 +58,13 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> {
await option.set(value as T);
}
: null,
),
),
)
: null,
),
),
),
),
);
}

Loading…
Cancel
Save