smartx_dropdown_plus 1.0.0 copy "smartx_dropdown_plus: ^1.0.0" to clipboard
smartx_dropdown_plus: ^1.0.0 copied to clipboard

A fully customizable dropdown widget for Flutter with overlay-based dropdown list, multiple background color modes, labels, hints, icons, styles, and scrollable list.

example/lib/main.dart

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

/// Entry point — wraps the demo in MaterialApp so Directionality, Theme, etc. exist.
void main() {
  runApp(const SmartDropdownApp());
}

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

  @override
  Widget build(BuildContext context) {
    // MaterialApp provides Directionality, Theme, Navigator, etc.
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'smartx_dropdown_plus Example',
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
      ),
      home: const SmartDropdownExample(), // your demo screen
    );
  }
}

/// The demo screen that uses AppDropdownLabeled.
class SmartDropdownExample extends StatefulWidget {
  const SmartDropdownExample({super.key});

  @override
  State<SmartDropdownExample> createState() => _SmartDropdownExampleState();
}

class _SmartDropdownExampleState extends State<SmartDropdownExample> {
  String? selectedCourse;
  String? selectedSubject;

  final courses = <String>[
    'Mathematics',
    'Science',
    'English',
    'History',
    'Arts',
    'Physics',
    'Chemistry',
  ];

  @override
  Widget build(BuildContext context) {
    // Scaffold needs Directionality (provided by MaterialApp above)
    return Scaffold(
      backgroundColor: Colors.grey.shade100,
      appBar: AppBar(
        title: const Text('Smart Dropdown Plus'),
      ),
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const Text(
                '1️⃣ With Label + Custom Label Style',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
              ),
              const SizedBox(height: 8),

              // Example: labeled dropdown with custom label style & icons
              AppDropdownLabeled<String>(
                labelText: 'Course:',
                labelStyle: const TextStyle(
                  color: Colors.deepPurple,
                  fontSize: 16,
                  fontWeight: FontWeight.bold,
                ),
                valueStyle: const TextStyle(
                  color: Colors.black,
                  fontSize: 16,
                ),
                leadingIcon:
                    const Icon(Icons.book_outlined, color: Colors.deepPurple),
                iconColor: Colors.deepPurple,
                items: courses,
                selectedItem: selectedCourse,
                getTitle: (v) => v,
                getValue: (v) => v,
                onSelect: (v) => setState(() => selectedCourse = v),
                backgroundColors: [
                  Colors.deepPurple.shade50,
                  Colors.pink.shade50,
                  Colors.orange.shade50,
                ],
              ),

              const SizedBox(height: 30),
              const Text(
                '2️⃣ Hint Mode (No Label)',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
              ),
              const SizedBox(height: 8),

              // Example: hint-only dropdown (no label)
              AppDropdownLabeled<String>(
                hintText: 'Select your favorite subject',
                hintStyle: const TextStyle(
                  fontStyle: FontStyle.italic,
                  color: Colors.grey,
                ),
                selectedItem: selectedSubject,
                items: courses,
                getTitle: (v) => v,
                getValue: (v) => v,
                onSelect: (v) => setState(() => selectedSubject = v),
                backgroundColors: Colors.teal.shade50,
                iconColor: Colors.teal,
                containerColor: Colors.white,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
150
points
3
downloads

Publisher

verified publisherronak-vasoliya.devservers.site

Weekly Downloads

A fully customizable dropdown widget for Flutter with overlay-based dropdown list, multiple background color modes, labels, hints, icons, styles, and scrollable list.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on smartx_dropdown_plus