From ff6203302fe41b9b4749a8ed984b6369e1f093fd Mon Sep 17 00:00:00 2001 From: isuri54 <154318794+isuri54@users.noreply.github.com> Date: Sun, 6 Apr 2025 13:05:46 +0530 Subject: [PATCH 1/3] feat(home): add signup FAB for guest users --- lib/presentation/home/home_screen.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/presentation/home/home_screen.dart b/lib/presentation/home/home_screen.dart index 300b54b..7fa1da8 100644 --- a/lib/presentation/home/home_screen.dart +++ b/lib/presentation/home/home_screen.dart @@ -135,6 +135,15 @@ class _HomeScreenState extends State { // size: Size(100.w, 100.h), // painter: DrawCircle(), // ), + if (localApi.userModel.isGuest == true) + Align( + alignment: Alignment(0.7, -0.8), + child: FloatingActionButton( + onPressed: () => appRouter.pushNamed('/auth'), + backgroundColor: kYellow, + child: Icon(Icons.login, color: Colors.white), + ), + ), Align( alignment: Alignment(0.9, -0.8), child: FloatingActionButton( From 54a610e96348642323b3c066a0c79611b87d02de Mon Sep 17 00:00:00 2001 From: isuri54 <154318794+isuri54@users.noreply.github.com> Date: Sun, 6 Apr 2025 23:18:24 +0530 Subject: [PATCH 2/3] enhance the responsiveness of create_join_dialog --- .../group/widgets/create_join_dialog.dart | 211 +++++++++--------- 1 file changed, 104 insertions(+), 107 deletions(-) diff --git a/lib/presentation/group/widgets/create_join_dialog.dart b/lib/presentation/group/widgets/create_join_dialog.dart index fe4baa8..21b107b 100644 --- a/lib/presentation/group/widgets/create_join_dialog.dart +++ b/lib/presentation/group/widgets/create_join_dialog.dart @@ -21,7 +21,6 @@ class CreateJoinGroupDialog { static Future createGroupDialog( BuildContext context, ) { - bool isSmallSized = 100.h < 800; return showDialog( context: context, builder: (context) => Dialog( @@ -31,61 +30,60 @@ class CreateJoinGroupDialog { child: SingleChildScrollView( child: Form( key: _groupKey, - child: Container( - height: isSmallSized ? 30.h : 25.h, - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 32, vertical: 16), - child: Column( - children: [ - Container( - height: isSmallSized ? 12.h : 10.h, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: TextFormField( - controller: _groupNameController, - style: TextStyle(fontSize: 22.0), - validator: (value) => - Validator.validateBeaconTitle(value!), - onChanged: (name) {}, - decoration: InputDecoration( - border: InputBorder.none, - hintText: 'Enter Title Here', - labelStyle: TextStyle( - fontSize: labelsize, color: kYellow), - hintStyle: TextStyle( - fontSize: hintsize, color: hintColor), - labelText: 'Title', - alignLabelWithHint: true, - floatingLabelBehavior: - FloatingLabelBehavior.always, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none), - ), - ), - color: kLightBlue, - ), - SizedBox( - height: 2.h, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 32, vertical: 16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.all(1.h), + decoration: BoxDecoration( + color: kLightBlue, + borderRadius: BorderRadius.circular(8) ), - Flexible( - flex: 2, - child: HikeButton( - text: 'Create Group', - textSize: 18.0, - textColor: Colors.white, - buttonColor: kYellow, - onTap: () { - if (!_groupKey.currentState!.validate()) return; - AutoRouter.of(context).maybePop(); - context - .read() - .createGroup(_groupNameController.text.trim()); - _groupNameController.clear(); - }), + child: TextFormField( + controller: _groupNameController, + style: TextStyle(fontSize: 22.0), + validator: (value) => + Validator.validateBeaconTitle(value!), + onChanged: (name) {}, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Enter Title Here', + labelStyle: TextStyle( + fontSize: labelsize, color: kYellow), + hintStyle: TextStyle( + fontSize: hintsize, color: hintColor), + labelText: 'Title', + alignLabelWithHint: true, + floatingLabelBehavior: + FloatingLabelBehavior.always, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none), ), - ], - ), + color: kLightBlue, + ), + SizedBox( + height: 2.h, + ), + Flexible( + flex: 2, + child: HikeButton( + text: 'Create Group', + textSize: 18.0, + textColor: Colors.white, + buttonColor: kYellow, + onTap: () { + if (!_groupKey.currentState!.validate()) return; + AutoRouter.of(context).maybePop(); + context + .read() + .createGroup(_groupNameController.text.trim()); + _groupNameController.clear(); + }), + ), + ], ), ), ), @@ -100,7 +98,7 @@ class CreateJoinGroupDialog { TextEditingController(); static Future joinGroupDialog(BuildContext context) { - bool isSmallSized = MediaQuery.of(context).size.height < 800; + return showDialog( context: context, builder: (context) => Dialog( @@ -109,61 +107,60 @@ class CreateJoinGroupDialog { ), child: Form( key: _joinGroupKey, - child: Container( - height: isSmallSized ? 30.h : 25.h, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16), - child: Column( - children: [ - Container( - height: isSmallSized ? 12.h : 10.h, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: TextFormField( - controller: _joinGroupController, - keyboardType: TextInputType.text, - textCapitalization: TextCapitalization.characters, - style: TextStyle(fontSize: 22.0), - validator: (value) => Validator.validatePasskey(value!), - onChanged: (value) { - _joinGroupController.text = value.toUpperCase(); - }, - decoration: InputDecoration( - alignLabelWithHint: true, - floatingLabelBehavior: FloatingLabelBehavior.always, - hintText: 'Enter Group Code Here', - hintStyle: - TextStyle(fontSize: hintsize, color: hintColor), - labelText: 'Code', - labelStyle: - TextStyle(fontSize: labelsize, color: kYellow), - border: InputBorder.none, - ), - ), - ), - color: kLightBlue, - ), - SizedBox( - height: 2.h, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.all(1.h), + decoration: BoxDecoration( + color: kLightBlue, + borderRadius: BorderRadius.circular(8) ), - Flexible( - child: HikeButton( - text: 'Join Group', - textSize: 18.0, - textColor: Colors.white, - buttonColor: kYellow, - onTap: () { - if (!_joinGroupKey.currentState!.validate()) return; - appRouter.maybePop(); - context - .read() - .joinGroup(_joinGroupController.text.trim()); - _joinGroupController.clear(); - }, + child: TextFormField( + controller: _joinGroupController, + keyboardType: TextInputType.text, + textCapitalization: TextCapitalization.characters, + style: TextStyle(fontSize: 22.0), + validator: (value) => Validator.validatePasskey(value!), + onChanged: (value) { + _joinGroupController.text = value.toUpperCase(); + }, + decoration: InputDecoration( + alignLabelWithHint: true, + floatingLabelBehavior: FloatingLabelBehavior.always, + hintText: 'Enter Group Code Here', + hintStyle: + TextStyle(fontSize: hintsize, color: hintColor), + labelText: 'Code', + labelStyle: + TextStyle(fontSize: labelsize, color: kYellow), + border: InputBorder.none, ), ), - ], - ), + color: kLightBlue, + ), + SizedBox( + height: 2.h, + ), + Flexible( + child: HikeButton( + text: 'Join Group', + textSize: 18.0, + textColor: Colors.white, + buttonColor: kYellow, + onTap: () { + if (!_joinGroupKey.currentState!.validate()) return; + appRouter.maybePop(); + context + .read() + .joinGroup(_joinGroupController.text.trim()); + _joinGroupController.clear(); + }, + ), + ), + ], ), ), ), From 91e5d0915d02c300a38a49354474bc45525e3f0d Mon Sep 17 00:00:00 2001 From: isuri54 <154318794+isuri54@users.noreply.github.com> Date: Mon, 7 Apr 2025 20:44:46 +0530 Subject: [PATCH 3/3] updated verification logic in verfication_screen.dart file --- lib/presentation/auth/verfication_screen.dart | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/presentation/auth/verfication_screen.dart b/lib/presentation/auth/verfication_screen.dart index 9b1753d..fd529a0 100644 --- a/lib/presentation/auth/verfication_screen.dart +++ b/lib/presentation/auth/verfication_screen.dart @@ -133,25 +133,32 @@ class _VerificationScreenState extends State { ), SizedBox(height: 6.h), // Confirm button - BlocBuilder( + BlocConsumer( + listener: (context, state) { + if (state is OTPVerifiedState) { + appRouter.replaceNamed('/home'); + } else if (state is OTPFailureState) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text( + 'Verification failed. Please try again.' + ) + ) + ); + } + }, builder: (context, state) { return Container( width: double.infinity, height: 6.h, child: ElevatedButton( onPressed: state is OTPSentState - ? () async { + ? () { if (_otpCode == state.otp) { - await locator() - .completeVerification(); - if (state is OTPVerifiedState) { - appRouter.push(VerificationScreenRoute()); - } + locator().completeVerification(); } else { ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text('Please enter valid OTP'), - ), + const SnackBar(content: Text('Please enter valid OTP')), ); } } @@ -162,7 +169,7 @@ class _VerificationScreenState extends State { borderRadius: BorderRadius.circular(14), ), ), - child: Text( + child: const Text( 'Confirm', style: TextStyle( color: Colors.black,