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

add label style and custom widget instead of icon #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
8 changes: 4 additions & 4 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -275,7 +275,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -357,7 +357,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -406,7 +406,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
7 changes: 4 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
// A SlidableAction can have an icon and/or a label.
SlidableAction(
onPressed: doNothing,
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
// backgroundColor: Color(0xFFFE4A49),
// foregroundColor: Colors.white,
// icon: Icons.delete,
label: 'Delete',
labelStyle: TextStyle(color: Colors.red),
),
SlidableAction(
onPressed: doNothing,
Expand Down
12 changes: 12 additions & 0 deletions lib/src/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class SlidableAction extends StatelessWidget {
this.icon,
this.spacing = 4,
this.label,
this.widget,
this.labelStyle,
this.borderRadius = BorderRadius.zero,
this.padding,
}) : assert(flex > 0),
Expand All @@ -164,6 +166,9 @@ class SlidableAction extends StatelessWidget {
/// An icon to display above the [label].
final IconData? icon;

///Custom Icon "widget" instead of icon
final Widget? widget;

/// The space between [icon] and [label] if both set.
///
/// Defaults to 4.
Expand All @@ -172,6 +177,9 @@ class SlidableAction extends StatelessWidget {
/// A label to display below the [icon].
final String? label;

/// label style
final TextStyle? labelStyle;

/// Padding of the OutlinedButton
final BorderRadius borderRadius;

Expand All @@ -198,10 +206,14 @@ class SlidableAction extends StatelessWidget {
children.add(
Text(
label!,
style: labelStyle,
overflow: TextOverflow.ellipsis,
),
);
}
if (widget != null) {
children.add(widget!);
}

final child = children.length == 1
? children.first
Expand Down