Browse Source

Merge pull request #58 from jld3103/fix/long-account-names

settings,neon: Fix UI for long account names
pull/60/head
jld3103 2 years ago committed by GitHub
parent
commit
ebe2179174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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) ...[
Text(
account.client.humanReadableID,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.onPrimary,
),
style: Theme.of(context).textTheme.bodySmall!,
),
],
],

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

@ -50,11 +50,14 @@ class AccountTile extends StatelessWidget {
Row(
children: [
if (userDetailsData != null) ...[
Text(
userDetailsData.getDisplayName()!,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: textColor,
),
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,
),
);
}

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 valuesSnapshot,
) =>
ListTile(
title: Text(
option.label(context),
style: enabledSnapshot.data ?? false
? null
: Theme.of(context).textTheme.subtitle1!.copyWith(color: Theme.of(context).disabledColor),
LayoutBuilder(
builder: (final context, final constraints) => ListTile(
title: Text(
option.label(context),
style: enabledSnapshot.data ?? false
? 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