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

Yaru*Row: remove the width property #234

Merged
merged 1 commit into from
Oct 5, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/src/pages/rows/yaru_extra_option_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class YaruExtraOptionRow extends StatelessWidget {
required this.onChanged,
required this.onPressed,
required this.iconData,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand Down Expand Up @@ -72,9 +71,6 @@ class YaruExtraOptionRow extends StatelessWidget {
/// IconData for the [YaruOptionButton].
final IconData iconData;

/// Optional width passed to [YaruRow]
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand All @@ -100,7 +96,6 @@ class YaruExtraOptionRow extends StatelessWidget {
Widget build(BuildContext context) {
final enabled = this.enabled && value != null;
return YaruRow(
width: width,
enabled: enabled,
title: Text(actionLabel),
subtitle: actionDescription != null ? Text(actionDescription!) : null,
Expand Down
71 changes: 32 additions & 39 deletions lib/src/pages/rows/yaru_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class YaruRow extends StatelessWidget {
this.subtitle,
this.trailing,
this.enabled = true,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand Down Expand Up @@ -46,9 +45,6 @@ class YaruRow extends StatelessWidget {
/// Whether or not we can interact with the widget
final bool enabled;

/// The `width` of the [Widget], by default it will be 500.
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand Down Expand Up @@ -78,43 +74,40 @@ class YaruRow extends StatelessWidget {
? Theme.of(context).textTheme.bodyLarge!.color
: Theme.of(context).disabledColor,
),
child: SizedBox(
width: width,
child: Padding(
padding: padding,
child: Row(
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
textDirection: textDirection,
verticalDirection: verticalDirection,
textBaseline: textBaseline,
children: [
if (leading != null) ...[leading!, const SizedBox(width: 8)],
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title,
if (subtitle != null)
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: DefaultTextStyle(
style: enabled
? Theme.of(context).textTheme.bodySmall!
: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).disabledColor,
),
child: subtitle!,
),
child: Padding(
padding: padding,
child: Row(
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
textDirection: textDirection,
verticalDirection: verticalDirection,
textBaseline: textBaseline,
children: [
if (leading != null) ...[leading!, const SizedBox(width: 8)],
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title,
if (subtitle != null)
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: DefaultTextStyle(
style: enabled
? Theme.of(context).textTheme.bodySmall!
: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).disabledColor,
),
child: subtitle!,
),
],
),
),
],
),
if (trailing != null) ...[const SizedBox(width: 8), trailing!],
],
),
),
if (trailing != null) ...[const SizedBox(width: 8), trailing!],
],
),
),
);
Expand Down
5 changes: 0 additions & 5 deletions lib/src/pages/rows/yaru_single_info_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class YaruSingleInfoRow extends StatelessWidget {
super.key,
required this.infoLabel,
required this.infoValue,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand All @@ -38,9 +37,6 @@ class YaruSingleInfoRow extends StatelessWidget {
/// Default color of the text will be [Theme.of(context).colorScheme.onSurface.withAlpha(150)].
final String infoValue;

/// Optional width passed to [YaruRow]
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand All @@ -65,7 +61,6 @@ class YaruSingleInfoRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
return YaruRow(
width: width,
enabled: true,
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
Expand Down
5 changes: 0 additions & 5 deletions lib/src/pages/rows/yaru_slider_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class YaruSliderRow extends StatelessWidget {
this.showValue = true,
this.fractionDigits = 0,
required this.onChanged,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand Down Expand Up @@ -78,9 +77,6 @@ class YaruSliderRow extends StatelessWidget {
/// Function run when the slider changes its value
final Function(double) onChanged;

/// Optional width passed to [YaruRow]
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand Down Expand Up @@ -109,7 +105,6 @@ class YaruSliderRow extends StatelessWidget {
final enabled = this.enabled && value != null;

return YaruRow(
width: width,
enabled: enabled,
title: Text(actionLabel),
subtitle: actionDescription != null ? Text(actionDescription!) : null,
Expand Down
5 changes: 0 additions & 5 deletions lib/src/pages/rows/yaru_switch_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class YaruSwitchRow extends StatelessWidget {
this.actionDescription,
required this.value,
required this.onChanged,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand All @@ -49,9 +48,6 @@ class YaruSwitchRow extends StatelessWidget {
/// The callback that gets invoked when the [Switch] value changes.
final Function(bool) onChanged;

/// Optional width passed to [YaruRow]
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand All @@ -78,7 +74,6 @@ class YaruSwitchRow extends StatelessWidget {
final enabled = this.enabled && value != null;

return YaruRow(
width: width,
enabled: enabled,
title: trailingWidget,
subtitle: actionDescription != null ? Text(actionDescription!) : null,
Expand Down
5 changes: 0 additions & 5 deletions lib/src/pages/rows/yaru_toggle_buttons_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class YaruToggleButtonsRow extends StatelessWidget {
required this.labels,
required this.selectedValues,
required this.onPressed,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.mainAxisSize = MainAxisSize.max,
Expand Down Expand Up @@ -81,9 +80,6 @@ class YaruToggleButtonsRow extends StatelessWidget {
/// When the callback is null, all toggle buttons will be disabled.
final Function(int) onPressed;

/// Optional width passed to [YaruRow]
final double? width;

/// The padding [EdgeInsets] which defaults to `EdgeInsets.all(8.0)`.
final EdgeInsets padding;

Expand All @@ -110,7 +106,6 @@ class YaruToggleButtonsRow extends StatelessWidget {
final enabled = this.enabled && selectedValues != null;

return YaruRow(
width: width,
enabled: enabled,
title: Text(actionLabel),
subtitle: actionDescription != null ? Text(actionDescription!) : null,
Expand Down