Geen omschrijving

register.dart 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import 'package:flutter_login/flutter_login.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:google_fonts/google_fonts.dart';
  4. //
  5. //Still to add:
  6. // Email verification, that the input has "@" and "."
  7. // Send email and password to database
  8. //
  9. //
  10. //
  11. class RegisterPage extends StatefulWidget{
  12. RegisterPage({Key key, this.title}) : super(key: key);
  13. final String title;
  14. @override
  15. _RegisterPageState createState() => _RegisterPageState();
  16. }
  17. class _RegisterPageState extends State<RegisterPage> {
  18. TextEditingController email;
  19. TextEditingController password;
  20. TextEditingController confirmpass;
  21. // Future<List> send_data() async {
  22. // final data = await
  23. // }
  24. String _SamePass(){
  25. if(password == confirmpass){
  26. return "Same password";
  27. }
  28. else{
  29. return "Different passwords";
  30. }
  31. }
  32. Widget _BackButton(BuildContext context){
  33. return InkWell(
  34. onTap: (){
  35. Navigator.pop(context);
  36. },
  37. child: Row(
  38. children: <Widget>[
  39. Container(
  40. padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
  41. child: Icon(Icons.arrow_back_ios, color: Colors.black),
  42. ),
  43. Text("Back",
  44. style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500))
  45. ]
  46. ),
  47. );
  48. }
  49. Widget _SubmitButton(BuildContext context){
  50. return InkWell(
  51. onTap: (){
  52. },
  53. child: Container(
  54. padding: EdgeInsets.symmetric(vertical: 10),
  55. width: 250,
  56. alignment: Alignment.center,
  57. decoration: BoxDecoration(
  58. color: Colors.red,
  59. borderRadius: BorderRadius.circular(30),
  60. ),
  61. child: Text(
  62. "Submit",
  63. style: TextStyle(fontSize: 22, color: Colors.white),
  64. ),
  65. ),
  66. );
  67. }
  68. Widget _EntryField(String title, TextEditingController controller, {bool pass = false}){
  69. return Container(
  70. padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
  71. child: Column(
  72. crossAxisAlignment: CrossAxisAlignment.start,
  73. children: <Widget> [
  74. Text(
  75. title,
  76. style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
  77. ),
  78. SizedBox(
  79. height: 30
  80. ),
  81. TextField(
  82. controller: controller,
  83. obscureText: pass,
  84. decoration: InputDecoration(
  85. border: (
  86. UnderlineInputBorder()
  87. ),
  88. ),
  89. )
  90. ]
  91. ),
  92. );
  93. }
  94. Widget _Fills(){
  95. return Column(
  96. children: <Widget> [
  97. _EntryField("Email", email),
  98. _EntryField("Password", password, pass: true),
  99. _EntryField("Confirm Password", confirmpass, pass: true)
  100. ]
  101. );
  102. }
  103. //add column or stack
  104. @override
  105. Widget build(BuildContext context) {
  106. final height = MediaQuery.of(context).size.height;
  107. return Scaffold(
  108. body: Container(
  109. height: height,
  110. child: Stack(
  111. children: <Widget>[
  112. Container(
  113. padding: EdgeInsets.symmetric(horizontal: 20),
  114. child: SingleChildScrollView(
  115. child: Column(
  116. crossAxisAlignment: CrossAxisAlignment.center,
  117. mainAxisAlignment: MainAxisAlignment.center,
  118. children: <Widget>[
  119. SizedBox(
  120. height: 200,
  121. ),
  122. _Fills(),
  123. //Add code to verify if password and confirm password match
  124. SizedBox(
  125. height: 20,
  126. ),
  127. _SubmitButton(context),
  128. ],
  129. ),
  130. )
  131. ),
  132. Positioned(
  133. top: 12, left: 20, child: _BackButton(context),
  134. ),
  135. ],
  136. ),
  137. )
  138. );
  139. }
  140. }