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

Text style option #470

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions lib/src/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ class SlidableAction extends StatelessWidget {
this.autoClose = _kAutoClose,
required this.onPressed,
this.icon,
this.iconWidget,
this.spacing = 4,
this.label,
this.style,
this.borderRadius = BorderRadius.zero,
this.padding,
}) : assert(flex > 0),
Expand All @@ -163,6 +165,7 @@ class SlidableAction extends StatelessWidget {

/// An icon to display above the [label].
final IconData? icon;
final Widget? iconWidget;

/// The space between [icon] and [label] if both set.
///
Expand All @@ -171,6 +174,7 @@ class SlidableAction extends StatelessWidget {

/// A label to display below the [icon].
final String? label;
final TextStyle? style;

/// Padding of the OutlinedButton
final BorderRadius borderRadius;
Expand All @@ -187,6 +191,11 @@ class SlidableAction extends StatelessWidget {
Icon(icon),
);
}
if (iconWidget != null) {
children.add(
iconWidget,
);
}

if (label != null) {
if (children.isNotEmpty) {
Expand All @@ -198,6 +207,7 @@ class SlidableAction extends StatelessWidget {
children.add(
Text(
label!,
style: style,
overflow: TextOverflow.ellipsis,
),
);
Expand Down