extract SettingsDropdownTile for settings dropdowns
This commit is contained in:
@@ -5,6 +5,7 @@ import '../../../../routing/app_routes.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../view/pages/timetable/data/timetable_name_mode.dart';
|
||||
import '../widgets/settings_checkbox_tile.dart';
|
||||
import '../widgets/settings_dropdown_tile.dart';
|
||||
|
||||
class TimetableSection extends StatelessWidget {
|
||||
const TimetableSection({super.key});
|
||||
@@ -15,33 +16,15 @@ class TimetableSection extends StatelessWidget {
|
||||
final timetableSettings = settings.val().timetableSettings;
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.abc_outlined),
|
||||
title: const Text('Fachbezeichnung'),
|
||||
trailing: DropdownButton<TimetableNameMode>(
|
||||
value: timetableSettings.timetableNameMode,
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
items: TimetableNameMode.values
|
||||
.map(
|
||||
(e) => DropdownMenuItem(
|
||||
value: e,
|
||||
enabled: e != timetableSettings.timetableNameMode,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(TimetableNameModes.getDisplayOptions(e).icon),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
TimetableNameModes.getDisplayOptions(e).displayName,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) =>
|
||||
settings.val(write: true).timetableSettings.timetableNameMode =
|
||||
value!,
|
||||
),
|
||||
SettingsDropdownTile<TimetableNameMode>(
|
||||
icon: Icons.abc_outlined,
|
||||
title: 'Fachbezeichnung',
|
||||
value: timetableSettings.timetableNameMode,
|
||||
options: TimetableNameMode.values,
|
||||
optionIcon: (e) => TimetableNameModes.getDisplayOptions(e).icon,
|
||||
optionLabel: (e) => TimetableNameModes.getDisplayOptions(e).displayName,
|
||||
onChanged: (e) =>
|
||||
settings.val(write: true).timetableSettings.timetableNameMode = e,
|
||||
),
|
||||
SettingsCheckboxTile(
|
||||
icon: Icons.calendar_view_day_outlined,
|
||||
|
||||
Reference in New Issue
Block a user