[FIX] Null value on the bools

This commit is contained in:
2024-05-18 15:35:17 +03:00
parent ced9c294f5
commit 80d462786b
3 changed files with 27 additions and 27 deletions

View File

@@ -34,9 +34,9 @@ class AstromicButtons {
onTap: onTap, onTap: onTap,
onHold: onHold, onHold: onHold,
// //
isEnabled: isEnabled, isEnabled: isEnabled ?? true,
withFeedback: withFeedback, withFeedback: withFeedback ?? true,
withHighlightChange: withHighlightChange, withHighlightChange: withHighlightChange ?? true,
// //
widthSizingStrategy: widthSizingStrategy, widthSizingStrategy: widthSizingStrategy,
heightSizingStrategy: heightSizingStrategy, heightSizingStrategy: heightSizingStrategy,
@@ -92,7 +92,7 @@ class AstromicButtons {
// //
bool? isUnderlined, bool? isUnderlined,
EdgeInsetsGeometry? contentPadding, EdgeInsetsGeometry? contentPadding,
required TextStyle Function(bool isEnabled)? style, TextStyle Function(bool isEnabled)? style,
// //
String? text, String? text,
Widget? textWidget, Widget? textWidget,
@@ -103,10 +103,10 @@ class AstromicButtons {
onTap: onTap, onTap: onTap,
onHold: onHold, onHold: onHold,
// //
isEnabled: isEnabled, isEnabled: isEnabled ?? true,
textDirection: textDirection, textDirection: textDirection ?? TextDirection.ltr,
// //
isUnderlined: isUnderlined, isUnderlined: isUnderlined ?? true,
contentPadding: contentPadding, contentPadding: contentPadding,
style: style, style: style,
// //

View File

@@ -25,10 +25,10 @@ class AstromicLinkButton extends StatelessWidget {
final VoidCallback? onTap; final VoidCallback? onTap;
final VoidCallback? onHold; final VoidCallback? onHold;
//s1 -- Configurations //s1 -- Configurations
final bool? isEnabled; final bool isEnabled;
final TextDirection? textDirection; final TextDirection textDirection;
//s1 -- Style //s1 -- Style
final bool? isUnderlined; final bool isUnderlined;
final EdgeInsetsGeometry? contentPadding; final EdgeInsetsGeometry? contentPadding;
final TextStyle Function(bool isEnabled)? style; final TextStyle Function(bool isEnabled)? style;
// //
@@ -45,10 +45,10 @@ class AstromicLinkButton extends StatelessWidget {
this.onTap, this.onTap,
this.onHold, this.onHold,
//s1 -- Configurations //s1 -- Configurations
this.isEnabled = true, required this.isEnabled,
this.textDirection, required this.textDirection,
//s1 -- Style //s1 -- Style
this.isUnderlined = true, required this.isUnderlined,
this.contentPadding, this.contentPadding,
this.style, this.style,
//s1 -- Content //s1 -- Content
@@ -82,7 +82,7 @@ class AstromicLinkButton extends StatelessWidget {
onTap: onTap, onTap: onTap,
onHold: onHold, onHold: onHold,
// //
isEnabled: isEnabled!, isEnabled: isEnabled,
withFeedback: false, withFeedback: false,
withHighlightChange: false, withHighlightChange: false,
isFullWidth: false, isFullWidth: false,
@@ -102,10 +102,10 @@ class AstromicLinkButton extends StatelessWidget {
text!, text!,
style: style != null style: style != null
? style!(isEnabled).copyWith( ? style!(isEnabled).copyWith(
decoration: isUnderlined! ? TextDecoration.underline : TextDecoration.none, decoration: isUnderlined ? TextDecoration.underline : TextDecoration.none,
) )
: TextStyle( : TextStyle(
decoration: isUnderlined! ? TextDecoration.underline : TextDecoration.none, decoration: isUnderlined ? TextDecoration.underline : TextDecoration.none,
), ),
), ),
if (suffix != null) suffix!, if (suffix != null) suffix!,

View File

@@ -26,9 +26,9 @@ class AstromicStateButton extends StatefulWidget {
final void Function(VoidCallback start, VoidCallback stop)? onTap; final void Function(VoidCallback start, VoidCallback stop)? onTap;
final Function(VoidCallback start, VoidCallback stop)? onHold; final Function(VoidCallback start, VoidCallback stop)? onHold;
//s1 -- Configurations //s1 -- Configurations
final bool? isEnabled; final bool isEnabled;
final bool? withFeedback; final bool withFeedback;
final bool? withHighlightChange; final bool withHighlightChange;
//s1 -- Style //s1 -- Style
final SizingStrategy? widthSizingStrategy; final SizingStrategy? widthSizingStrategy;
final SizingStrategy? heightSizingStrategy; final SizingStrategy? heightSizingStrategy;
@@ -45,9 +45,9 @@ class AstromicStateButton extends StatefulWidget {
this.onTap, this.onTap,
this.onHold, this.onHold,
// //
this.isEnabled = true, required this.isEnabled,
this.withFeedback = true, required this.withFeedback,
this.withHighlightChange = true, required this.withHighlightChange,
//s1 -- Style //s1 -- Style
this.widthSizingStrategy = SizingStrategy.hug, this.widthSizingStrategy = SizingStrategy.hug,
this.heightSizingStrategy = SizingStrategy.hug, this.heightSizingStrategy = SizingStrategy.hug,
@@ -104,9 +104,9 @@ class _AstromicStateButtonState extends State<AstromicStateButton> {
//s1 -Widgets //s1 -Widgets
//----- //-----
Widget baseChild = AstromicButtonBase( Widget baseChild = AstromicButtonBase(
isEnabled: widget.isEnabled!, isEnabled: widget.isEnabled,
withFeedback: widget.withFeedback!, withFeedback: widget.withFeedback,
withHighlightChange: widget.withHighlightChange!, withHighlightChange: widget.withHighlightChange,
isFullWidth: false, isFullWidth: false,
// //
onTap: !isLoading && context.mounted && widget.onTap != null onTap: !isLoading && context.mounted && widget.onTap != null
@@ -159,8 +159,8 @@ class _AstromicStateButtonState extends State<AstromicStateButton> {
//SECTION - Build Return //SECTION - Build Return
return SizedBox( return SizedBox(
width: widget.widthSizingStrategy == SizingStrategy.fixed && widget.style != null ? widget.style!(widget.isEnabled!, isHighlighted, isLoading).fixedWidth : null, width: widget.widthSizingStrategy == SizingStrategy.fixed && widget.style != null ? widget.style!(widget.isEnabled, isHighlighted, isLoading).fixedWidth : null,
height: widget.heightSizingStrategy == SizingStrategy.fixed && widget.style != null ? widget.style!(widget.isEnabled!, isHighlighted, isLoading).fixedHeight : null, height: widget.heightSizingStrategy == SizingStrategy.fixed && widget.style != null ? widget.style!(widget.isEnabled, isHighlighted, isLoading).fixedHeight : null,
child: Row( child: Row(
mainAxisSize: widget.widthSizingStrategy == SizingStrategy.hug ? MainAxisSize.min : MainAxisSize.max, mainAxisSize: widget.widthSizingStrategy == SizingStrategy.hug ? MainAxisSize.min : MainAxisSize.max,
children: [ children: [