31 lines
971 B
Dart
31 lines
971 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/input_provider.dart';
|
|
import '../providers/settings_provider.dart';
|
|
|
|
class DropDown extends StatelessWidget {
|
|
const DropDown({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var inputModel = context.watch<InputProvider>();
|
|
var settings = context.watch<SettingsProvider>();
|
|
return DropdownButtonFormField<String>(
|
|
value: settings.settings?.relapseCategories?[0] ?? '',
|
|
icon: const Icon(Icons.arrow_downward),
|
|
elevation: 16,
|
|
style: const TextStyle(color: Colors.deepPurple),
|
|
onChanged: (String? value) {
|
|
inputModel.relapseCategory = value ?? '';
|
|
},
|
|
items: settings.settings?.relapseCategories
|
|
?.map<DropdownMenuItem<String>>((String value) {
|
|
return DropdownMenuItem<String>(
|
|
value: value,
|
|
child: Text(value),
|
|
);
|
|
}).toList(),
|
|
);
|
|
}
|
|
}
|