content: import 'package:flutter/material.dart';
  
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Dropdown TextField Demo',
        home: Homepage(),
      );
    }
  }
  
  class Homepage extends StatefulWidget {
    const Homepage({ Key? key }) : super(key: key);
  
    @override
    _HomepageState createState() => _HomepageState();
  }
  
  class _HomepageState extends State<Homepage> {
    final GlobalKey<FormState> dropkey = GlobalKey<FormState>(); //Can give anyname to form key
  
    List<String> demofield = [
      "Option 1",
      "Option 2",
      "Option 3", //and so on
    ];
  
    String? dropdownValue;
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(  
          title: Text("Dropdown Field Demo"),
          backgroundColor: Colors.white,
          centerTitle: true,
        ),
        body: Container(
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height,
          color: Colors.redAccent,
          child: Form(
            key: dropkey,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(
                  "Select an option from Dropdown below!",
                  style: TextStyle(fontSize: 18),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  padding: EdgeInsets.all(10),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(MediaQuery.of(context).size.width/40),
                    color: Colors.redAccent, 
                  ),
                  child: DropdownButtonFormField(
                    value: dropdownValue,
                    onChanged: (value) {
                      setState(() {
                        dropdownValue = value as String?;
                      });
                    },
                    items: demofield.map<DropdownMenuItem<String>>((String value) {
                            return DropdownMenuItem<String>(
                              value: value,
                              child: Text(value),
                            );
                          }).toList(),
                          decoration: InputDecoration(  
                            hintText: "Select 1 Option",
                            hintStyle: TextStyle(color: Colors.black),
                            
                          ),
                  ),
                ),
              ],
            )),
          
        ),
      );
    }
  }
  