Refactor invite tab to improve layout and remove unused variables
This commit is contained in:
@@ -37,8 +37,6 @@ class _OrganizationSettingsDialogState
|
||||
String? _error;
|
||||
List<User> _userSuggestions = [];
|
||||
late final TextEditingController usernameController;
|
||||
final GlobalKey textFieldKey = GlobalKey();
|
||||
final LayerLink link = LayerLink();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -419,10 +417,8 @@ class _OrganizationSettingsDialogState
|
||||
Widget _buildInviteTab() {
|
||||
String selectedRole = 'member';
|
||||
|
||||
final List<Widget> children = [
|
||||
Column(
|
||||
children:
|
||||
[
|
||||
return Column(
|
||||
children: [
|
||||
// Pending invitations
|
||||
if (_invitations.isNotEmpty) ...[
|
||||
Text(
|
||||
@@ -510,10 +506,7 @@ class _OrganizationSettingsDialogState
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
CompositedTransformTarget(
|
||||
link: link,
|
||||
child: TextField(
|
||||
key: textFieldKey,
|
||||
TextField(
|
||||
controller: usernameController,
|
||||
cursorColor: AppTheme.accentColor,
|
||||
decoration: InputDecoration(
|
||||
@@ -552,7 +545,28 @@ 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<String>(
|
||||
initialValue: selectedRole,
|
||||
items: ['admin', 'member'].map((role) {
|
||||
@@ -601,96 +615,8 @@ 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(
|
||||
CompositedTransformFollower(
|
||||
link: link,
|
||||
offset: const Offset(0, 48),
|
||||
child: Container(
|
||||
width: 300,
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user