Skip to content

Font extraction #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
56 changes: 24 additions & 32 deletions lib/presentation/auth/auth_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ class _AuthScreenState extends State<AuthScreen>
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
borderRadius: BorderRadius.circular(10.sp), // Responsive radius
),
contentPadding: EdgeInsets.all(25.0),
contentPadding: EdgeInsets.all(25.sp), // Responsive padding
title: Text(
'Confirm Exit',
style: TextStyle(fontSize: 25, color: kYellow),
style: TextStyle(fontSize: 25.sp, color: kYellow), // Responsive font
),
content: Text(
'Do you really want to exit?',
style: TextStyle(fontSize: 18, color: kBlack),
style: TextStyle(fontSize: 18.sp, color: kBlack), // Responsive font
),
actions: <Widget>[
HikeButton(
Expand All @@ -58,16 +58,10 @@ class _AuthScreenState extends State<AuthScreen>

PageController _pageController = PageController();

Color leftColor = Colors.white;
Color rightColor = Colors.black;

int _currentPage = 0;

@override
Widget build(BuildContext context) {
print(
"_currentPage: $_currentPage",
);
Size screensize = MediaQuery.of(context).size;

return PopScope(
Expand All @@ -94,12 +88,12 @@ class _AuthScreenState extends State<AuthScreen>
context.read<AuthCubit>().navigate();
} else if (state is AuthErrorState) {
utils.showSnackBar(state.error!, context,
duration: Duration(seconds: 2));
duration: const Duration(seconds: 2));
}
},
builder: (context, state) {
return state is AuthLoadingState
? LoadingScreen()
? const LoadingScreen()
: Scaffold(
resizeToAvoidBottomInset: true,
body: SafeArea(
Expand Down Expand Up @@ -205,21 +199,20 @@ class _AuthScreenState extends State<AuthScreen>
loginPasswordController.text.trim(),
);
} else {
utils.showSnackBar(
'Please complete all the fields', context);
utils.showSnackBar('Please complete all the fields', context);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.teal,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
borderRadius: BorderRadius.circular(14.sp), // Responsive radius
),
minimumSize: Size(screensize.width - 70, 45)),
child: const Text(
child: Text(
'Continue with Email',
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontSize: 16.sp, // Responsive font
),
),
);
Expand Down Expand Up @@ -280,7 +273,7 @@ class _AuthScreenState extends State<AuthScreen>
height: 1.2.h,
),
Container(
decoration: BoxDecoration(
decoration: const BoxDecoration( // Add const
borderRadius: BorderRadius.all(Radius.circular(5.0)),
),
child: BlocBuilder<AuthCubit, AuthState>(
Expand All @@ -293,21 +286,20 @@ class _AuthScreenState extends State<AuthScreen>
signUpEmailController.text.trim(),
signUpPasswordController.text.trim());
} else {
utils.showSnackBar(
'Please complete all the fields', context);
utils.showSnackBar('Please complete all the fields', context);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.teal,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
borderRadius: BorderRadius.circular(14.sp), // Responsive radius
),
minimumSize: Size(screensize.width - 70, 45)),
child: const Text(
child: Text(
'Continue with Email',
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontSize: 16.sp, // Responsive font
),
),
);
Expand All @@ -332,7 +324,7 @@ class _AuthScreenState extends State<AuthScreen>
: 'Already have an account?',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
fontSize: 14.sp, // Responsive font
),
),
TextButton(
Expand All @@ -350,9 +342,9 @@ class _AuthScreenState extends State<AuthScreen>
child: Text(
_currentPage == 0 ? 'Sign up' : 'Sign in',
style: TextStyle(
color: Color(0xFF6A1B9A),
color: const Color(0xFF6A1B9A),
fontWeight: FontWeight.bold,
fontSize: 14,
fontSize: 14.sp, // Responsive font
),
),
),
Expand All @@ -362,24 +354,24 @@ class _AuthScreenState extends State<AuthScreen>
SizedBox(
width: 200,
child: Row(
children: const [
Expanded(
children: [
const Expanded( // Add const
child: Divider(
color: Colors.grey,
thickness: 1,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
padding: EdgeInsets.symmetric(horizontal: 8.sp), // Responsive padding
child: Text(
'or',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
fontSize: 14.sp, // Responsive font
),
),
),
Expanded(
const Expanded( // Add const
child: Divider(
color: Colors.grey,
thickness: 1,
Expand Down Expand Up @@ -410,4 +402,4 @@ class _AuthScreenState extends State<AuthScreen>
],
);
}
}
}
18 changes: 10 additions & 8 deletions lib/presentation/auth/verification_cubit/verification_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@ import 'package:beacon/presentation/auth/verification_cubit/verification_state.d
import 'package:flutter_bloc/flutter_bloc.dart';

class VerificationCubit extends Cubit<OTPVerificationState> {
AuthUseCase _authUseCase;
final AuthUseCase _authUseCase;

VerificationCubit(this._authUseCase) : super(InitialOTPState());

emitVerificationSentstate(String otp) {
void emitVerificationSentState(String otp) {
emit(OTPSentState(otp: otp));
}

_clear() async {
Future<void> _clearStoredOTPData() async {
await sp.deleteData('time');
await sp.deleteData('otp');
}

Future<void> sendEmailVerification() async {
emit(OTPSendingState());

final dataState = await _authUseCase.sendVerificationCode();

if (dataState is DataSuccess && dataState.data != null) {
if (dataState is DataSuccess<String> && dataState.data != null) {
await sp.init();
await sp.saveData('time', DateTime.now().toIso8601String());
await sp.saveData('otp', dataState.data!);
emit(OTPSentState(otp: dataState.data));
emit(OTPSentState(otp: dataState.data!));
} else {
emit(OTPFailureState());
}
Expand All @@ -36,10 +38,10 @@ class VerificationCubit extends Cubit<OTPVerificationState> {

final dataState = await _authUseCase.completeVerification();

if (dataState is DataSuccess && dataState.data != null) {
_clear();
if (dataState is DataSuccess<bool> && dataState.data == true) {
await _clearStoredOTPData();
appRouter.replaceNamed('/home');
} else if (dataState is DataFailed) {
} else {
emit(OTPFailureState());
}
}
Expand Down
12 changes: 6 additions & 6 deletions lib/presentation/auth/verification_cubit/verification_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ part 'verification_state.freezed.dart';

@freezed
class OTPVerificationState with _$OTPVerificationState {
factory OTPVerificationState.initial() = InitialOTPState;
factory OTPVerificationState.otpSending() = OTPSendingState;
factory OTPVerificationState.otpSent({String? otp}) = OTPSentState;
factory OTPVerificationState.otpVerifying() = OTPVerifyingState;
factory OTPVerificationState.otpVerified() = OTPVerifiedState;
factory OTPVerificationState.failure() = OTPFailureState;
const factory OTPVerificationState.initial() = InitialOTPState;
const factory OTPVerificationState.otpSending() = OTPSendingState;
const factory OTPVerificationState.otpSent({String? otp}) = OTPSentState;
const factory OTPVerificationState.otpVerifying() = OTPVerifyingState;
const factory OTPVerificationState.otpVerified() = OTPVerifiedState;
const factory OTPVerificationState.failure({String? errorMessage}) = OTPFailureState;
}
Loading