Files
rezepte/lib/widgets/difficulty_dropdown.dart
2023-10-02 19:57:43 +02:00

22 lines
644 B
Dart

import 'package:flutter/material.dart';
import 'package:rezepte/models/recipe.dart';
class DifficultyDropdown extends StatelessWidget {
const DifficultyDropdown({super.key});
@override
Widget build(BuildContext context) {
List<DropdownMenuEntry> dropdownMenuEntryList = List.generate(
Difficulty.values.length,
(index) => _toDropdownMenuEntry(
index, Difficulty.values.elementAt(index).name));
return DropdownMenu(
dropdownMenuEntries: dropdownMenuEntryList,
);
}
DropdownMenuEntry _toDropdownMenuEntry(int index, String text) =>
DropdownMenuEntry(value: index, label: text);
}