|
@@ -13,6 +13,7 @@ class MenuItemWidget extends StatefulWidget {
|
|
final Color? leadingIconColor;
|
|
final Color? leadingIconColor;
|
|
|
|
|
|
final Widget? leadingIconWidget;
|
|
final Widget? leadingIconWidget;
|
|
|
|
+
|
|
// leadIconSize deafult value is 20.
|
|
// leadIconSize deafult value is 20.
|
|
final double leadingIconSize;
|
|
final double leadingIconSize;
|
|
|
|
|
|
@@ -29,7 +30,13 @@ class MenuItemWidget extends StatefulWidget {
|
|
final VoidCallback? onDoubleTap;
|
|
final VoidCallback? onDoubleTap;
|
|
final Color? menuItemColor;
|
|
final Color? menuItemColor;
|
|
final bool alignCaptionedTextToLeft;
|
|
final bool alignCaptionedTextToLeft;
|
|
- final double borderRadius;
|
|
|
|
|
|
+
|
|
|
|
+ // singleBorderRadius is applied to the border when it's a standalone menu item.
|
|
|
|
+ // Widget will apply singleBorderRadius if value of both isTopBorderRadiusRemoved
|
|
|
|
+ // and isBottomBorderRadiusRemoved is false. Otherwise, multipleBorderRadius will
|
|
|
|
+ // be applied
|
|
|
|
+ final double singleBorderRadius;
|
|
|
|
+ final double multipleBorderRadius;
|
|
final Color? pressedColor;
|
|
final Color? pressedColor;
|
|
final ExpandableController? expandableController;
|
|
final ExpandableController? expandableController;
|
|
final bool isBottomBorderRadiusRemoved;
|
|
final bool isBottomBorderRadiusRemoved;
|
|
@@ -54,7 +61,8 @@ class MenuItemWidget extends StatefulWidget {
|
|
this.onDoubleTap,
|
|
this.onDoubleTap,
|
|
this.menuItemColor,
|
|
this.menuItemColor,
|
|
this.alignCaptionedTextToLeft = false,
|
|
this.alignCaptionedTextToLeft = false,
|
|
- this.borderRadius = 8.0,
|
|
|
|
|
|
+ this.singleBorderRadius = 4.0,
|
|
|
|
+ this.multipleBorderRadius = 8.0,
|
|
this.pressedColor,
|
|
this.pressedColor,
|
|
this.expandableController,
|
|
this.expandableController,
|
|
this.isBottomBorderRadiusRemoved = false,
|
|
this.isBottomBorderRadiusRemoved = false,
|
|
@@ -69,10 +77,15 @@ class MenuItemWidget extends StatefulWidget {
|
|
|
|
|
|
class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|
class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|
Color? menuItemColor;
|
|
Color? menuItemColor;
|
|
|
|
+ late double borderRadius;
|
|
|
|
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
menuItemColor = widget.menuItemColor;
|
|
menuItemColor = widget.menuItemColor;
|
|
|
|
+ borderRadius =
|
|
|
|
+ (widget.isBottomBorderRadiusRemoved || widget.isTopBorderRadiusRemoved)
|
|
|
|
+ ? widget.multipleBorderRadius
|
|
|
|
+ : widget.singleBorderRadius;
|
|
if (widget.expandableController != null) {
|
|
if (widget.expandableController != null) {
|
|
widget.expandableController!.addListener(() {
|
|
widget.expandableController!.addListener(() {
|
|
setState(() {});
|
|
setState(() {});
|
|
@@ -111,15 +124,15 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
|
|
|
|
|
|
Widget menuItemWidget(BuildContext context) {
|
|
Widget menuItemWidget(BuildContext context) {
|
|
final enteColorScheme = Theme.of(context).colorScheme.enteTheme.colorScheme;
|
|
final enteColorScheme = Theme.of(context).colorScheme.enteTheme.colorScheme;
|
|
- final borderRadius = Radius.circular(widget.borderRadius);
|
|
|
|
|
|
+ final circularRadius = Radius.circular(borderRadius);
|
|
final isExpanded = widget.expandableController?.value;
|
|
final isExpanded = widget.expandableController?.value;
|
|
final bottomBorderRadius =
|
|
final bottomBorderRadius =
|
|
(isExpanded != null && isExpanded) || widget.isBottomBorderRadiusRemoved
|
|
(isExpanded != null && isExpanded) || widget.isBottomBorderRadiusRemoved
|
|
? const Radius.circular(0)
|
|
? const Radius.circular(0)
|
|
- : borderRadius;
|
|
|
|
|
|
+ : circularRadius;
|
|
final topBorderRadius = widget.isTopBorderRadiusRemoved
|
|
final topBorderRadius = widget.isTopBorderRadiusRemoved
|
|
? const Radius.circular(0)
|
|
? const Radius.circular(0)
|
|
- : borderRadius;
|
|
|
|
|
|
+ : circularRadius;
|
|
return AnimatedContainer(
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 20),
|
|
duration: const Duration(milliseconds: 20),
|
|
width: double.infinity,
|
|
width: double.infinity,
|