Reputation: 371
I want to control the thickness of CupertinoContextMenu's divider's, I didn't see this property in Theme class and also I was not able to spot customization on widgets properties, how would that be possible?
My code :
return CupertinoContextMenu.builder(
builder: (context, animation) {
return SizedBox(
width: MediaQuery.of(context).size.width /
(mainAxisCount - animation.value),
height: MediaQuery.of(context).size.width /
(mainAxisCount - animation.value),
child: cardBox(context,
ratioFactor: animation.value < sizeLimit
? null
: (size * animation.value),
shatter: shatter,
actions: actions,
animated: animation.value != 0.0),
);
},
actions: contextMenuActions,
);
Current result:
It's expected to be able to change the thickness a little bit.
Expected UI
Upvotes: 0
Views: 109
Reputation: 2007
You cannot directly change the divider's thickness. But there is a work around Refering :https://github.com/flutter/flutter/blob/54e66469a9/packages/flutter/lib/src/cupertino/context_menu.dart#L155
You can recreate this into a context_menu_extended.dart and simply in the _ContextMenuSheet widget.
Change the width of Decorated Box as bellow.
DecoratedBox(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: CupertinoDynamicColor.resolve(
_borderColor,
context,
),
width: 0.4, // Change the width here.
),
),
),
position: DecorationPosition.foreground,
child: action,
),
Upvotes: 1