mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Merged with dev
This commit is contained in:
@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||||
import 'package:syncrow_web/services/locator.dart';
|
import 'package:syncrow_web/services/locator.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -33,14 +34,23 @@ class MyApp extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: ColorScheme.fromSeed(
|
textTheme: const TextTheme(
|
||||||
seedColor: Colors.deepPurple), // Set up color scheme
|
bodySmall: TextStyle(
|
||||||
|
fontSize: 13, color: ColorsManager.whiteColors, fontWeight: FontWeight.bold),
|
||||||
|
bodyMedium: TextStyle(color: Colors.black87, fontSize: 14),
|
||||||
|
bodyLarge: TextStyle(fontSize: 16, color: Colors.white),
|
||||||
|
headlineSmall: TextStyle(color: Colors.black87, fontSize: 18),
|
||||||
|
headlineMedium: TextStyle(color: Colors.black87, fontSize: 20),
|
||||||
|
headlineLarge: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), // Set up color scheme
|
||||||
useMaterial3: true, // Enable Material 3
|
useMaterial3: true, // Enable Material 3
|
||||||
),
|
),
|
||||||
home: isLoggedIn == 'Success'?
|
home: isLoggedIn == 'Success' ? const HomePage() : const LoginPage(),
|
||||||
const HomePage()
|
|
||||||
:
|
|
||||||
const LoginPage(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:syncrow_web/pages/auth/bloc/auth_event.dart';
|
import 'package:syncrow_web/pages/auth/bloc/auth_event.dart';
|
||||||
import 'package:syncrow_web/pages/auth/bloc/auth_state.dart';
|
import 'package:syncrow_web/pages/auth/bloc/auth_state.dart';
|
||||||
import 'package:syncrow_web/pages/auth/model/login_with_email_model.dart';
|
import 'package:syncrow_web/pages/auth/model/login_with_email_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/auth/model/region_model.dart';
|
||||||
import 'package:syncrow_web/pages/auth/model/token.dart';
|
import 'package:syncrow_web/pages/auth/model/token.dart';
|
||||||
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
||||||
import 'package:syncrow_web/services/auth_api.dart';
|
import 'package:syncrow_web/services/auth_api.dart';
|
||||||
@ -22,6 +22,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
on<StopTimerEvent>(_onStopTimer);
|
on<StopTimerEvent>(_onStopTimer);
|
||||||
on<UpdateTimerEvent>(_onUpdateTimer);
|
on<UpdateTimerEvent>(_onUpdateTimer);
|
||||||
on<PasswordVisibleEvent>(_passwordVisible);
|
on<PasswordVisibleEvent>(_passwordVisible);
|
||||||
|
on<RegionInitialEvent>(_fetchRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////// forget password //////////////////////////////////
|
////////////////////////////// forget password //////////////////////////////////
|
||||||
@ -31,26 +32,22 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
final forgetFormKey = GlobalKey<FormState>();
|
final forgetFormKey = GlobalKey<FormState>();
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
int _remainingTime = 0;
|
int _remainingTime = 0;
|
||||||
|
List<RegionModel>? regionList;
|
||||||
|
|
||||||
Future<void> _onStartTimer(StartTimerEvent event, Emitter<AuthState> emit) async {
|
Future<void> _onStartTimer(StartTimerEvent event, Emitter<AuthState> emit) async {
|
||||||
if (_validateInputs(emit)) return;
|
if (_validateInputs(emit)) return;
|
||||||
print("StartTimerEvent received");
|
|
||||||
if (_timer != null && _timer!.isActive) {
|
if (_timer != null && _timer!.isActive) {
|
||||||
print("Timer is already active");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_remainingTime = 60;
|
_remainingTime = 60;
|
||||||
add(UpdateTimerEvent(
|
add(UpdateTimerEvent(
|
||||||
remainingTime: _remainingTime, isButtonEnabled: false));
|
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||||
print("Timer started, initial remaining time: $_remainingTime");
|
|
||||||
await AuthenticationAPI.sendOtp(email: forgetEmailController.text);
|
await AuthenticationAPI.sendOtp(email: forgetEmailController.text);
|
||||||
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
_remainingTime--;
|
_remainingTime--;
|
||||||
print("Timer tick, remaining time: $_remainingTime"); // Debug print
|
|
||||||
if (_remainingTime <= 0) {
|
if (_remainingTime <= 0) {
|
||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
||||||
print("Timer finished"); // Debug print
|
|
||||||
} else {
|
} else {
|
||||||
add(UpdateTimerEvent(
|
add(UpdateTimerEvent(
|
||||||
remainingTime: _remainingTime, isButtonEnabled: false));
|
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||||
@ -92,8 +89,6 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////// login /////////////////////////////////////
|
///////////////////////////////////// login /////////////////////////////////////
|
||||||
final TextEditingController loginEmailController = TextEditingController();
|
final TextEditingController loginEmailController = TextEditingController();
|
||||||
final TextEditingController loginPasswordController = TextEditingController();
|
final TextEditingController loginPasswordController = TextEditingController();
|
||||||
@ -103,12 +98,13 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
String newPassword = '';
|
String newPassword = '';
|
||||||
String maskedEmail = '';
|
String maskedEmail = '';
|
||||||
String otpCode = '';
|
String otpCode = '';
|
||||||
|
String validate = '';
|
||||||
static Token token = Token.emptyConstructor();
|
static Token token = Token.emptyConstructor();
|
||||||
static UserModel? user;
|
static UserModel? user;
|
||||||
bool showValidationMessage = false;
|
bool showValidationMessage = false;
|
||||||
|
|
||||||
void _login(LoginButtonPressed event, Emitter<AuthState> emit) async {
|
void _login(LoginButtonPressed event, Emitter<AuthState> emit) async {
|
||||||
emit(LoginLoading());
|
emit(AuthLoading());
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
try {
|
try {
|
||||||
if (event.username.isEmpty || event.password.isEmpty) {
|
if (event.username.isEmpty || event.password.isEmpty) {
|
||||||
@ -123,12 +119,12 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (failure) {
|
} catch (failure) {
|
||||||
|
validate='Something went wrong';
|
||||||
emit(const LoginFailure(error: 'Something went wrong'));
|
emit(const LoginFailure(error: 'Something went wrong'));
|
||||||
// emit(LoginFailure(error: failure.toString()));
|
// emit(LoginFailure(error: failure.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (token.accessTokenIsNotEmpty) {
|
if (token.accessTokenIsNotEmpty) {
|
||||||
debugPrint('token: ${token.accessToken}');
|
|
||||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||||
await storage.write(
|
await storage.write(
|
||||||
key: Token.loginAccessTokenKey, value: token.accessToken);
|
key: Token.loginAccessTokenKey, value: token.accessToken);
|
||||||
@ -148,7 +144,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkBoxToggle(CheckBoxEvent event, Emitter<AuthState> emit,) {
|
checkBoxToggle(CheckBoxEvent event, Emitter<AuthState> emit,) {
|
||||||
emit(LoginLoading());
|
emit(AuthLoading());
|
||||||
isChecked = event.newValue!;
|
isChecked = event.newValue!;
|
||||||
emit(LoginInitial());
|
emit(LoginInitial());
|
||||||
}
|
}
|
||||||
@ -161,15 +157,13 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _passwordVisible(PasswordVisibleEvent event, Emitter<AuthState> emit) {
|
void _passwordVisible(PasswordVisibleEvent event, Emitter<AuthState> emit) {
|
||||||
emit(LoginLoading());
|
emit(AuthLoading());
|
||||||
obscureText = !event.newValue!;
|
obscureText = !event.newValue!;
|
||||||
emit(PasswordVisibleState());
|
emit(PasswordVisibleState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void launchURL(String url) {
|
void launchURL(String url) {
|
||||||
if (kDebugMode) {
|
|
||||||
print('Launching URL: $url');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -320,6 +314,18 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _fetchRegion(RegionInitialEvent event, Emitter<AuthState> emit) async {
|
||||||
|
try {
|
||||||
|
emit(AuthLoading());
|
||||||
|
regionList = await AuthenticationAPI.fetchRegion();
|
||||||
|
emit(LoginSuccess());
|
||||||
|
} catch (e) {
|
||||||
|
emit( LoginFailure(error: e.toString()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ class LoginButtonPressed extends AuthEvent {
|
|||||||
List<Object> get props => [username, password];
|
List<Object> get props => [username, password];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CheckBoxEvent extends AuthEvent {
|
class CheckBoxEvent extends AuthEvent {
|
||||||
final bool? newValue;
|
final bool? newValue;
|
||||||
|
|
||||||
@ -50,3 +49,7 @@ class PasswordVisibleEvent extends AuthEvent{
|
|||||||
|
|
||||||
const PasswordVisibleEvent({required this.newValue,});
|
const PasswordVisibleEvent({required this.newValue,});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RegionInitialEvent extends AuthEvent {}
|
||||||
|
|
||||||
|
class SelectRegionEvent extends AuthEvent {}
|
||||||
|
@ -11,7 +11,7 @@ class LoginInitial extends AuthState {}
|
|||||||
|
|
||||||
class AuthTokenLoading extends AuthState {}
|
class AuthTokenLoading extends AuthState {}
|
||||||
|
|
||||||
class LoginLoading extends AuthState {}
|
class AuthLoading extends AuthState {}
|
||||||
|
|
||||||
class LoginSuccess extends AuthState {}
|
class LoginSuccess extends AuthState {}
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ class TimerState extends AuthState {
|
|||||||
List<Object> get props => [isButtonEnabled, remainingTime];
|
List<Object> get props => [isButtonEnabled, remainingTime];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AuthError extends AuthState {
|
class AuthError extends AuthState {
|
||||||
final String message;
|
final String message;
|
||||||
String? code;
|
String? code;
|
||||||
@ -70,9 +69,7 @@ class AuthError extends AuthState {
|
|||||||
class AuthTokenError extends AuthError {
|
class AuthTokenError extends AuthError {
|
||||||
AuthTokenError({required super.message, super.code});
|
AuthTokenError({required super.message, super.code});
|
||||||
}
|
}
|
||||||
|
|
||||||
class AuthSuccess extends AuthState {}
|
class AuthSuccess extends AuthState {}
|
||||||
|
|
||||||
class AuthTokenSuccess extends AuthSuccess {}
|
class AuthTokenSuccess extends AuthSuccess {}
|
||||||
|
|
||||||
|
|
||||||
// class AuthState extends AuthState {}
|
|
||||||
|
25
lib/pages/auth/model/region_model.dart
Normal file
25
lib/pages/auth/model/region_model.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
class RegionModel {
|
||||||
|
final String name;
|
||||||
|
final String id;
|
||||||
|
|
||||||
|
RegionModel({
|
||||||
|
required this.name,
|
||||||
|
required this.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RegionModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RegionModel(
|
||||||
|
name: json['regionName'],
|
||||||
|
id: json['uuid'].toString(), // Ensure id is a String
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'regionName': name,
|
||||||
|
'uuid': id,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ import 'package:syncrow_web/utils/constants/assets.dart';
|
|||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
class ForgetPasswordWebPage extends StatelessWidget {
|
class ForgetPasswordWebPage extends StatelessWidget {
|
||||||
const ForgetPasswordWebPage({super.key});
|
const ForgetPasswordWebPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -19,9 +18,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
create: (context) => AuthBloc(),
|
create: (context) => AuthBloc(),
|
||||||
child: BlocConsumer<AuthBloc, AuthState>(
|
child: BlocConsumer<AuthBloc, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is LoadingForgetState) {
|
if (state is SuccessForgetState){
|
||||||
|
|
||||||
} else if (state is SuccessForgetState){
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
else if (state is FailureForgetState) {
|
else if (state is FailureForgetState) {
|
||||||
@ -45,32 +42,50 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildForm(BuildContext context, AuthState state) {
|
Widget _buildForm(BuildContext context, AuthState state) {
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
_scrollController = ScrollController();
|
||||||
|
void _scrollToCenter() {
|
||||||
|
final double middlePosition = _scrollController.position.maxScrollExtent / 2;
|
||||||
|
_scrollController.animateTo(
|
||||||
|
middlePosition,
|
||||||
|
duration: const Duration(seconds: 1),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_scrollToCenter();
|
||||||
|
});
|
||||||
final forgetBloc = BlocProvider.of<AuthBloc>(context);
|
final forgetBloc = BlocProvider.of<AuthBloc>(context);
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
return FirstLayer(
|
return FirstLayer(
|
||||||
second: Container(
|
second: Center(
|
||||||
padding:const EdgeInsets.all(50) ,
|
child: ListView(
|
||||||
margin: const EdgeInsets.all(50),
|
shrinkWrap: true,
|
||||||
|
controller: _scrollController,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(size.width*0.02),
|
||||||
|
margin: EdgeInsets.all(size.width*0.09),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ListView(
|
child: Row(
|
||||||
shrinkWrap: true,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.loginLogo,
|
Assets.loginLogo,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Container(
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white.withOpacity(0.1),
|
color: Colors.white.withOpacity(0.1),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||||
@ -79,8 +94,9 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
child: Form(
|
child: Form(
|
||||||
key: forgetBloc.forgetFormKey,
|
key: forgetBloc.forgetFormKey,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 25),
|
horizontal: size.width*0.02,
|
||||||
|
vertical: size.width*0.003),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -93,23 +109,22 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
'Please fill in your account information to\nretrieve your password',
|
'Please fill in your account information to\nretrieve your password',
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 10),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Country/Region",
|
"Country/Region",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.2,
|
|
||||||
child: DropdownButtonFormField<String>(
|
child: DropdownButtonFormField<String>(
|
||||||
validator: forgetBloc.validateRegion,
|
validator: forgetBloc.validateRegion,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -118,11 +133,16 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
decoration: textBoxDecoration()!.copyWith(
|
decoration: textBoxDecoration()!.copyWith(
|
||||||
hintText: null,
|
hintText: null,
|
||||||
),
|
),
|
||||||
hint: const Align(
|
hint: SizedBox(
|
||||||
|
width: size.width * 0.11,
|
||||||
|
child: const Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Select your region/country',
|
'Select your region/country',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
@ -146,10 +166,10 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Account",
|
Text("Account",
|
||||||
style: smallTextStyle,),
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator: forgetBloc.validateEmail,
|
validator: forgetBloc.validateEmail,
|
||||||
controller: forgetBloc.forgetEmailController,
|
controller: forgetBloc.forgetEmailController,
|
||||||
@ -165,10 +185,9 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("One Time Password",
|
Text("One Time Password",
|
||||||
style: smallTextStyle,),
|
style: Theme.of(context).textTheme.bodySmall,),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator: forgetBloc.validateCode,
|
validator: forgetBloc.validateCode,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
@ -205,10 +224,9 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Password",
|
Text("Password",
|
||||||
style: smallTextStyle,),
|
style: Theme.of(context).textTheme.bodySmall,),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator: forgetBloc.passwordValidator,
|
validator: forgetBloc.passwordValidator,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
@ -225,8 +243,12 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20.0),
|
const SizedBox(height: 20.0),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
width: size.width * 0.2,
|
||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
backgroundColor: ColorsManager.btnColor,
|
backgroundColor: ColorsManager.btnColor,
|
||||||
child: const Text('Submit'),
|
child: const Text('Submit'),
|
||||||
@ -237,9 +259,14 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
SizedBox(child: Text(forgetBloc.validate,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),),
|
||||||
SizedBox(height: 10,),
|
SizedBox(height: 10,),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
width: size.width * 0.2,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
@ -266,13 +293,15 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import 'package:syncrow_web/utils/style.dart';
|
|||||||
|
|
||||||
class LoginMobilePage extends StatelessWidget {
|
class LoginMobilePage extends StatelessWidget {
|
||||||
const LoginMobilePage({super.key});
|
const LoginMobilePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -39,7 +38,7 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is LoginLoading) {
|
if (state is AuthLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else {
|
} else {
|
||||||
return _buildLoginForm(context);
|
return _buildLoginForm(context);
|
||||||
@ -128,7 +127,7 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Country/Region",
|
"Country/Region",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: DropdownButtonFormField<String>(
|
child: DropdownButtonFormField<String>(
|
||||||
@ -169,7 +168,7 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Email",
|
"Email",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
@ -189,7 +188,7 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Password",
|
"Password",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
@ -222,7 +221,7 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
"Forgot Password?",
|
"Forgot Password?",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -311,90 +310,6 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(5.0),
|
|
||||||
// child: SizedBox(
|
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Expanded(child: Image.asset(Assets.liftLine)),
|
|
||||||
// Expanded(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(5.0),
|
|
||||||
// child: Text('Or sign in with',
|
|
||||||
// style: smallTextStyle.copyWith(fontSize: 10),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
// Expanded(child: Image.asset(Assets.rightLine)),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
// child: Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// decoration: containerDecoration,
|
|
||||||
// child:InkWell(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// SvgPicture.asset(
|
|
||||||
// Assets.google,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// const Flexible(
|
|
||||||
// child: Text('Google',
|
|
||||||
// style: TextStyle(color: Colors.black),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// onTap: () {},
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 10,),
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// decoration: containerDecoration,
|
|
||||||
// child:InkWell(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// SvgPicture.asset(
|
|
||||||
// Assets.facebook,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// const Flexible(
|
|
||||||
// child: Text('Facebook',
|
|
||||||
// style: TextStyle(color: Colors.black),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// onTap: () {},
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -7,7 +7,6 @@ import 'package:syncrow_web/utils/responsive_layout.dart';
|
|||||||
|
|
||||||
class LoginPage extends StatelessWidget {
|
class LoginPage extends StatelessWidget {
|
||||||
const LoginPage({super.key});
|
const LoginPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const ResponsiveLayout(
|
return const ResponsiveLayout(
|
||||||
|
@ -15,14 +15,20 @@ import 'package:syncrow_web/utils/constants/assets.dart';
|
|||||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class LoginWebPage extends StatelessWidget {
|
class LoginWebPage extends StatefulWidget {
|
||||||
const LoginWebPage({super.key});
|
const LoginWebPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LoginWebPage> createState() => _LoginWebPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginWebPageState extends State<LoginWebPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: BlocProvider(
|
body: BlocProvider(
|
||||||
create: (context) => AuthBloc(),
|
create: (BuildContext context) => AuthBloc(),
|
||||||
child: BlocConsumer<AuthBloc, AuthState>(
|
child: BlocConsumer<AuthBloc, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is LoginSuccess) {
|
if (state is LoginSuccess) {
|
||||||
@ -41,7 +47,7 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is LoginLoading) {
|
if (state is AuthLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else {
|
} else {
|
||||||
return _buildLoginForm(context,state);
|
return _buildLoginForm(context,state);
|
||||||
@ -54,30 +60,49 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildLoginForm(BuildContext context,AuthState state) {
|
Widget _buildLoginForm(BuildContext context,AuthState state) {
|
||||||
final loginBloc = BlocProvider.of<AuthBloc>(context);
|
final loginBloc = BlocProvider.of<AuthBloc>(context);
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
_scrollController = ScrollController();
|
||||||
|
void _scrollToCenter() {
|
||||||
|
final double middlePosition = _scrollController.position.maxScrollExtent / 2;
|
||||||
|
_scrollController.animateTo(
|
||||||
|
middlePosition,
|
||||||
|
duration: const Duration(seconds: 1),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_scrollToCenter();
|
||||||
|
});
|
||||||
return FirstLayer(
|
return FirstLayer(
|
||||||
second: Container(
|
second: Center(
|
||||||
margin: const EdgeInsets.all(50),
|
child: ListView(
|
||||||
|
controller: _scrollController,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(size.width*0.02) ,
|
||||||
|
margin: EdgeInsets.all(size.width*0.09),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black.withOpacity(0.3),
|
color: Colors.black.withOpacity(0.3),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ListView(
|
child:Row(
|
||||||
shrinkWrap: true,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.loginLogo,
|
Assets.loginLogo,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Container(
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white.withOpacity(0.1),
|
color: Colors.white.withOpacity(0.1),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||||
@ -85,46 +110,45 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
child: Form(
|
child: Form(
|
||||||
key: loginBloc.loginFormKey,
|
key: loginBloc.loginFormKey,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 25),
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: size.width*0.02,
|
||||||
|
vertical: size.width*0.003),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 15),
|
|
||||||
const Text(
|
|
||||||
'Login',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 24,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
|
Text(
|
||||||
|
'Login',
|
||||||
|
style:Theme.of(context).textTheme.headlineLarge),
|
||||||
|
SizedBox(height: size.height*0.03),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Country/Region",
|
"Country/Region",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.2,
|
|
||||||
child: DropdownButtonFormField<String>(
|
child: DropdownButtonFormField<String>(
|
||||||
validator:loginBloc.validateRegion ,
|
validator:loginBloc.validateRegion ,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.keyboard_arrow_down_outlined,
|
Icons.keyboard_arrow_down_outlined,
|
||||||
),
|
),
|
||||||
decoration: textBoxDecoration()!.copyWith(
|
decoration: textBoxDecoration()!.copyWith(
|
||||||
hintText: null,
|
hintText: null,),
|
||||||
),
|
hint: SizedBox(
|
||||||
hint: const Align(
|
width: size.width * 0.11,
|
||||||
|
child: const Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Select your region/country',
|
'Select your region/country',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
@ -135,9 +159,7 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
child: Text(region),
|
child: Text(region),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (String? value) {
|
onChanged: (String? value) {},
|
||||||
print(value);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -148,13 +170,12 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Email",
|
Text("Email",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator:loginBloc.validateEmail ,
|
validator:loginBloc.validateEmail ,
|
||||||
controller:loginBloc.loginEmailController,
|
controller:loginBloc.loginEmailController,
|
||||||
@ -169,12 +190,11 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Password", style: smallTextStyle,),
|
Text("Password", style: Theme.of(context).textTheme.bodySmall,),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator:loginBloc.validatePassword,
|
validator:loginBloc.validatePassword,
|
||||||
obscureText:loginBloc.obscureText,
|
obscureText:loginBloc.obscureText,
|
||||||
@ -205,7 +225,6 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.2,
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -215,14 +234,14 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
"Forgot Password?",
|
"Forgot Password?",
|
||||||
style: smallTextStyle,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 32,
|
height: 20,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@ -240,7 +259,7 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
width:size.width * 0.14,
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: 'Agree to ',
|
text: 'Agree to ',
|
||||||
@ -249,7 +268,7 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: '(Terms of Service)',
|
text: '(Terms of Service)',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.black),
|
color: Colors.black,),
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
loginBloc.launchURL(
|
loginBloc.launchURL(
|
||||||
@ -281,9 +300,9 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30.0),
|
const SizedBox(height: 20.0),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.2,
|
width:size.width * 0.2,
|
||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
backgroundColor: loginBloc.isChecked?
|
backgroundColor: loginBloc.isChecked?
|
||||||
ColorsManager.btnColor:ColorsManager.grayColor,
|
ColorsManager.btnColor:ColorsManager.grayColor,
|
||||||
@ -299,120 +318,24 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 15.0),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [ SizedBox(child: Text(loginBloc.validate,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)],)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
)),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
|
),),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(5.0),
|
|
||||||
// child: SizedBox(
|
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Expanded(child: Image.asset(Assets.liftLine)),
|
|
||||||
// Expanded(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(5.0),
|
|
||||||
// child: Text('Or sign in with',
|
|
||||||
// style: smallTextStyle.copyWith(fontSize: 10),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
// Expanded(child: Image.asset(Assets.rightLine)),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
// child: Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// decoration: containerDecoration,
|
|
||||||
// child:InkWell(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// SvgPicture.asset(
|
|
||||||
// Assets.google,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// const Flexible(
|
|
||||||
// child: Text('Google',
|
|
||||||
// style: TextStyle(color: Colors.black),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// onTap: () {},
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 10,),
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// decoration: containerDecoration,
|
|
||||||
// child:InkWell(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// SvgPicture.asset(
|
|
||||||
// Assets.facebook,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// const Flexible(
|
|
||||||
// child: Text('Facebook',
|
|
||||||
// style: TextStyle(color: Colors.black),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// onTap: () {},
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
|
||||||
// child: const Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Flexible(
|
|
||||||
// child: Text(
|
|
||||||
// "Don't you have an account? ",
|
|
||||||
// style: TextStyle(color: Colors.white),
|
|
||||||
// )),
|
|
||||||
// Flexible(
|
|
||||||
// child: Text(
|
|
||||||
// "Sign up",
|
|
||||||
// )),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )
|
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
|
||||||
|
|
||||||
class DefaultButton extends StatelessWidget {
|
class DefaultButton extends StatelessWidget {
|
||||||
const DefaultButton({
|
const DefaultButton({
|
||||||
@ -48,7 +47,7 @@ class DefaultButton extends StatelessWidget {
|
|||||||
ButtonStyle(
|
ButtonStyle(
|
||||||
textStyle: MaterialStateProperty.all(
|
textStyle: MaterialStateProperty.all(
|
||||||
customTextStyle
|
customTextStyle
|
||||||
?? smallTextStyle.copyWith(
|
?? Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: foregroundColor,
|
color: foregroundColor,
|
||||||
fontWeight: FontWeight.normal
|
fontWeight: FontWeight.normal
|
||||||
|
@ -53,9 +53,9 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return HomeCard(
|
return HomeCard(
|
||||||
index: index,
|
index: index,
|
||||||
active:ceilingSensorButtons[index]['active'],
|
active: homeItems[index]['active'],
|
||||||
name: ceilingSensorButtons[index]['title'],
|
name: homeItems[index]['title'],
|
||||||
img:ceilingSensorButtons[index]['icon'] ,
|
img: homeItems[index]['icon'],
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -69,8 +69,7 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic ceilingSensorButtons =
|
dynamic homeItems = [
|
||||||
[
|
|
||||||
{
|
{
|
||||||
'title': 'Access',
|
'title': 'Access',
|
||||||
'icon': Assets.accessIcon,
|
'icon': Assets.accessIcon,
|
||||||
@ -108,7 +107,8 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
'icon': Assets.integrationsIcon,
|
'icon': Assets.integrationsIcon,
|
||||||
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
|
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||||
'active': false,
|
'active': false,
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
'title': 'Asset',
|
'title': 'Asset',
|
||||||
'icon': Assets.assetIcon,
|
'icon': Assets.assetIcon,
|
||||||
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
|
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||||
|
@ -13,6 +13,7 @@ class HTTPInterceptor extends InterceptorsWrapper {
|
|||||||
|
|
||||||
List<String> headerExclusionListOfAddedParameters = [
|
List<String> headerExclusionListOfAddedParameters = [
|
||||||
ApiEndpoints.login,
|
ApiEndpoints.login,
|
||||||
|
ApiEndpoints.getRegion
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:syncrow_web/pages/auth/model/region_model.dart';
|
||||||
import 'package:syncrow_web/pages/auth/model/token.dart';
|
import 'package:syncrow_web/pages/auth/model/token.dart';
|
||||||
import 'package:syncrow_web/services/api/http_service.dart';
|
import 'package:syncrow_web/services/api/http_service.dart';
|
||||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||||
@ -17,45 +18,32 @@ class AuthenticationAPI {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future forgetPassword({ required var email, required var password}) async {
|
static Future forgetPassword(
|
||||||
|
{required var email, required var password}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.forgetPassword,
|
path: ApiEndpoints.forgetPassword,
|
||||||
body: {
|
body: {"email": email, "password": password},
|
||||||
"email": email,
|
|
||||||
"password": password
|
|
||||||
},
|
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {});
|
||||||
});
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future sendOtp({required var email}) async {
|
static Future sendOtp({required var email}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.sendOtp,
|
path: ApiEndpoints.sendOtp,
|
||||||
body: {
|
body: {"email": email, "type": "VERIFICATION"},
|
||||||
"email": email,
|
|
||||||
"type": "VERIFICATION"
|
|
||||||
},
|
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {});
|
||||||
print('json===$json');
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> verifyOtp({ required String email, required String otpCode}) async {
|
static Future<bool> verifyOtp(
|
||||||
|
{required String email, required String otpCode}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.verifyOtp,
|
path: ApiEndpoints.verifyOtp,
|
||||||
body: {
|
body: {"email": email, "type": "VERIFICATION", "otpCode": otpCode},
|
||||||
"email": email,
|
|
||||||
"type": "VERIFICATION",
|
|
||||||
"otpCode": otpCode
|
|
||||||
},
|
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('json===${json['message']}');
|
|
||||||
if (json['message'] == 'Otp Verified Successfully') {
|
if (json['message'] == 'Otp Verified Successfully') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -64,4 +52,16 @@ class AuthenticationAPI {
|
|||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<RegionModel>> fetchRegion() async {
|
||||||
|
final response = await HTTPService().get(
|
||||||
|
path: ApiEndpoints.getRegion,
|
||||||
|
showServerMessage: true,
|
||||||
|
expectedResponseModel: (json) {
|
||||||
|
return (json as List).map((zone) => RegionModel.fromJson(zone)).toList();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return response as List<RegionModel>;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,5 @@ abstract class ApiEndpoints {
|
|||||||
static const String forgetPassword = '$baseUrl/authentication/user/forget-password';
|
static const String forgetPassword = '$baseUrl/authentication/user/forget-password';
|
||||||
static const String sendOtp = '$baseUrl/authentication/user/send-otp';
|
static const String sendOtp = '$baseUrl/authentication/user/send-otp';
|
||||||
static const String verifyOtp = '$baseUrl/authentication/user/verify-otp';
|
static const String verifyOtp = '$baseUrl/authentication/user/verify-otp';
|
||||||
|
static const String getRegion = '$baseUrl/region';
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,5 @@ InputDecoration? textBoxDecoration({bool suffixIcon = false}) => InputDecoration
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
TextStyle appBarTextStyle =
|
|
||||||
const TextStyle(fontSize: 20, color: ColorsManager.whiteColors);
|
|
||||||
|
|
||||||
TextStyle smallTextStyle =
|
|
||||||
const TextStyle(fontSize: 13, color: ColorsManager.whiteColors,fontWeight: FontWeight.bold);
|
|
||||||
|
|
||||||
|
|
||||||
Decoration containerDecoration = const BoxDecoration(color: Colors.white,borderRadius: BorderRadius.all(Radius.circular(20)));
|
Decoration containerDecoration = const BoxDecoration(color: Colors.white,borderRadius: BorderRadius.all(Radius.circular(20)));
|
@ -16,13 +16,8 @@ class WebAppBar extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 40,),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: title!
|
child: title!,
|
||||||
// Text(
|
|
||||||
// title!,style: const TextStyle(
|
|
||||||
// fontSize: 30,
|
|
||||||
// color: Colors.white),)
|
|
||||||
),
|
),
|
||||||
if (body != null)
|
if (body != null)
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -32,10 +27,12 @@ class WebAppBar extends StatelessWidget {
|
|||||||
children: body!,
|
children: body!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 10,),
|
const SizedBox(
|
||||||
SizedBox.square(
|
width: 10,
|
||||||
|
),
|
||||||
|
const SizedBox.square(
|
||||||
dimension: 40,
|
dimension: 40,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
@ -48,10 +45,13 @@ class WebAppBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10,),
|
const SizedBox(
|
||||||
const Text('mohamamd alnemer ',style: TextStyle(fontSize: 16,color: Colors.white),),
|
width: 10,
|
||||||
Icon(Icons.arrow_drop_down,color: ColorsManager.whiteColors,),
|
),
|
||||||
SizedBox(width: 40,)
|
Text(
|
||||||
|
'mohamamd alnemer ',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user