-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hirosume
committed
Dec 4, 2019
1 parent
9e0579e
commit 95b68c7
Showing
7 changed files
with
239 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_app/components/SizeRoute.dart'; | ||
import 'package:flutter_app/screens/LoginScreen.dart'; | ||
import 'package:flutter_app/screens/RegisterScreen.dart'; | ||
|
||
import 'CustomInput.dart'; | ||
|
||
class RegisterForm extends StatefulWidget { | ||
@override | ||
State<StatefulWidget> createState() { | ||
return _RegisterFormState(); | ||
} | ||
} | ||
|
||
class _RegisterFormState extends State<RegisterForm> { | ||
final _formKey = GlobalKey<FormState>(); | ||
final _passwordController = TextEditingController(); | ||
@override | ||
Widget build(BuildContext context) { | ||
return Form( | ||
key: _formKey, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Text( | ||
'REGISTER SCREEN', | ||
style: TextStyle( | ||
fontSize: 22, fontWeight: FontWeight.w500, letterSpacing: 1.0), | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 20), | ||
), | ||
CustomInput( | ||
labelText: 'Username', | ||
validator: (String value) { | ||
if (value.isEmpty) { | ||
return 'Please enter your username.'; | ||
} | ||
return null; | ||
}, | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10), | ||
), | ||
CustomInput( | ||
labelText: 'Password', | ||
obscure: true, | ||
controller: _passwordController, | ||
validator: (String value) { | ||
if (value.isEmpty) { | ||
return 'Please enter your password.'; | ||
} | ||
return null; | ||
}, | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10), | ||
), | ||
CustomInput( | ||
labelText: 'Confirm Password', | ||
obscure: true, | ||
validator: (String value) { | ||
if (value.isEmpty) { | ||
return 'Please enter your password.'; | ||
} | ||
if(value != _passwordController.text) { | ||
return 'Confirm password must be match password'; | ||
} | ||
return null; | ||
}, | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 20), | ||
), | ||
ButtonTheme( | ||
minWidth: 240, | ||
height: 50, | ||
child: RaisedButton( | ||
onPressed: () { | ||
if (_formKey.currentState.validate()) { | ||
Scaffold.of(context) | ||
.showSnackBar(SnackBar(content: Text('Processing Data'))); | ||
} | ||
}, | ||
child: Text( | ||
'Login', | ||
style: Theme | ||
.of(context) | ||
.textTheme | ||
.button, | ||
), | ||
), | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(top: 10), | ||
), | ||
InkWell( | ||
child: Text( | ||
'Do you have a account ?', | ||
style: Theme | ||
.of(context) | ||
.textTheme | ||
.display1, | ||
), | ||
onTap: () { | ||
Navigator.of(context).pop(); | ||
Navigator.of(context).push(SizeRoute(page: LoginScreen())); | ||
}, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class SizeRoute extends PageRouteBuilder { | ||
final Widget page; | ||
|
||
SizeRoute({this.page}) | ||
: super( | ||
pageBuilder: ( | ||
BuildContext context, | ||
Animation<double> animation, | ||
Animation<double> secondaryAnimation, | ||
) => | ||
page, | ||
transitionsBuilder: ( | ||
BuildContext context, | ||
Animation<double> animation, | ||
Animation<double> secondaryAnimation, | ||
Widget child, | ||
) => | ||
Align( | ||
child: SizeTransition( | ||
sizeFactor: animation, | ||
child: child, | ||
), | ||
), | ||
); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_app/components/RegisterForm.dart'; | ||
|
||
class RegisterScreen extends StatefulWidget { | ||
@override | ||
State<StatefulWidget> createState() { | ||
return _RegisterState(); | ||
} | ||
} | ||
|
||
class _RegisterState extends State<RegisterScreen> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: Padding( | ||
padding: EdgeInsets.only(left: 10.0, right: 10.0), | ||
child: RegisterForm(), | ||
), | ||
), | ||
); | ||
} | ||
} |