popup_menu_title 1.1.0-nullsafety.1 copy "popup_menu_title: ^1.1.0-nullsafety.1" to clipboard
popup_menu_title: ^1.1.0-nullsafety.1 copied to clipboard

A PopupMenuEntry implementation to show a title.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:popup_menu_title/popup_menu_title.dart';

void main() => runApp(const App());

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  Widget _buildMenuButton() {
    return PopupMenuButton(
      icon: const Icon(Icons.menu),
      tooltip: 'Show menu',
      itemBuilder: (context) => [
        PopupMenuTitle(
          title: 'Popup menu title',
          overflow: TextOverflow.fade,
          // The text style below is the default style, but is specified
          // here as an example of how to do so.
          textStyle: TextStyle(
            fontWeight: FontWeight.w600,
            color: Theme.of(context).primaryColor,
          ),
        ),
        PopupMenuItem<Never>(child: const Text('Item 1')),
        PopupMenuItem<Never>(child: const Text('Item 2')),
        PopupMenuItem<Never>(child: const Text('Item 3')),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Popup menu title example'),
          actions: [_buildMenuButton()],
        ),
        body: Center(
          child: _buildMenuButton(),
        ),
      ),
    );
  }
}
2
likes
130
pub points
24%
popularity

Publisher

verified publisherhacker1024.tk

A PopupMenuEntry implementation to show a title.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on popup_menu_title