Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 💄 Improve menu items layout #1013

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,28 @@ class _SettingsListItemWithDefaultValue extends _SettingsListItem {
height: AppFontSizes.size28,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: Responsive.drawerWidth(context) - 100,
child: Text(
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AutoSizeText(
heading,
style: disabled
? ArchethicThemeStyles.textStyleSize16W600Primary30
: ArchethicThemeStyles.textStyleSize16W600Primary,
),
),
AutoSizeText(
defaultValue.getDisplayName(context),
style: disabled
? ArchethicThemeStyles.textStyleSize12W100Primary30
: ArchethicThemeStyles.textStyleSize12W100Primary,
maxLines: 1,
stepGranularity: 0.1,
minFontSize: 8,
),
],
AutoSizeText(
defaultValue.getDisplayName(context),
style: disabled
? ArchethicThemeStyles.textStyleSize12W100Primary30
: ArchethicThemeStyles.textStyleSize12W100Primary,
maxLines: 1,
stepGranularity: 0.1,
minFontSize: 8,
),
],
),
),
],
),
Expand Down Expand Up @@ -127,13 +126,12 @@ class _SettingsListItemWithDefaultValueWithInfos extends _SettingsListItem {
height: AppFontSizes.size28,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: Responsive.drawerWidth(context) - 80,
child: Row(
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
Expand All @@ -148,18 +146,21 @@ class _SettingsListItemWithDefaultValueWithInfos extends _SettingsListItem {
),
],
),
),
SizedBox(
width: Responsive.drawerWidth(context) - 80,
child: AutoSizeText(
info,
maxLines: 5,
stepGranularity: 0.1,
minFontSize: 8,
style: ArchethicThemeStyles.textStyleSize12W100Primary,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 250),
child: AutoSizeText(
info,
maxLines: 5,
stepGranularity: 0.1,
minFontSize: 8,
style: ArchethicThemeStyles.textStyleSize12W100Primary,
),
),
),
],
],
),
),
const SizedBox(
width: 13,
),
],
),
Expand Down
46 changes: 24 additions & 22 deletions lib/ui/menu/settings/components/settings_list_item_singleline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,32 @@ class _SettingsListItemSingleLineWithInfos extends _SettingsListItem {
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: Responsive.drawerWidth(context) - 100,
child: Text(
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AutoSizeText(
heading,
style: headingStyle ??
ArchethicThemeStyles.textStyleSize16W600Primary,
),
),
SizedBox(
width: Responsive.drawerWidth(context) - 100,
child: AutoSizeText(
info,
maxLines: 5,
stepGranularity: 0.1,
minFontSize: 8,
style: ArchethicThemeStyles.textStyleSize12W100Primary,
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 250),
child: AutoSizeText(
info,
maxLines: 5,
stepGranularity: 0.1,
minFontSize: 8,
style: ArchethicThemeStyles.textStyleSize12W100Primary,
),
),
),
],
],
),
),
const SizedBox(
width: 13,
),
const Spacer(),
if (displayChevron != null && displayChevron == true)
Icon(
Symbols.chevron_right,
Expand Down Expand Up @@ -160,14 +161,15 @@ class _SettingsListItemSingleLine extends _SettingsListItem {
height: AppFontSizes.size28,
),
),
SizedBox(
width: Responsive.drawerWidth(context) - 100,
Expanded(
child: AutoSizeText(
heading,
style: headingStyle,
),
),
const Spacer(),
const SizedBox(
width: 13,
),
if (displayChevron != null && displayChevron == true)
Icon(
Symbols.chevron_right,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ class _SettingsListItemSwitch extends _SettingsListItem {
height: AppFontSizes.size28,
),
),
SizedBox(
width: Responsive.drawerWidth(context) - 130,
Expanded(
child: Text(
heading,
style: ArchethicThemeStyles.textStyleSize16W600Primary,
),
),
const Spacer(),
const SizedBox(
width: 13,
),
Container(
padding: const EdgeInsets.only(left: 2),
height: 30,
Expand Down
1 change: 0 additions & 1 deletion lib/ui/menu/settings/settings_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import 'package:aewallet/model/setting_item.dart';
import 'package:aewallet/ui/themes/archethic_theme.dart';
import 'package:aewallet/ui/themes/archethic_theme_base.dart';
import 'package:aewallet/ui/themes/styles.dart';
import 'package:aewallet/ui/util/responsive.dart';
import 'package:aewallet/ui/util/ui_util.dart';
import 'package:aewallet/ui/views/authenticate/auth_factory.dart';
import 'package:aewallet/ui/views/authenticate/logging_out.dart';
Expand Down
6 changes: 0 additions & 6 deletions lib/ui/util/responsive.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// SPDX-License-Identifier: AGPL-3.0-or-later

// Flutter imports:
import 'package:aewallet/ui/widgets/components/window_size.dart';
import 'package:flutter/material.dart';

class Responsive extends StatelessWidget {
Expand Down Expand Up @@ -36,8 +34,4 @@ class Responsive extends StatelessWidget {
return mobile;
}
}

static double drawerWidth(BuildContext context) {
return WindowSize().idealSize.width * 0.60;
}
}
4 changes: 2 additions & 2 deletions lib/ui/widgets/components/app_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class AppTextField extends ConsumerStatefulWidget {
final TextInputType? keyboardType;
final Function(String text)? onSubmitted;
final Function(String)? onChanged;
final double? topMargin;
final double topMargin;
final double? leftMargin;
final double? rightMargin;
final TextStyle? style;
Expand All @@ -117,7 +117,7 @@ class _AppTextFieldState extends ConsumerState<AppTextField> {
margin: EdgeInsets.only(
left: widget.leftMargin ?? 70,
right: widget.rightMargin ?? 70,
top: widget.topMargin!,
top: widget.topMargin,
),
padding: widget.padding,
width: double.infinity,
Expand Down