import 'package:flutter/material.dart'; // ignore: must_be_immutable class TVShowDetailsSettingsBoxResolution extends StatefulWidget { TVShowDetailsSettingsBoxResolution({ super.key, required this.resolution, required this.resolutionChanged, }); String resolution; final Function(String resolution) resolutionChanged; @override State createState() => _TVShowDetailsSettingsBoxResolutionState(); } class _TVShowDetailsSettingsBoxResolutionState extends State { var resolutions = [ '', '360p', '480i', '480p', '576i', '576p', '720i', '720p', '1080i', '1080p', '1440i', '1440p', '2160p', ]; var _curResolution = ''; @override void initState() { _curResolution = widget.resolution; super.initState(); } @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only( left: 5.0, right: 5.0, top: 5.0, bottom: 5.0, ), child: Column( children: [ const Text( 'Resolution', style: TextStyle( fontWeight: FontWeight.bold, ), ), DropdownButtonFormField( decoration: const InputDecoration( border: OutlineInputBorder(), labelText: 'Resolution', ), dropdownColor: const Color.fromARGB(255, 127, 127, 127), value: _curResolution, items: resolutions.map((String res) { return DropdownMenuItem(value: res, child: Text(res)); }).toList(), onChanged: (String? newValue) { setState(() { _curResolution = newValue!; widget.resolutionChanged(_curResolution); }); }, ), ], ), ); } }