import 'package:daciapackete/globals.dart' as globals;
import 'package:flutter/material.dart';
import 'package:daciapackete/ladeklimakonfig.dart';
const List<String> list = <String>['One', 'Two', 'Three', 'Four'];

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

  @override
  State<CardLadeprogrammDropdown> createState() => _CardLadeprogrammDropdownState();
}

class _CardLadeprogrammDropdownState extends State<CardLadeprogrammDropdown> {
  // String _dropdownValue = "1";
  // var _items = ["1", "2", "3", "4", "5"];

  String? ergebnis;

  @override
  Widget build(BuildContext context) {
    return Card(
      child: Padding(
        padding: const EdgeInsets.all(8),
        child: Column(
          children: <Widget>[

            DropdownButtonFormField<int>(

              decoration:InputDecoration(
                border: OutlineInputBorder(
                borderRadius: BorderRadius.circular(8)
            ),
            ),

            //  DropdownButton<String>(
              value: 2,
             // hint: const Text("Auswählen"),
              items: const [
                DropdownMenuItem(
                  value: 2,
                  child: Text("Kein Programm"),
                ),
                DropdownMenuItem(
                  value: 3,
                  child: Text("Beginnen am"),
                ),
                DropdownMenuItem(
                  value: 4,
                  child: Text("Fertig am"),
                ),
              ],
              onChanged: (v) {
                //Achtung, noch wird nicht gespeichert!!!!!
                switch (v){
                  case 2: globals.ladeKlimaKonfig.ladeProgrammArt = LadeProgrammArt.Kein_Programm;
                  case 3: globals.ladeKlimaKonfig.ladeProgrammArt = LadeProgrammArt.Beginnen_am;
                  case 4: globals.ladeKlimaKonfig.ladeProgrammArt = LadeProgrammArt.Beenden_am;
                  }

              },
            ),
              ],
   // ),
          //],
        ),
      ),
    );
  }
}
