Breaking changes to OTT verification screens
This commit is contained in:
parent
ddb2c7dc82
commit
739c69da22
2 changed files with 31 additions and 8 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
@ -5,14 +7,22 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:photos/user_authenticator.dart';
|
||||
|
||||
class EmailEntryPage extends StatefulWidget {
|
||||
EmailEntryPage({Key key}) : super(key: key);
|
||||
final String email;
|
||||
|
||||
EmailEntryPage({this.email, Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EmailEntryPageState createState() => _EmailEntryPageState();
|
||||
}
|
||||
|
||||
class _EmailEntryPageState extends State<EmailEntryPage> {
|
||||
final _emailController = TextEditingController();
|
||||
String _email;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_email = widget.email;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -40,18 +50,23 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
|
|||
hintText: 'email@domain.com',
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
),
|
||||
controller: _emailController,
|
||||
initialValue: widget.email == null ? "" : widget.email,
|
||||
autofocus: true,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
onChanged: (email) {
|
||||
log(email);
|
||||
setState(() {
|
||||
_email = email;
|
||||
});
|
||||
},
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: RaisedButton(
|
||||
onPressed: () {
|
||||
UserAuthenticator.instance
|
||||
.getOtt(context, _emailController.text);
|
||||
UserAuthenticator.instance.getOtt(context, _email);
|
||||
},
|
||||
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
||||
child: Text("Sign In"),
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:photos/ui/email_entry_page.dart';
|
||||
import 'package:photos/user_authenticator.dart';
|
||||
|
||||
class OTTVerificationPage extends StatefulWidget {
|
||||
|
@ -89,16 +90,23 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
|
|||
},
|
||||
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
||||
child: Text(
|
||||
"Sign In",
|
||||
"Verify",
|
||||
),
|
||||
color: Colors.pink,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
),
|
||||
)),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return EmailEntryPage(email: widget.email);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
"Did not get email?",
|
||||
|
@ -106,7 +114,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
|
|||
decoration: TextDecoration.underline,
|
||||
fontSize: 12,
|
||||
),
|
||||
))
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue