drop_down_list_menu 0.0.8 copy "drop_down_list_menu: ^0.0.8" to clipboard
drop_down_list_menu: ^0.0.8 copied to clipboard

The "Drop-Down Menu" package is a Flutter package that provides a user-friendly interface for selecting options from a drop-down menu.

example/main.dart

import 'package:drop_down_list_menu/drop_down.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

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

class DropDown extends StatefulWidget {
  const DropDown({super.key});

  @override
  _DropDownState createState() => _DropDownState();
}

class _DropDownState extends State<DropDown> {
  final List<String> _list = ['One', 'Two', 'Three', 'Four', 'Five'];
  String _selectedItem = 'One';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Drop Down Menu'),
        ),
        body: Center(
          child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                SizedBox(
                  width: MediaQuery.of(context).size.width * 0.8,
                  child: SizedBox(
                    height: MediaQuery.of(context).size.height * 0.6,
                    child: DropDownMenu(
                      title: 'Select an item',
                      enabled: true,
                      values: _list,
                      value: _selectedItem,
                      onChanged: (value) {
                        setState(() {
                          _selectedItem = value!;
                        });
                      },
                    ),
                  ),
                ),
              ]),
        ));
  }
}
2
likes
130
pub points
56%
popularity

Publisher

unverified uploader

The "Drop-Down Menu" package is a Flutter package that provides a user-friendly interface for selecting options from a drop-down menu.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on drop_down_list_menu