Skip to content

Commit

Permalink
fix: Add semantics to MoonTag (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kypsis authored Feb 14, 2023
1 parent 1b321ed commit e83bea2
Showing 1 changed file with 52 additions and 47 deletions.
99 changes: 52 additions & 47 deletions lib/src/widgets/tag/tag.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,56 +119,61 @@ class MoonTag extends StatelessWidget {
effectivePadding.bottom,
);

return GestureDetector(
onTap: onTap,
onLongPress: onLongPress,
child: Container(
height: effectiveHeight,
padding: correctedPadding,
constraints: BoxConstraints(minWidth: effectiveHeight),
decoration: ShapeDecoration(
color: effectiveBackgroundColor,
shape: SmoothRectangleBorder(
borderRadius: SmoothBorderRadius.only(
topLeft: SmoothRadius(
cornerRadius: effectiveBorderRadius.topLeft.x,
cornerSmoothing: 1,
),
topRight: SmoothRadius(
cornerRadius: effectiveBorderRadius.topRight.x,
cornerSmoothing: 1,
),
bottomLeft: SmoothRadius(
cornerRadius: effectiveBorderRadius.bottomLeft.x,
cornerSmoothing: 1,
),
bottomRight: SmoothRadius(
cornerRadius: effectiveBorderRadius.bottomRight.x,
cornerSmoothing: 1,
return Semantics(
label: semanticLabel,
button: false,
focusable: false,
child: GestureDetector(
onTap: onTap,
onLongPress: onLongPress,
child: Container(
height: effectiveHeight,
padding: correctedPadding,
constraints: BoxConstraints(minWidth: effectiveHeight),
decoration: ShapeDecoration(
color: effectiveBackgroundColor,
shape: SmoothRectangleBorder(
borderRadius: SmoothBorderRadius.only(
topLeft: SmoothRadius(
cornerRadius: effectiveBorderRadius.topLeft.x,
cornerSmoothing: 1,
),
topRight: SmoothRadius(
cornerRadius: effectiveBorderRadius.topRight.x,
cornerSmoothing: 1,
),
bottomLeft: SmoothRadius(
cornerRadius: effectiveBorderRadius.bottomLeft.x,
cornerSmoothing: 1,
),
bottomRight: SmoothRadius(
cornerRadius: effectiveBorderRadius.bottomRight.x,
cornerSmoothing: 1,
),
),
),
),
),
child: DefaultTextStyle.merge(
style: isUpperCase
? effectiveMoonTagSize.upperCaseTextStyle.copyWith(color: effectiveTextColor)
: effectiveMoonTagSize.textStyle.copyWith(color: effectiveTextColor),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (leftIcon != null)
Padding(
padding: EdgeInsets.symmetric(horizontal: effectiveGap),
child: leftIcon,
),
if (label != null) label!,
if (rightIcon != null)
Padding(
padding: EdgeInsets.symmetric(horizontal: effectiveGap),
child: rightIcon,
),
],
child: DefaultTextStyle.merge(
style: isUpperCase
? effectiveMoonTagSize.upperCaseTextStyle.copyWith(color: effectiveTextColor)
: effectiveMoonTagSize.textStyle.copyWith(color: effectiveTextColor),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (leftIcon != null)
Padding(
padding: EdgeInsets.symmetric(horizontal: effectiveGap),
child: leftIcon,
),
if (label != null) label!,
if (rightIcon != null)
Padding(
padding: EdgeInsets.symmetric(horizontal: effectiveGap),
child: rightIcon,
),
],
),
),
),
),
Expand Down

0 comments on commit e83bea2

Please sign in to comment.