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

A Flutter package for a custom dropdown widget.

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? selectedLandController;

  String? _validateTypeOfLand(String? value) {
    if (value == null || value.isEmpty) {
      return "This field is required";
    }
    return null;
  }

  final GlobalKey _farmNameFieldKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'My Dropdown Package Example',
      home: Scaffold(
        appBar: AppBar(title: const Text("Dropdown Package Example")),
        body: SingleChildScrollView(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            children: [
              AppDropdownField(
                titleTextStyle:
                const TextStyle(fontSize: 14, color: Colors.black),
                title: "Type Of Test",
                hintText: selectedLandController ?? "Select",
                items: ["Test1", "Test2"],
                selectedItem: selectedLandController,
                validator: _validateTypeOfLand,
                onChanged: (value) {
                  setState(() {
                    selectedLandController = value;
                  });
                },
                suffixIcon: const Icon(
                  Icons.keyboard_arrow_down_sharp,
                  color: Colors.black,
                  size: 24,
                ),
                borderColor: Colors.transparent,
                focusColor: Colors.transparent,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
130
points
7
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package for a custom dropdown widget.

Repository (GitHub)

License

MIT (license)

Dependencies

flutter

More

Packages that depend on my_dropdown_package