Last active
June 30, 2018 20:46
-
-
Save seklyza/f806fa8407d2f747d6434d21e49671e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class AuthPage extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return _AuthPageState(); | |
} | |
} | |
class _AuthPageState extends State<AuthPage> { | |
String _emailValue, _passwordValue; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Login'), | |
), | |
body: Container( | |
margin: EdgeInsets.all(10.0), | |
child: ListView( | |
children: <Widget>[ | |
TextField( | |
keyboardType: TextInputType.emailAddress, | |
autocorrect: false, | |
autofocus: true, | |
decoration: InputDecoration(labelText: 'Email'), | |
onChanged: (String value) { | |
setState(() { | |
_emailValue = value; | |
}); | |
}, | |
), | |
TextField( | |
obscureText: true, | |
autocorrect: false, | |
autofocus: true, | |
decoration: InputDecoration(labelText: 'Password'), | |
onChanged: (String value) { | |
setState(() { | |
_passwordValue = value; | |
}); | |
}, | |
), | |
SizedBox( | |
height: 10.0, | |
), | |
RaisedButton( | |
color: Theme.of(context).accentColor, | |
textColor: Colors.white, | |
child: Text('Login'), | |
onPressed: () { | |
print(_emailValue); | |
print(_passwordValue); | |
Navigator.pushReplacementNamed(context, '/products'); | |
}, | |
), | |
], | |
), | |
), | |
// body: Center( | |
// child: RaisedButton( | |
// child: Text('LOGIN'), | |
// onPressed: () { | |
// Navigator.pushReplacementNamed(context, '/products'); | |
// }, | |
// ), | |
// ), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment