mirror of
https://github.com/immich-app/immich.git
synced 2026-03-26 20:00:44 +03:00
fix(mobile): option padding on search dropdowns (#27154)
* fix(mobile): option padding on search dropdowns * chore: prevent height fill up screen and block the bottom menu entry --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -16,9 +16,15 @@ class SearchDropdown<T> extends StatelessWidget {
|
|||||||
final Widget? label;
|
final Widget? label;
|
||||||
final Widget? leadingIcon;
|
final Widget? leadingIcon;
|
||||||
|
|
||||||
|
static const WidgetStatePropertyAll<EdgeInsetsGeometry> _optionPadding = WidgetStatePropertyAll<EdgeInsetsGeometry>(
|
||||||
|
EdgeInsetsDirectional.fromSTEB(16, 0, 16, 0),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final menuStyle = const MenuStyle(
|
final mediaQuery = MediaQuery.of(context);
|
||||||
|
final maxMenuHeight = mediaQuery.size.height * 0.5 - mediaQuery.viewPadding.bottom;
|
||||||
|
const menuStyle = MenuStyle(
|
||||||
shape: WidgetStatePropertyAll<OutlinedBorder>(
|
shape: WidgetStatePropertyAll<OutlinedBorder>(
|
||||||
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15))),
|
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15))),
|
||||||
),
|
),
|
||||||
@@ -26,11 +32,26 @@ class SearchDropdown<T> extends StatelessWidget {
|
|||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
|
final styledEntries = dropdownMenuEntries
|
||||||
|
.map(
|
||||||
|
(entry) => DropdownMenuEntry<T>(
|
||||||
|
value: entry.value,
|
||||||
|
label: entry.label,
|
||||||
|
labelWidget: entry.labelWidget,
|
||||||
|
enabled: entry.enabled,
|
||||||
|
leadingIcon: entry.leadingIcon,
|
||||||
|
trailingIcon: entry.trailingIcon,
|
||||||
|
style: (entry.style ?? const ButtonStyle()).copyWith(padding: _optionPadding),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(growable: false);
|
||||||
|
|
||||||
return DropdownMenu(
|
return DropdownMenu(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
leadingIcon: leadingIcon,
|
leadingIcon: leadingIcon,
|
||||||
width: constraints.maxWidth,
|
width: constraints.maxWidth,
|
||||||
dropdownMenuEntries: dropdownMenuEntries,
|
menuHeight: maxMenuHeight,
|
||||||
|
dropdownMenuEntries: styledEntries,
|
||||||
label: label,
|
label: label,
|
||||||
menuStyle: menuStyle,
|
menuStyle: menuStyle,
|
||||||
trailingIcon: const Icon(Icons.arrow_drop_down_rounded),
|
trailingIcon: const Icon(Icons.arrow_drop_down_rounded),
|
||||||
|
|||||||
Reference in New Issue
Block a user