How To Add Line Divider In Popup Menu Items Using Flutter App

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

PopupMenuItem, for the kinds of items that this widget divides.showMenu, a method to dynamically show a popup menu at a given location.PopupMenuButton, an IconButton that automatically shows a menu when it is tapped.

How To Add Line Divider In Popup Menu Items Using Flutter App

Line Divider In Popup Menu Items 
Complete Code For Line Divider In Popup Menu Items  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 StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
        appBar: AppBar(
          backgroundColor: Colors.orange[900],
          title: Text("Line Divider In PopupMenuItems"),
        ),
        body: Center(
          child: PopupMenuButton(
              child: Text("Show Popup Menu",style: TextStyle(color: Colors.white),),
              itemBuilder: (context) {
                var list = List<PopupMenuEntry<Object>>();
                list.add(
                  PopupMenuItem(
                    child: Text("HTML"),
                  ),
                );
                list.add(
                  PopupMenuDivider(
                    height: 20,
                  ),
                );
                list.add(
                  PopupMenuItem(
                    child: Text("CSS"),
                  ),
                );
                list.add(
                  PopupMenuDivider(
                    height: 20,
                  ),
                );
                list.add(
                  PopupMenuItem(
                    child: Text("BOOTSTRAP"),
                  ),
                );
                return list;
              }),
        ));
  }
}

Related Post