From deb8b50bb91b9efd38e09e89dcd48085856f6308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sat, 24 Jan 2026 05:06:30 +0100 Subject: [PATCH] Fix suggestions positioning using CompositedTransformFollower to properly position dropdown below TextField --- .../widgets/organization_settings_dialog.dart | 82 ++++++++++--------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/b0esche_cloud/lib/widgets/organization_settings_dialog.dart b/b0esche_cloud/lib/widgets/organization_settings_dialog.dart index d326920..2f2883e 100644 --- a/b0esche_cloud/lib/widgets/organization_settings_dialog.dart +++ b/b0esche_cloud/lib/widgets/organization_settings_dialog.dart @@ -38,6 +38,7 @@ class _OrganizationSettingsDialogState List _userSuggestions = []; late final TextEditingController usernameController; final GlobalKey textFieldKey = GlobalKey(); + final LayerLink link = LayerLink(); @override void initState() { @@ -509,45 +510,48 @@ class _OrganizationSettingsDialogState ), ), const SizedBox(height: 16), - TextField( - key: textFieldKey, - controller: usernameController, - cursorColor: AppTheme.accentColor, - decoration: InputDecoration( - hintText: 'Username', - hintStyle: TextStyle(color: AppTheme.secondaryText), - contentPadding: const EdgeInsets.all(12), - border: OutlineInputBorder( - borderSide: BorderSide( - color: AppTheme.accentColor.withValues(alpha: 0.3), + CompositedTransformTarget( + link: link, + child: TextField( + key: textFieldKey, + controller: usernameController, + cursorColor: AppTheme.accentColor, + decoration: InputDecoration( + hintText: 'Username', + hintStyle: TextStyle(color: AppTheme.secondaryText), + contentPadding: const EdgeInsets.all(12), + border: OutlineInputBorder( + borderSide: BorderSide( + color: AppTheme.accentColor.withValues(alpha: 0.3), + ), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: AppTheme.accentColor.withValues(alpha: 0.3), + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: AppTheme.accentColor), ), ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: AppTheme.accentColor.withValues(alpha: 0.3), - ), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: AppTheme.accentColor), - ), - ), - style: TextStyle(color: AppTheme.primaryText), - onChanged: (value) async { - if (value.length > 2) { - try { - _userSuggestions = await widget.orgApi.searchUsers( - widget.organization.id, - value, - ); - } catch (e) { + style: TextStyle(color: AppTheme.primaryText), + onChanged: (value) async { + if (value.length > 2) { + try { + _userSuggestions = await widget.orgApi.searchUsers( + widget.organization.id, + value, + ); + } catch (e) { + _userSuggestions = []; + } + setState(() {}); + } else { _userSuggestions = []; + setState(() {}); } - setState(() {}); - } else { - _userSuggestions = []; - setState(() {}); - } - }, + }, + ), ), DropdownButtonFormField( initialValue: selectedRole, @@ -645,11 +649,11 @@ class _OrganizationSettingsDialogState if (_userSuggestions.isNotEmpty) { children.add( - Positioned( - top: 240, - left: 0, - right: 0, + CompositedTransformFollower( + link: link, + offset: const Offset(0, 48), child: Container( + width: 300, height: 100, decoration: BoxDecoration( color: AppTheme.primaryBackground,