From 63036895183690b0ecd9a0f87d7130e3ee40a5d6 Mon Sep 17 00:00:00 2001 From: DeveloperAmrit Date: Sat, 17 Jan 2026 17:39:07 +0530 Subject: [PATCH] Minor UI imporvements in signup page --- lib/screens/auth/signup_screen.dart | 337 ++++++++++++++-------------- lib/widgets/custom_widgets.dart | 2 +- 2 files changed, 171 insertions(+), 168 deletions(-) diff --git a/lib/screens/auth/signup_screen.dart b/lib/screens/auth/signup_screen.dart index 1074b6d..d63f390 100644 --- a/lib/screens/auth/signup_screen.dart +++ b/lib/screens/auth/signup_screen.dart @@ -204,6 +204,171 @@ class _SignupScreenState extends State } } + Widget _buildJoinTeamForm() { + return Form( + key: _joinTeamFormKey, + child: Column( + children: [ + const SizedBox(height: 12), // Spacing for floating label + CustomTextField( + controller: _teamIdController, + label: 'Team ID', + icon: Icons.people_outline, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter team ID'; + } + if (value.length != 6) { + return 'Team ID must be 6 characters'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _nameController, + label: 'Full Name', + icon: Icons.person_outline, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your name'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _emailController, + label: 'Email', + icon: Icons.email_outlined, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your email'; + } + if (!value.contains('@')) { + return 'Please enter a valid email'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _passwordController, + label: 'Password', + icon: Icons.lock_outline, + isPassword: true, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your password'; + } + if (value.length < 6) { + return 'Password must be at least 6 characters'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _confirmPasswordController, + label: 'Confirm Password', + icon: Icons.lock_outline, + isPassword: true, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please confirm your password'; + } + if (value != _passwordController.text) { + return 'Passwords do not match'; + } + return null; + }, + ), + ], + ), + ); + } + + Widget _buildCreateTeamForm() { + return Form( + key: _createTeamFormKey, + child: Column( + children: [ + const SizedBox(height: 12), // Spacing for floating label + CustomTextField( + controller: _teamNameController, + label: 'Team Name', + icon: Icons.group, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter team name'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _nameController, + label: 'Admin Name', + icon: Icons.person_outline, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter admin name'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _emailController, + label: 'Admin Email', + icon: Icons.email_outlined, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter admin email'; + } + if (!value.contains('@')) { + return 'Please enter a valid email'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _passwordController, + label: 'Password', + icon: Icons.lock_outline, + isPassword: true, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your password'; + } + if (value.length < 6) { + return 'Password must be at least 6 characters'; + } + return null; + }, + ), + const SizedBox(height: 16), + CustomTextField( + controller: _confirmPasswordController, + label: 'Confirm Password', + icon: Icons.lock_outline, + isPassword: true, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please confirm your password'; + } + if (value != _passwordController.text) { + return 'Passwords do not match'; + } + return null; + }, + ), + ], + ), + ); + } + @override Widget build(BuildContext context) { return AuthScreenWrapper( @@ -220,175 +385,13 @@ class _SignupScreenState extends State unselectedLabelColor: Colors.grey, indicatorColor: Colors.green.shade400, indicatorSize: TabBarIndicatorSize.tab, + onTap: (index) => setState(() {}), ), const SizedBox(height: 24), - SizedBox( - height: 350, // Adjust height as needed - child: TabBarView( - controller: _tabController, - children: [ - // Join Team Tab - Form( - key: _joinTeamFormKey, - child: Column( - children: [ - CustomTextField( - controller: _teamIdController, - label: 'Team ID', - icon: Icons.people_outline, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter team ID'; - } - if (value.length != 6) { - return 'Team ID must be 6 characters'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _nameController, - label: 'Full Name', - icon: Icons.person_outline, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your name'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _emailController, - label: 'Email', - icon: Icons.email_outlined, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your email'; - } - if (!value.contains('@')) { - return 'Please enter a valid email'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _passwordController, - label: 'Password', - icon: Icons.lock_outline, - isPassword: true, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your password'; - } - if (value.length < 6) { - return 'Password must be at least 6 characters'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _confirmPasswordController, - label: 'Confirm Password', - icon: Icons.lock_outline, - isPassword: true, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please confirm your password'; - } - if (value != _passwordController.text) { - return 'Passwords do not match'; - } - return null; - }, - ), - ], - ), - ), - // Create Team Tab - Form( - key: _createTeamFormKey, - child: Column( - children: [ - CustomTextField( - controller: _teamNameController, - label: 'Team Name', - icon: Icons.group, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter team name'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _nameController, - label: 'Admin Name', - icon: Icons.person_outline, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter admin name'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _emailController, - label: 'Admin Email', - icon: Icons.email_outlined, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter admin email'; - } - if (!value.contains('@')) { - return 'Please enter a valid email'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _passwordController, - label: 'Password', - icon: Icons.lock_outline, - isPassword: true, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your password'; - } - if (value.length < 6) { - return 'Password must be at least 6 characters'; - } - return null; - }, - ), - const SizedBox(height: 16), - CustomTextField( - controller: _confirmPasswordController, - label: 'Confirm Password', - icon: Icons.lock_outline, - isPassword: true, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please confirm your password'; - } - if (value != _passwordController.text) { - return 'Passwords do not match'; - } - return null; - }, - ), - ], - ), - ), - ], - ), - ), + // Renders the specific form based on selection without fixed height constraints + _tabController.index == 0 + ? _buildJoinTeamForm() + : _buildCreateTeamForm(), const SizedBox(height: 24), CustomButton( text: _tabController.index == 0 ? 'Join Team' : 'Create Team', diff --git a/lib/widgets/custom_widgets.dart b/lib/widgets/custom_widgets.dart index a67185f..98e0da0 100644 --- a/lib/widgets/custom_widgets.dart +++ b/lib/widgets/custom_widgets.dart @@ -34,7 +34,7 @@ class CustomTextField extends StatelessWidget { @override Widget build(BuildContext context) { - final String effectiveHintText = label ?? hintText; + final String effectiveHintText = hintText; final IconData? effectivePrefixIcon = icon ?? prefixIcon; final bool effectiveObscureText = isPassword ?? obscureText;