hover_menu 1.0.1+2 copy "hover_menu: ^1.0.1+2" to clipboard
hover_menu: ^1.0.1+2 copied to clipboard

A Flutter package for creating a hover menu for desktop and web applications, providing a common web menu experience.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Hover Menu',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Hover Menu'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(widget.title),
      ),
      body: Column(
        children: [
          Container(
            width: double.infinity,
            decoration: const BoxDecoration(
                border:
                    Border(bottom: BorderSide(color: Colors.black, width: 1))),
            height: 50,
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                HoverMenu(
                  title:
                      const Text('Main', style: TextStyle(color: Colors.black)),
                  items: const [
                    ListTile(
                      mouseCursor: SystemMouseCursors.click,
                      title: Text(
                        'Sub',
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                    ListTile(
                      mouseCursor: SystemMouseCursors.click,
                      title: Text(
                        'Sub 2',
                        style: TextStyle(color: Colors.white),
                      ),
                    )
                  ],
                ),
                HoverMenu(
                  title: const Text('Menu 2',
                      style: TextStyle(color: Colors.black)),
                  items: const [
                    ListTile(
                      mouseCursor: SystemMouseCursors.click,
                      title: Text(
                        'Sub 2',
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                    ListTile(
                      mouseCursor: SystemMouseCursors.click,
                      title: Text(
                        'Sub 3',
                        style: TextStyle(color: Colors.white),
                      ),
                    )
                  ],
                ),
                const VerticalDivider(
                  width: 2,
                  thickness: 1,
                  color: Colors.white,
                ),
              ],
            ),
          ),
          const Expanded(
              child: Center(
            child: Text('Hover Menu'),
          ))
        ],
      ),
    );
  }
}
19
likes
0
pub points
87%
popularity

Publisher

verified publishertrinavo.com

A Flutter package for creating a hover menu for desktop and web applications, providing a common web menu experience.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on hover_menu