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 On Label #480

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
12 changes: 12 additions & 0 deletions lib/src/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ typedef SlidableActionCallback = void Function(BuildContext context);
const int _kFlex = 1;
const Color _kBackgroundColor = Colors.white;
const bool _kAutoClose = true;
const TextStyle _kDefaultlabelTextStyle = TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.w500,
);

/// Represents an action of an [ActionPane].
class CustomSlidableAction extends StatelessWidget {
Expand Down Expand Up @@ -136,6 +141,7 @@ class SlidableAction extends StatelessWidget {
this.backgroundColor = _kBackgroundColor,
this.foregroundColor,
this.autoClose = _kAutoClose,
this.labelTextStyle = _kDefaultlabelTextStyle,
required this.onPressed,
this.icon,
this.spacing = 4,
Expand Down Expand Up @@ -169,6 +175,11 @@ class SlidableAction extends StatelessWidget {
/// Defaults to 4.
final double spacing;

/// The default text style for the label.
///
/// Defaults to [ThemeData.textTheme.bodyText1].
final TextStyle? labelTextStyle;

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

Expand Down Expand Up @@ -199,6 +210,7 @@ class SlidableAction extends StatelessWidget {
Text(
label!,
overflow: TextOverflow.ellipsis,
style: labelTextStyle,
),
);
}
Expand Down