GILO
GILO

Reputation: 2613

Flutter PopupMenuButton Remove splash and highlight

I was wondering if there is a way in which I can remove splash and highlight from PopupMenuButton a bit like with other buttons.

new PopupMenuButton({
  ...
  splashColor: Colors.transparent,  
  highlightColor: Colors.transparent, // makes highlight invisible too
})

Upvotes: 1

Views: 4145

Answers (3)

Muhammad Rashad
Muhammad Rashad

Reputation: 1

You can use these properties should be fine:

PopupMenuButton(
        padding: EdgeInsets.zero,
        style: ButtonStyle(
          tapTargetSize: MaterialTapTargetSize.shrinkWrap,
          padding: WidgetStatePropertyAll(EdgeInsets.zero),
          visualDensity: VisualDensity.compact,
        ),

Upvotes: 0

lsaudon
lsaudon

Reputation: 1458

Put splashFactory with NoSplash.splashFactory

Theme(
  data: Theme.of(context).copyWith(
    splashFactory: NoSplash.splashFactory,
  ),
  child: PopupMenuButton(...),
)

Upvotes: 1

Kahou
Kahou

Reputation: 3488

Theme Applies a theme to descendant widgets.

Theme(
  data: Theme.of(context).copyWith(
    highlightColor: Colors.transparent,
    splashColor: Colors.transparent,
  ),
  child: PopupMenuButton(...),
)

Upvotes: 10

Related Questions