From fe5f23f204c0b11355c42f59b5e33060d36e58ab Mon Sep 17 00:00:00 2001 From: demola234 Date: Thu, 30 May 2024 13:32:37 +0100 Subject: [PATCH 1/4] (fix): adding style text to slider text --- lib/src/actions.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/actions.dart b/lib/src/actions.dart index 418a9fb8..1601ad49 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -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 _kDefaultTextStyle = TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, +); /// Represents an action of an [ActionPane]. class CustomSlidableAction extends StatelessWidget { @@ -199,6 +204,7 @@ class SlidableAction extends StatelessWidget { Text( label!, overflow: TextOverflow.ellipsis, + style: _kDefaultTextStyle, ), ); } From 265998b8a1c8a569fcf2b8b4706421b49e97de7d Mon Sep 17 00:00:00 2001 From: demola234 Date: Thu, 30 May 2024 13:39:48 +0100 Subject: [PATCH 2/4] chore: update SlidableAction to use default text style for label --- lib/src/actions.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/actions.dart b/lib/src/actions.dart index 1601ad49..ec5973a6 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -141,6 +141,7 @@ class SlidableAction extends StatelessWidget { this.backgroundColor = _kBackgroundColor, this.foregroundColor, this.autoClose = _kAutoClose, + this.textStyle = _kDefaultTextStyle, required this.onPressed, this.icon, this.spacing = 4, @@ -174,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? textStyle; + /// A label to display below the [icon]. final String? label; @@ -204,7 +210,7 @@ class SlidableAction extends StatelessWidget { Text( label!, overflow: TextOverflow.ellipsis, - style: _kDefaultTextStyle, + style: textStyle, ), ); } From ca0d55500332d5e35d8c93c45521a55c0d0bc45b Mon Sep 17 00:00:00 2001 From: demola234 Date: Thu, 30 May 2024 13:51:51 +0100 Subject: [PATCH 3/4] fix: update text color --- lib/src/actions.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/src/actions.dart b/lib/src/actions.dart index ec5973a6..1aa9b0ee 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -9,8 +9,8 @@ const int _kFlex = 1; const Color _kBackgroundColor = Colors.white; const bool _kAutoClose = true; const TextStyle _kDefaultTextStyle = TextStyle( - color: Colors.black, - fontSize: 16, + color: Colors.white, + fontSize: 13, fontWeight: FontWeight.w500, ); @@ -28,6 +28,7 @@ class CustomSlidableAction extends StatelessWidget { this.backgroundColor = _kBackgroundColor, this.foregroundColor, this.autoClose = _kAutoClose, + this.textStyle = _kDefaultTextStyle, this.borderRadius = BorderRadius.zero, this.padding, required this.onPressed, @@ -73,6 +74,13 @@ class CustomSlidableAction extends StatelessWidget { /// {@endtemplate} final SlidableActionCallback? onPressed; + /// {@template slidable.textStyle} + /// The text style of the OutlinedButton + /// + /// Defaults to [TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w500)] + /// {@endtemplate} + final TextStyle? textStyle; + /// {@template slidable.actions.borderRadius} /// The borderRadius of this action /// @@ -101,7 +109,7 @@ class CustomSlidableAction extends StatelessWidget { child: SizedBox.expand( child: OutlinedButton( onPressed: () => _handleTap(context), - style: OutlinedButton.styleFrom( + style: OutlinedButton.styleFrom padding: padding, backgroundColor: backgroundColor, disabledForegroundColor: effectiveForegroundColor.withOpacity(0.38), @@ -235,6 +243,7 @@ class SlidableAction extends StatelessWidget { autoClose: autoClose, backgroundColor: backgroundColor, foregroundColor: foregroundColor, + flex: flex, child: child, ); From e534fd8feda0cda136d9d3141b81c5176d14d9ed Mon Sep 17 00:00:00 2001 From: demola234 Date: Thu, 30 May 2024 13:59:19 +0100 Subject: [PATCH 4/4] fix: change name to label name --- lib/src/actions.dart | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/src/actions.dart b/lib/src/actions.dart index 1aa9b0ee..27131814 100644 --- a/lib/src/actions.dart +++ b/lib/src/actions.dart @@ -8,7 +8,7 @@ typedef SlidableActionCallback = void Function(BuildContext context); const int _kFlex = 1; const Color _kBackgroundColor = Colors.white; const bool _kAutoClose = true; -const TextStyle _kDefaultTextStyle = TextStyle( +const TextStyle _kDefaultlabelTextStyle = TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.w500, @@ -28,7 +28,6 @@ class CustomSlidableAction extends StatelessWidget { this.backgroundColor = _kBackgroundColor, this.foregroundColor, this.autoClose = _kAutoClose, - this.textStyle = _kDefaultTextStyle, this.borderRadius = BorderRadius.zero, this.padding, required this.onPressed, @@ -74,13 +73,6 @@ class CustomSlidableAction extends StatelessWidget { /// {@endtemplate} final SlidableActionCallback? onPressed; - /// {@template slidable.textStyle} - /// The text style of the OutlinedButton - /// - /// Defaults to [TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w500)] - /// {@endtemplate} - final TextStyle? textStyle; - /// {@template slidable.actions.borderRadius} /// The borderRadius of this action /// @@ -109,7 +101,7 @@ class CustomSlidableAction extends StatelessWidget { child: SizedBox.expand( child: OutlinedButton( onPressed: () => _handleTap(context), - style: OutlinedButton.styleFrom + style: OutlinedButton.styleFrom( padding: padding, backgroundColor: backgroundColor, disabledForegroundColor: effectiveForegroundColor.withOpacity(0.38), @@ -149,7 +141,7 @@ class SlidableAction extends StatelessWidget { this.backgroundColor = _kBackgroundColor, this.foregroundColor, this.autoClose = _kAutoClose, - this.textStyle = _kDefaultTextStyle, + this.labelTextStyle = _kDefaultlabelTextStyle, required this.onPressed, this.icon, this.spacing = 4, @@ -186,7 +178,7 @@ class SlidableAction extends StatelessWidget { /// The default text style for the label. /// /// Defaults to [ThemeData.textTheme.bodyText1]. - final TextStyle? textStyle; + final TextStyle? labelTextStyle; /// A label to display below the [icon]. final String? label; @@ -218,7 +210,7 @@ class SlidableAction extends StatelessWidget { Text( label!, overflow: TextOverflow.ellipsis, - style: textStyle, + style: labelTextStyle, ), ); } @@ -243,7 +235,6 @@ class SlidableAction extends StatelessWidget { autoClose: autoClose, backgroundColor: backgroundColor, foregroundColor: foregroundColor, - flex: flex, child: child, );