mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-18 15:25:27 +02:00
fixed iOS dropdown settings
This commit is contained in:
parent
85dd8b46b1
commit
b7fa890448
@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
|
import 'package:quid_faciam_hodie/widgets/cupertino_dropdown.dart';
|
||||||
import 'package:settings_ui/settings_ui.dart';
|
import 'package:settings_ui/settings_ui.dart';
|
||||||
|
|
||||||
const IN_DURATION = Duration(seconds: 1);
|
const IN_DURATION = Duration(seconds: 1);
|
||||||
@ -140,6 +142,30 @@ class SettingsDropdownTile<T> extends AbstractSettingsTile {
|
|||||||
final Widget? leading;
|
final Widget? leading;
|
||||||
final Widget? description;
|
final Widget? description;
|
||||||
|
|
||||||
|
Widget getCupertinoPicker() {
|
||||||
|
final items = values
|
||||||
|
.map(
|
||||||
|
(value) => DropdownMenuItem<T>(
|
||||||
|
value: value,
|
||||||
|
child: Text(textMapping[value]!),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return CupertinoDropdownButton<T>(
|
||||||
|
itemExtent: 30,
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUpdate(value);
|
||||||
|
},
|
||||||
|
value: value,
|
||||||
|
items: items,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const SettingsDropdownTile({
|
const SettingsDropdownTile({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@ -154,15 +180,24 @@ class SettingsDropdownTile<T> extends AbstractSettingsTile {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DropdownTile(
|
if (isMaterial(context)) {
|
||||||
title: title,
|
return DropdownTile(
|
||||||
values: values,
|
title: title,
|
||||||
value: value,
|
values: values,
|
||||||
textMapping: textMapping,
|
value: value,
|
||||||
onUpdate: (value) => onUpdate(value as T),
|
textMapping: textMapping,
|
||||||
enabled: enabled,
|
onUpdate: (value) => onUpdate(value as T),
|
||||||
leading: leading,
|
enabled: enabled,
|
||||||
description: description,
|
leading: leading,
|
||||||
);
|
description: description,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SettingsTile(
|
||||||
|
leading: title,
|
||||||
|
title: getCupertinoPicker(),
|
||||||
|
enabled: enabled,
|
||||||
|
description: description,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user