How To Add Shadow On Popup Menu Button Using Flutter App

admin_img Posted By Bajarangi soft , Posted On 30-10-2020

Displays a menu when pressed and calls onSelected when the menu is dismissed because an item was selected. The value passed to onSelected is the value of the selected menu item.

How To Add Shadow On Popup Menu Button Using Flutter App

Shadow On Popup Menu Button
Complete Code For Shadow On Popup Menu Button In Flutter
main.dart 

import 'package:flutter/material.dart';

void main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage()
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
        appBar: AppBar(
          backgroundColor: Colors.orange[700],
          title: Text("Shadow on PopupMenuButton"),
        ),
        body: Center(
          child: Container(
            alignment: Alignment.center,
            height: 40,
            width: 170,
            decoration: BoxDecoration(
              boxShadow: [
                BoxShadow(
                  blurRadius: 13.0,
                  color: Colors.white.withOpacity(.8),
                  offset: Offset(6.0, 7.0),
                ),
              ],
              //shape: BoxShape.rectangle,
              //border: Border.all(),
              color: Colors.white,
            ),
            child: PopupMenuButton(
              child: Text("Show Popup Menu"),
              itemBuilder: (context) => [
                PopupMenuItem(
                  child: Text("BajarangiSoft.com"),
                ),
                PopupMenuItem(
                  child: Text("Flutter"),
                ),
                PopupMenuItem(
                  child: Text("Google.com"),
                ),
              ],
            ),
          ),
        ));
  }
}

Related Post