mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
auth changes
This commit is contained in:
@ -43,11 +43,26 @@ 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;
|
Size size = MediaQuery.of(context).size;
|
||||||
return FirstLayer(
|
return FirstLayer(
|
||||||
second: Center(
|
second: Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
controller: _scrollController,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(size.width*0.02),
|
padding: EdgeInsets.all(size.width*0.02),
|
||||||
|
@ -15,11 +15,18 @@ 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: (BuildContext context) => AuthBloc(),
|
create: (BuildContext context) => AuthBloc(),
|
||||||
@ -55,9 +62,23 @@ 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;
|
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: Center(
|
second: Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
controller: _scrollController,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@ -81,96 +102,96 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Container(
|
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)),
|
||||||
border: Border.all(color: ColorsManager.graysColor.withOpacity(0.2))),
|
border: Border.all(color: ColorsManager.graysColor.withOpacity(0.2))),
|
||||||
child: Form(
|
child: Form(
|
||||||
key: loginBloc.loginFormKey,
|
key: loginBloc.loginFormKey,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: size.width*0.02,
|
horizontal: size.width*0.02,
|
||||||
vertical: size.width*0.003),
|
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: 40),
|
const SizedBox(height: 40),
|
||||||
const Text(
|
const Text(
|
||||||
'Login',
|
'Login',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
SizedBox(height: size.height*0.03),
|
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: smallTextStyle,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10,),
|
const SizedBox(height: 10,),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
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: SizedBox(
|
||||||
width: size.width * 0.11,
|
width: size.width * 0.11,
|
||||||
child: const Align(
|
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),
|
style: TextStyle(fontSize: 14),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
style: const TextStyle(color: Colors.black),
|
style: const TextStyle(color: Colors.black),
|
||||||
items:loginBloc.regions.map((String region) {
|
items:loginBloc.regions.map((String region) {
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
value: region,
|
value: region,
|
||||||
child: Text(region),
|
child: Text(region),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (String? value) {
|
onChanged: (String? value) {
|
||||||
print(value);
|
print(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20.0),
|
const SizedBox(height: 20.0),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Email",
|
Text("Email",
|
||||||
style: smallTextStyle,
|
style: smallTextStyle,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator:loginBloc.validateEmail ,
|
validator:loginBloc.validateEmail ,
|
||||||
controller:loginBloc.loginEmailController,
|
controller:loginBloc.loginEmailController,
|
||||||
decoration: textBoxDecoration()!.copyWith(hintText: 'Enter your email'),
|
decoration: textBoxDecoration()!.copyWith(hintText: 'Enter your email'),
|
||||||
style: const TextStyle(color: Colors.black),
|
style: const TextStyle(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20.0),
|
const SizedBox(height: 20.0),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -254,7 +275,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(
|
||||||
@ -304,12 +325,12 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15.0),
|
const SizedBox(height: 15.0),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [ SizedBox(child: Text(loginBloc.validate,
|
children: [ SizedBox(child: Text(loginBloc.validate,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)],)
|
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)],)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -318,7 +339,7 @@ class LoginWebPage extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
),),
|
),),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user