Skip to content

Instantly share code, notes, and snippets.

@seklyza
Last active June 30, 2018 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seklyza/f806fa8407d2f747d6434d21e49671e5 to your computer and use it in GitHub Desktop.
Save seklyza/f806fa8407d2f747d6434d21e49671e5 to your computer and use it in GitHub Desktop.
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