diff --git a/b0esche_cloud/lib/widgets/organization_settings_dialog.dart b/b0esche_cloud/lib/widgets/organization_settings_dialog.dart index a5a0253..3036f28 100644 --- a/b0esche_cloud/lib/widgets/organization_settings_dialog.dart +++ b/b0esche_cloud/lib/widgets/organization_settings_dialog.dart @@ -37,6 +37,7 @@ class _OrganizationSettingsDialogState String? _error; List _userSuggestions = []; late final TextEditingController usernameController; + final GlobalKey textFieldKey = GlobalKey(); @override void initState() { @@ -417,8 +418,9 @@ class _OrganizationSettingsDialogState Widget _buildInviteTab() { String selectedRole = 'member'; - return Column( - children: [ + final List children = [ + Column( + children: [ // Pending invitations if (_invitations.isNotEmpty) ...[ Text( @@ -429,7 +431,8 @@ class _OrganizationSettingsDialogState ), ), const SizedBox(height: 8), - Expanded( + SizedBox( + height: 150, child: ListView.builder( itemCount: _invitations.length, itemBuilder: (context, index) { @@ -506,6 +509,7 @@ class _OrganizationSettingsDialogState ), const SizedBox(height: 16), TextField( + key: textFieldKey, controller: usernameController, cursorColor: AppTheme.accentColor, decoration: InputDecoration( @@ -544,28 +548,6 @@ class _OrganizationSettingsDialogState } }, ), - const SizedBox(height: 8), - if (_userSuggestions.isNotEmpty) ...[ - SizedBox( - height: 100, - child: ListView.builder( - itemCount: _userSuggestions.length, - itemBuilder: (context, index) { - final user = _userSuggestions[index]; - return ListTile( - title: Text( - user.displayName ?? user.username, - style: TextStyle(color: AppTheme.primaryText), - ), - onTap: () { - usernameController.text = user.username; - setState(() => _userSuggestions = []); - }, - ); - }, - ), - ), - ], DropdownButtonFormField( initialValue: selectedRole, items: ['admin', 'member'].map((role) { @@ -614,8 +596,94 @@ class _OrganizationSettingsDialogState child: const Text('Send Invitation'), ), ), - ], - ); + ] + (_userSuggestions.isNotEmpty + ? [ + Positioned( + top: 240, + left: 0, + right: 0, + child: Container( + height: 100, + decoration: BoxDecoration( + color: AppTheme.primaryBackground, + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: AppTheme.accentColor.withValues(alpha: 0.3), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.2), + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], + ), + child: ListView.builder( + itemCount: _userSuggestions.length, + itemBuilder: (context, index) { + final user = _userSuggestions[index]; + return ListTile( + title: Text( + user.displayName ?? user.username, + style: TextStyle(color: AppTheme.primaryText), + ), + onTap: () { + usernameController.text = user.username; + setState(() => _userSuggestions = []); + }, + ); + }, + ), + ), + ), + ] + : []), + ]; + + if (_userSuggestions.isNotEmpty) { + children.add( + Positioned( + top: 240, + left: 0, + right: 0, + child: Container( + height: 100, + decoration: BoxDecoration( + color: AppTheme.primaryBackground, + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: AppTheme.accentColor.withValues(alpha: 0.3), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.2), + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], + ), + child: ListView.builder( + itemCount: _userSuggestions.length, + itemBuilder: (context, index) { + final user = _userSuggestions[index]; + return ListTile( + title: Text( + user.displayName ?? user.username, + style: TextStyle(color: AppTheme.primaryText), + ), + onTap: () { + usernameController.text = user.username; + setState(() => _userSuggestions = []); + }, + ); + }, + ), + ), + ), + ); + } + + return Stack(children: children); } Widget _buildRequestsTab() {