Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions lib/presentation/auth/verfication_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,32 @@ class _VerificationScreenState extends State<VerificationScreen> {
),
SizedBox(height: 6.h),
// Confirm button
BlocBuilder<VerificationCubit, OTPVerificationState>(
BlocConsumer<VerificationCubit, OTPVerificationState>(
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<VerificationCubit>()
.completeVerification();
if (state is OTPVerifiedState) {
appRouter.push(VerificationScreenRoute());
}
locator<VerificationCubit>().completeVerification();
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Please enter valid OTP'),
),
const SnackBar(content: Text('Please enter valid OTP')),
);
}
}
Expand All @@ -162,7 +169,7 @@ class _VerificationScreenState extends State<VerificationScreen> {
borderRadius: BorderRadius.circular(14),
),
),
child: Text(
child: const Text(
'Confirm',
style: TextStyle(
color: Colors.black,
Expand Down
211 changes: 104 additions & 107 deletions lib/presentation/group/widgets/create_join_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class CreateJoinGroupDialog {
static Future createGroupDialog(
BuildContext context,
) {
bool isSmallSized = 100.h < 800;
return showDialog(
context: context,
builder: (context) => Dialog(
Expand All @@ -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: <Widget>[
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: <Widget>[
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<HomeCubit>()
.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<HomeCubit>()
.createGroup(_groupNameController.text.trim());
_groupNameController.clear();
}),
),
],
),
),
),
Expand All @@ -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(
Expand All @@ -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<HomeCubit>()
.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<HomeCubit>()
.joinGroup(_joinGroupController.text.trim());
_joinGroupController.clear();
},
),
),
],
),
),
),
Expand Down
9 changes: 9 additions & 0 deletions lib/presentation/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ class _HomeScreenState extends State<HomeScreen> {
// 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(
Expand Down