fix: add validation form email
This commit is contained in:
parent
4461b78565
commit
59e046bd92
|
@ -15,41 +15,71 @@ import 'package:provider/provider.dart';
|
||||||
class SubmitEmail extends StatelessWidget {
|
class SubmitEmail extends StatelessWidget {
|
||||||
const SubmitEmail({Key? key}) : super(key: key);
|
const SubmitEmail({Key? key}) : super(key: key);
|
||||||
|
|
||||||
Widget _emailVerify() {
|
Widget _emailVerify(BuildContext context, SubmissionDataViewModel provider) {
|
||||||
return Column(
|
var textTheme = Theme.of(context).textTheme;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(24.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
const TextCaption(title: 'Check your e-mail'),
|
||||||
const ImageView(image: PathAssets.imgEmail),
|
const ImageView(image: PathAssets.imgEmail),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: RichText(
|
child: RichText(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
text: TextSpan(children: [
|
text: TextSpan(children: [
|
||||||
const TextSpan(
|
TextSpan(
|
||||||
text:
|
text:
|
||||||
'We have sent a verification link to your e-mail. \nPlease check your email for ',
|
'We have sent a verification link to your e-mail. \nPlease check your email for ',
|
||||||
style: TextStyle(
|
style: textTheme.displayMedium,
|
||||||
color: Colors.black,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
recognizer: TapGestureRecognizer()..onTap = () {},
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () async {
|
||||||
|
await provider.next(context).then((value) {
|
||||||
|
if (value) {
|
||||||
|
routePush(context, page: const SubmissionParent());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
text: 'verification',
|
text: 'verification',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const TextSpan(
|
TextSpan(
|
||||||
text: ' to \ncontinue registration.',
|
text: ' to \ncontinue registration.',
|
||||||
style: TextStyle(
|
style: textTheme.displayMedium,
|
||||||
color: Colors.black,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
showEmailVerify(BuildContext context, SubmissionDataViewModel provider) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
enableDrag: false,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.vertical(
|
||||||
|
top: Radius.zero,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
builder: (context) {
|
||||||
|
var flutterView = View.of(context);
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: MediaQueryData.fromView(flutterView).padding.top,
|
||||||
|
),
|
||||||
|
child: _emailVerify(context, provider),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,16 +90,16 @@ class SubmitEmail extends StatelessWidget {
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
return Consumer<SubmissionDataViewModel>(
|
return Consumer<SubmissionDataViewModel>(
|
||||||
builder: (context, provider, child) {
|
builder: (context, provider, child) {
|
||||||
return SingleChildScrollView(
|
return SizedBox(
|
||||||
|
height: SizeConfig.height * .78,
|
||||||
|
child: Form(
|
||||||
|
key: provider.formKeySubmitEmail,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
!provider.isEmailVerify
|
const TextCaption(title: 'Enter your e-mail'),
|
||||||
? const TextCaption(title: 'Enter your e-mail')
|
TextFormView(
|
||||||
: const TextCaption(title: 'Check your e-mail '),
|
|
||||||
!provider.isEmailVerify
|
|
||||||
? TextFormView(
|
|
||||||
name: 'E-mail Address',
|
name: 'E-mail Address',
|
||||||
hintText: 'Input e-mail address',
|
hintText: 'Input e-mail address',
|
||||||
keyboardType: TextInputType.emailAddress,
|
keyboardType: TextInputType.emailAddress,
|
||||||
|
@ -82,24 +112,20 @@ class SubmitEmail extends StatelessWidget {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// onTap: () {
|
),
|
||||||
// provider.submitEmail();
|
SizedBox(height: SizeConfig.height * .43),
|
||||||
// },
|
|
||||||
)
|
|
||||||
: _emailVerify(),
|
|
||||||
SizedBox(height: SizeConfig.height * .42),
|
|
||||||
ButtonView(
|
ButtonView(
|
||||||
name: 'Next',
|
name: 'Next',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await provider.next(context).then((value) {
|
if (provider.formKeySubmitEmail.currentState!
|
||||||
if (value) {
|
.validate()) {
|
||||||
routePush(context, page: const SubmissionParent());
|
showEmailVerify(context, provider);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user