unified_dropdown 0.0.2 copy "unified_dropdown: ^0.0.2" to clipboard
unified_dropdown: ^0.0.2 copied to clipboard

A flexible Flutter dropdown widget that supports both selection from a list and user-defined input with automatic code generation.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:unified_dropdown/model/select_option.dart';
import 'package:unified_dropdown/unified_dropdown.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: DropdownDemoPage(),
    );
  }
}

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

  @override
  State<DropdownDemoPage> createState() => _DropdownDemoPageState();
}

class _DropdownDemoPageState extends State<DropdownDemoPage> {
  SelectOptions? _selectedOption;

  final List<SelectOptions> _options = [
    SelectOptions(key: '1', value: 'Option-1', code: 'op-1'),
    SelectOptions(key: '2', value: 'Option-2', code: 'op-2'),
    SelectOptions(key: '3', value: 'Option-3', code: 'op-3'),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Unified Dropdown')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            UnifiedDropdown(
              isInputField: true,
              items: _options,
              initialValue: _selectedOption,
              fieldHintText: 'Enter hint text',
              isValidationRequired: true,
              requiredValidationText: 'Name required',
              onSelected: (option) {
                setState(() => _selectedOption = option);
              },
            ),
            const SizedBox(height: 12),
            Text('Selected: ${_selectedOption?.value ?? 'None'}'),
          ],
        ),
      ),
    );
  }
}
5
likes
140
points
99
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A flexible Flutter dropdown widget that supports both selection from a list and user-defined input with automatic code generation.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on unified_dropdown

Packages that implement unified_dropdown