bloc
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
"java.configuration.updateBuildConfiguration": "interactive",
|
||||
"dart.flutterSdkPath": "D:\\pooja\\fluttersdk\\flutter_3.16.9\\flutter"
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import 'package:traderscircuit/Utils/utils.dart';
|
||||
import '../../Utils/base_manager.dart';
|
||||
import 'base_api_services.dart';
|
||||
|
||||
class NetworkApiServices extends BaseApiServices {
|
||||
class NetworkApiServices {
|
||||
Dio dio = Dio();
|
||||
String basicAuth = 'Basic ' +
|
||||
base64.encode(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -13,6 +14,9 @@ import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:traderscircuit/resources/routes/routes.dart';
|
||||
import 'package:onesignal_flutter/onesignal_flutter.dart';
|
||||
|
||||
import 'view_model/LoginPage/Loginbloc.dart';
|
||||
import 'view_model/SendOtp/sendOtpbloc.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -39,7 +43,16 @@ Future<void> main() async {
|
||||
);
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]).then((value) => runApp(const MyApp()));
|
||||
]).then((value) => runApp(MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<CounterBloc>(
|
||||
create: (context) => CounterBloc(),
|
||||
),
|
||||
BlocProvider<SendOtpBloc>(
|
||||
create: (context) => SendOtpBloc(),
|
||||
),
|
||||
// Add more BlocProviders for other Blocs here if needed
|
||||
],child: const MyApp())));
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
|
||||
@@ -86,7 +86,7 @@ class AppRoutes {
|
||||
),
|
||||
GetPage(
|
||||
name: RouteName.verifyotp,
|
||||
page: () => const VerifyOTP(),
|
||||
page: () => VerifyOTP(),
|
||||
),
|
||||
|
||||
//secureaccess
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:glassmorphism/glassmorphism.dart';
|
||||
@@ -11,9 +12,15 @@ import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/Utils/text.dart';
|
||||
import 'package:traderscircuit/Utils/utils.dart';
|
||||
import 'package:traderscircuit/resources/routes/route_name.dart';
|
||||
import 'package:traderscircuit/view/login/VerifyOtp.dart';
|
||||
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
|
||||
import 'package:traderscircuit/view_model/Login/send_otp_api.dart';
|
||||
import 'package:traderscircuit/Utils/Dialogs.dart';
|
||||
import 'package:traderscircuit/view_model/LoginPage/Loginbloc.dart';
|
||||
|
||||
import '../../view_model/LoginPage/Loginobserver.dart';
|
||||
import '../../view_model/SendOtp/sendOtpObserver.dart';
|
||||
import '../../view_model/SendOtp/sendOtpbloc.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({super.key});
|
||||
@@ -33,6 +40,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final CounterBloc counterbloc = BlocProvider.of<CounterBloc>(context);
|
||||
//final sendOtpBloc = context.read<SendOtpBloc>();
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
_onBackButtonPressed(context);
|
||||
@@ -41,343 +51,383 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
extendBody: true,
|
||||
body: Stack(
|
||||
children: [
|
||||
const CommonBlurLeft(),
|
||||
const CommonBlurRight(),
|
||||
Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: Form(
|
||||
key: _sendotpform,
|
||||
child: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Traders Circuit",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 42.h,
|
||||
),
|
||||
const Text(
|
||||
"Lets get started ",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
text18W800("Enter your mobile number to get otp"),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GlassmorphicContainer(
|
||||
width: 60,
|
||||
height: 50,
|
||||
borderRadius: 8,
|
||||
blur: 10,
|
||||
alignment: Alignment.center,
|
||||
border: 0.8,
|
||||
linearGradient: LinearGradient(
|
||||
body: BlocProvider<SendOtpBloc>(
|
||||
create: (context) => SendOtpBloc(),
|
||||
child: Stack(
|
||||
children: [
|
||||
const CommonBlurLeft(),
|
||||
const CommonBlurRight(),
|
||||
Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 16),
|
||||
child: Form(
|
||||
key: _sendotpform,
|
||||
child: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Traders Circuit",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 42.h,
|
||||
),
|
||||
//bloc implementation
|
||||
/* GestureDetector(
|
||||
onTap: () {
|
||||
counterbloc.add(NumberIncreaseEvent());
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 80.h,
|
||||
child: Text(
|
||||
"click me",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (state is UpdateState)
|
||||
Text(
|
||||
"${state.counter}",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
*/
|
||||
const Text(
|
||||
"Lets get started ",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
text18W800("Enter your mobile number to get otp"),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GlassmorphicContainer(
|
||||
width: 60,
|
||||
height: 50,
|
||||
borderRadius: 8,
|
||||
blur: 10,
|
||||
alignment: Alignment.center,
|
||||
border: 0.8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Colors.white.withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF)
|
||||
.withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Colors.white.withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
const Color(0xff9A0000).withOpacity(0.5),
|
||||
const Color(0xFFffffff).withOpacity(0.5),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xff9A0000).withOpacity(0.5),
|
||||
const Color(0xFFffffff).withOpacity(0.5),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// SvgPicture.asset("assets/images/svg/india.svg"),
|
||||
Image.asset(
|
||||
"assets/images/png/india.png",
|
||||
height: 25.h,
|
||||
width: 25.h,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 2,
|
||||
),
|
||||
const Text(
|
||||
"+91",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
fontSize: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// SvgPicture.asset("assets/images/svg/india.svg"),
|
||||
Image.asset(
|
||||
"assets/images/png/india.png",
|
||||
height: 25.h,
|
||||
width: 25.h,
|
||||
),
|
||||
)
|
||||
],
|
||||
const SizedBox(
|
||||
width: 2,
|
||||
),
|
||||
const Text(
|
||||
"+91",
|
||||
style: TextStyle(
|
||||
fontFamily: 'hiragino',
|
||||
fontSize: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
SizedBox(
|
||||
width: 285.w,
|
||||
child: CustomTextFormField(
|
||||
texttype: TextInputType.phone,
|
||||
textEditingController: phonecontroller,
|
||||
// validator: (value) {
|
||||
// if (value.isEmpty) {
|
||||
// return 'Enter your phone number';
|
||||
// } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)')
|
||||
// .hasMatch(value)) {
|
||||
// return 'Enter a valid phone number';
|
||||
// } else if (!isValidPhoneNumber(value)) {
|
||||
// return 'Phone number cannot contain 10 zeros';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(10),
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp('[0-9]')),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
SizedBox(
|
||||
width: 285.w,
|
||||
child: CustomTextFormField(
|
||||
texttype: TextInputType.phone,
|
||||
textEditingController: phonecontroller,
|
||||
// validator: (value) {
|
||||
// if (value.isEmpty) {
|
||||
// return 'Enter your phone number';
|
||||
// } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)')
|
||||
// .hasMatch(value)) {
|
||||
// return 'Enter a valid phone number';
|
||||
// } else if (!isValidPhoneNumber(value)) {
|
||||
// return 'Phone number cannot contain 10 zeros';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(10),
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp('[0-9]')),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
text14W300(
|
||||
"We’ll send six digit code to the registered number. Standard data rates may apply"),
|
||||
SizedBox(
|
||||
height: 65.h,
|
||||
),
|
||||
|
||||
BlocConsumer<SendOtpBloc, SendOtpState>(
|
||||
listener: (context, state) {
|
||||
if (state == SendOtpState.success) {
|
||||
WidgetsBinding.instance
|
||||
?.addPostFrameCallback((_) {
|
||||
Get.toNamed(RouteName.verifyotp, arguments: {
|
||||
"phonenumber": phonecontroller.text,
|
||||
});
|
||||
});
|
||||
} else if (state == SendOtpState.failure) {
|
||||
Utils.showToast("Oops something went wrong");
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
print(state);
|
||||
if (state == SendOtpState.loading) {
|
||||
return Center(
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: CircularProgressIndicator()));
|
||||
}
|
||||
return CommonBtn(
|
||||
text: "Login/Signup",
|
||||
onTap: () async {
|
||||
final isValid =
|
||||
_sendotpform.currentState?.validate();
|
||||
if (isValid!) {
|
||||
FocusManager.instance.primaryFocus
|
||||
?.unfocus();
|
||||
if (isValid != null && isValid) {
|
||||
Map<String, String> myLoginData = {
|
||||
"mobile_number": phonecontroller.text,
|
||||
};
|
||||
context
|
||||
.read<SendOtpBloc>()
|
||||
.add(SendOtp(myLoginData));
|
||||
} else {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Please enter valid phone number'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
text14W300(
|
||||
"By continuing, you agree to our Terms & Conditions"),
|
||||
SizedBox(
|
||||
height: 45.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 0.2.h,
|
||||
width: 108.w,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 22.w,
|
||||
),
|
||||
text18W600("OR"),
|
||||
SizedBox(
|
||||
width: 22.w,
|
||||
),
|
||||
Container(
|
||||
height: 0.2.h,
|
||||
width: 108.w,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.3,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFAF2E89).withOpacity(0.2),
|
||||
const Color(0xFFA23E31).withOpacity(0.2),
|
||||
const Color(0xFF0000).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/apple.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400("Continue with apple"),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
text14W300(
|
||||
"We’ll send six digit code to the registered number. Standard data rates may apply"),
|
||||
SizedBox(
|
||||
height: 65.h,
|
||||
),
|
||||
CommonBtn(
|
||||
text: "Login/Signup",
|
||||
onTap: () async {
|
||||
final isValid =
|
||||
_sendotpform.currentState?.validate();
|
||||
if (isValid!) {
|
||||
utils.loader();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
Map<String, String> myLoginData = {
|
||||
"mobile_number": phonecontroller.text,
|
||||
};
|
||||
|
||||
var resp =
|
||||
await SendOtpAPI(myLoginData).sendOtpApi();
|
||||
print(resp.status);
|
||||
print('Api msg : ${resp.message}');
|
||||
|
||||
if (resp.status == ResponseStatus.SUCCESS) {
|
||||
Get.back();
|
||||
print("api response is ${resp.data}");
|
||||
Utils.showToast("OTP sent successfully");
|
||||
|
||||
Map<String, dynamic> res = resp.data;
|
||||
print(res);
|
||||
|
||||
Get.toNamed(RouteName.verifyotp, arguments: {
|
||||
"phonenumber": phonecontroller.text
|
||||
});
|
||||
} else {
|
||||
Get.back();
|
||||
Utils.showToast(resp.message);
|
||||
print('Api msg : ${resp.message}');
|
||||
}
|
||||
} else {
|
||||
Get.snackbar(
|
||||
"Error", "Please Enter Login Credentials",
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM);
|
||||
}
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
text14W300(
|
||||
"By continuing, you agree to our Terms & Conditions"),
|
||||
SizedBox(
|
||||
height: 45.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 0.2.h,
|
||||
width: 108.w,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 22.w,
|
||||
),
|
||||
text18W600("OR"),
|
||||
SizedBox(
|
||||
width: 22.w,
|
||||
),
|
||||
Container(
|
||||
height: 0.2.h,
|
||||
width: 108.w,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.3,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFAF2E89).withOpacity(0.2),
|
||||
const Color(0xFFA23E31).withOpacity(0.2),
|
||||
const Color(0xFF0000).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/apple.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400("Continue with apple"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.5,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFAF2E89).withOpacity(0.2),
|
||||
const Color(0xFFA23E31).withOpacity(0.2),
|
||||
const Color(0xFF0000).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/google.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400(
|
||||
"Continue with google",
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 45.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
},
|
||||
child: text16W700(
|
||||
"Continue as guest",
|
||||
GlassmorphicContainer(
|
||||
width: double.infinity,
|
||||
height: 55.h,
|
||||
borderRadius: 8,
|
||||
linearGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFffffff).withOpacity(0.1),
|
||||
const Color(0xFFFFFFFF).withOpacity(0.05),
|
||||
],
|
||||
stops: const [
|
||||
0.1,
|
||||
1,
|
||||
]),
|
||||
border: 0.5,
|
||||
blur: 10,
|
||||
borderGradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFFAF2E89).withOpacity(0.2),
|
||||
const Color(0xFFA23E31).withOpacity(0.2),
|
||||
const Color(0xFF0000).withOpacity(0.2),
|
||||
],
|
||||
stops: const [
|
||||
0.3,
|
||||
0.6,
|
||||
1,
|
||||
]),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
"assets/images/png/google.png",
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 7.h,
|
||||
),
|
||||
text16W400(
|
||||
"Continue with google",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 45.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
},
|
||||
child: text16W700(
|
||||
"Continue as guest",
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -419,4 +469,5 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
);
|
||||
});
|
||||
return exitApp ?? false;
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ int? isKycUpdated;
|
||||
int? isSecuredAccess;
|
||||
|
||||
class VerifyOTP extends StatefulWidget {
|
||||
const VerifyOTP({super.key});
|
||||
VerifyOTP({super.key});
|
||||
|
||||
@override
|
||||
State<VerifyOTP> createState() => _VerifyOTPState();
|
||||
|
||||
24
lib/view_model/LoginPage/Loginbloc.dart
Normal file
24
lib/view_model/LoginPage/Loginbloc.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'Loginobserver.dart';
|
||||
|
||||
class CounterBloc extends Bloc<CounterEvents, CounterStates> {
|
||||
int counter = 0;
|
||||
|
||||
CounterBloc() : super(UpdateState(0)) {
|
||||
on<NumberIncreaseEvent>(onNumberIncrease);
|
||||
on<NumberDecreaseEvent>(onNumberDecrease);
|
||||
}
|
||||
|
||||
void onNumberIncrease(
|
||||
NumberIncreaseEvent event, Emitter<CounterStates> emit) async {
|
||||
counter = counter + 1;
|
||||
emit(UpdateState(counter));
|
||||
}
|
||||
|
||||
void onNumberDecrease(
|
||||
NumberDecreaseEvent event, Emitter<CounterStates> emit) async {
|
||||
counter = counter - 1;
|
||||
emit(UpdateState(counter));
|
||||
}
|
||||
}
|
||||
14
lib/view_model/LoginPage/Loginobserver.dart
Normal file
14
lib/view_model/LoginPage/Loginobserver.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
class CounterEvents {}
|
||||
|
||||
class NumberIncreaseEvent extends CounterEvents {}
|
||||
|
||||
class NumberDecreaseEvent extends CounterEvents {}
|
||||
|
||||
class CounterStates {}
|
||||
|
||||
class InitialState extends CounterStates {}
|
||||
|
||||
class UpdateState extends CounterStates {
|
||||
final int counter;
|
||||
UpdateState(this.counter);
|
||||
}
|
||||
24
lib/view_model/SendOtp/sendOtpObserver.dart
Normal file
24
lib/view_model/SendOtp/sendOtpObserver.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
// Define events
|
||||
abstract class SendOtpEvent {
|
||||
const SendOtpEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class SendOtp extends SendOtpEvent {
|
||||
final Map<String, String> loginData;
|
||||
SendOtp(this.loginData){
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [loginData];
|
||||
|
||||
}
|
||||
|
||||
// Define states
|
||||
enum SendOtpState { initial, loading, success, failure }
|
||||
|
||||
33
lib/view_model/SendOtp/sendOtpbloc.dart
Normal file
33
lib/view_model/SendOtp/sendOtpbloc.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Utils/base_manager.dart';
|
||||
import '../../resources/routes/route_name.dart';
|
||||
import '../Login/send_otp_api.dart';
|
||||
import 'sendOtpObserver.dart';
|
||||
|
||||
class SendOtpBloc extends Bloc<SendOtpEvent, SendOtpState> {
|
||||
SendOtpBloc() : super(SendOtpState.initial) {
|
||||
on<SendOtp>(mapEventToState);
|
||||
}
|
||||
Future<void> mapEventToState(
|
||||
SendOtp event, Emitter<SendOtpState> emit) async {
|
||||
if (event is SendOtp) {
|
||||
emit(SendOtpState.loading);
|
||||
try {
|
||||
final loginData = event.loginData;
|
||||
var resp = await SendOtpAPI(loginData).sendOtpApi();
|
||||
|
||||
if (resp.status == ResponseStatus.SUCCESS) {
|
||||
emit(SendOtpState.success);
|
||||
} else {
|
||||
emit(SendOtpState.failure);
|
||||
}
|
||||
} catch (e) {
|
||||
emit(SendOtpState.failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -49,6 +49,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
bloc:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bloc
|
||||
sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.4"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -217,6 +225,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.9"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: equatable
|
||||
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
expansion_tile_group:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -318,6 +334,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_bloc:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_bloc
|
||||
sha256: f0ecf6e6eb955193ca60af2d5ca39565a86b8a142452c5b24d96fb477428f4d2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.5"
|
||||
flutter_branch_sdk:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -48,6 +48,8 @@ dependencies:
|
||||
audio_video_progress_bar: ^2.0.2
|
||||
syncfusion_flutter_pdfviewer:
|
||||
flutter_html: ^3.0.0-beta.2
|
||||
flutter_bloc: ^8.1.5
|
||||
equatable: ^2.0.5
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user