import 'package:flutter/material.dart'; import 'package:manager_api/api.dart'; import 'package:provider/provider.dart'; import 'package:tablet_app/app_context.dart'; import 'package:tablet_app/constants.dart'; class DropDownConfig extends StatefulWidget { final List configurations; final ValueChanged? onChange; const DropDownConfig({ Key? key, required this.configurations, this.onChange, }) : super(key: key); @override _DropDownConfigState createState() => _DropDownConfigState(); } class _DropDownConfigState extends State { ConfigurationDTO? selectedConfigurationDTO; @override Widget build(BuildContext context) { /*final appContext = Provider.of(context); Size size = MediaQuery.of(context).size;*/ return DropdownButton( value: selectedConfigurationDTO, icon: const Icon(Icons.arrow_downward), iconSize: 24, elevation: 16, style: const TextStyle(color: kMainGrey), underline: Container( height: 2, color: kTestSecondColor, ), onChanged: (ConfigurationDTO? newValue) { setState(() { selectedConfigurationDTO = newValue!; widget.onChange!(selectedConfigurationDTO!); }); }, items: widget.configurations.map>((ConfigurationDTO value) { return DropdownMenuItem( value: value, child: Text(value.label!, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400)), ); }).toList(), ); } }