Skip to content

Commit

Permalink
YaruRow: make the description a widget (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Oct 5, 2022
1 parent 62496a2 commit 53e95cf
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
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!
: 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

0 comments on commit 53e95cf

Please sign in to comment.