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

YaruRow: make the description a widget #232

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
2 changes: 1 addition & 1 deletion example/lib/pages/section_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _SectionPageState extends State<SectionPage> {
YaruRow(
trailingWidget: Text("Trailing Widget"),
actionWidget: Text("Action Widget"),
description: "Description",
description: Text("Description"),
),
YaruSliderRow(
actionLabel: "YaruSection width",
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/dummy_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DummySection extends StatelessWidget {
YaruRow(
trailingWidget: Text("Trailing Widget"),
actionWidget: Text("Action Widget"),
description: "Description",
description: Text("Description"),
),
],
width: width,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/row_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RowList extends StatelessWidget {
trailingWidget: Text("Trailing Widget"),
actionWidget: Text("Action Widget"),
leadingWidget: Icon(YaruIcons.audio),
description: "Description",
description: Text("Description"),
),
itemCount: 20,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/rows/yaru_extra_option_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class YaruExtraOptionRow extends StatelessWidget {
width: width,
enabled: enabled,
trailingWidget: Text(actionLabel),
description: actionDescription,
description: actionDescription != null ? Text(actionDescription!) : null,
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
Expand Down
12 changes: 6 additions & 6 deletions lib/src/pages/rows/yaru_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class YaruRow extends StatelessWidget {
/// The [Widget] placed at trailing position.
final Widget trailingWidget;

/// The Description placed below [trailingWidget].
final String? description;
/// The [Widget] placed below [trailingWidget].
final Widget? description;

/// The [Widget] placed after the [trailingWidget].
final Widget actionWidget;
Expand Down Expand Up @@ -103,13 +103,13 @@ class YaruRow extends StatelessWidget {
if (description != null)
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Text(
description!,
child: DefaultTextStyle(
style: enabled
? Theme.of(context).textTheme.bodySmall
: Theme.of(context).textTheme.bodySmall?.copyWith(
? Theme.of(context).textTheme.bodySmall!
jpnurmi marked this conversation as resolved.
Show resolved Hide resolved
: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).disabledColor,
),
child: description!,
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/rows/yaru_slider_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class YaruSliderRow extends StatelessWidget {
width: width,
enabled: enabled,
trailingWidget: Text(actionLabel),
description: actionDescription,
description: actionDescription != null ? Text(actionDescription!) : null,
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/rows/yaru_switch_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class YaruSwitchRow extends StatelessWidget {
width: width,
enabled: enabled,
trailingWidget: trailingWidget,
description: actionDescription,
description: actionDescription != null ? Text(actionDescription!) : null,
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/rows/yaru_toggle_buttons_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class YaruToggleButtonsRow extends StatelessWidget {
width: width,
enabled: enabled,
trailingWidget: Text(actionLabel),
description: actionDescription,
description: actionDescription != null ? Text(actionDescription!) : null,
mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment,
Expand Down
2 changes: 1 addition & 1 deletion test/pages/rows/yaru_row_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
leadingWidget: Text('Foo Leading'),
actionWidget: Text('Foo Text'),
trailingWidget: Icon(Icons.add),
description: 'Foo Description',
description: Text('Foo Description'),
),
),
),
Expand Down