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) ...[ 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,
),
), ),
], ],
], ],

6
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(
child: Text(
userDetailsData.getDisplayName()!, userDetailsData.getDisplayName()!,
style: Theme.of(context).textTheme.bodyLarge!.copyWith( style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: textColor, 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,
), ),
); );
} }

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 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,
), ),
), ),
), ),
),
); );
} }

Loading…
Cancel
Save