Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

native_context_menu

native context menu for flutter apps

installation

flutter pub add native_context_menu

usage

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

void main() {
  runapp(app());
}

class app extends statefulwidget {
  const app({key? key}) : super(key: key);

  @override
  state<app> createstate() => _appstate();
}

class _appstate extends state<app> {
  string? action;

  @override
  widget build(buildcontext context) {
    return materialapp(
      home: scaffold(
        body: contextmenuregion(
          ondismissed: () => setstate(() => action = 'menu was dismissed'),
          onitemselected: (item) => setstate(() {
            action = '${item.title} was selected';
          }),
          menuitems: [
            menuitem(title: 'first item'),
            menuitem(title: 'second item'),
            menuitem(
              title: 'third item with submenu',
              items: [
                menuitem(title: 'first subitem'),
                menuitem(title: 'second subitem'),
                menuitem(title: 'third subitem'),
              ],
            ),
            menuitem(title: 'fourth item'),
          ],
          child: card(
            child: center(
              child: text(action ?? 'right click me'),
            ),
          ),
        ),
      ),
    );
  }
}

platform support

platform supported
macos
linux
windows

license

mit


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.