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