Brak opisu

welcome.dart 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. import 'package:flutter_login/flutter_login.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:google_fonts/google_fonts.dart';
  4. import 'register.dart';
  5. class WelcomePage extends StatefulWidget {
  6. WelcomePage({Key key, this.title}) : super(key: key);
  7. final String title;
  8. @override
  9. _WelcomePageState createState() => _WelcomePageState();
  10. }
  11. class _WelcomePageState extends State<WelcomePage> {
  12. TextEditingController email;
  13. TextEditingController password;
  14. Widget _message(BuildContext context){
  15. return RichText(
  16. textAlign: TextAlign.center,
  17. text: TextSpan(
  18. text: "Don't have an account?",
  19. style: GoogleFonts.cabin(
  20. fontSize: 18,
  21. color: Colors.black
  22. )
  23. ),
  24. );
  25. }
  26. Widget _title(BuildContext context){
  27. return RichText(
  28. textAlign: TextAlign.center,
  29. text: TextSpan(
  30. text: "Welcome to FastMed",
  31. style: GoogleFonts.cabin(
  32. fontSize: 30,
  33. color: Colors.red
  34. )
  35. ),
  36. );
  37. }
  38. Widget _LoginField(String title, TextEditingController controller, {bool pass = false}){
  39. return Container(
  40. padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
  41. child: Column(
  42. crossAxisAlignment: CrossAxisAlignment.start,
  43. children: <Widget> [
  44. Text(
  45. title,
  46. style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
  47. ),
  48. SizedBox(
  49. height: 30
  50. ),
  51. TextField(
  52. controller: controller,
  53. obscureText: pass,
  54. decoration: InputDecoration(
  55. border: (
  56. UnderlineInputBorder(
  57. )
  58. ),
  59. ),
  60. ),
  61. ]
  62. ),
  63. );
  64. }
  65. Widget _Fills(){
  66. return Column(
  67. children: <Widget> [
  68. _LoginField("Email", email),
  69. _LoginField("Password", password, pass: true),
  70. ]
  71. );
  72. }
  73. // Widget _LogInButton(BuildContext context){
  74. // return InkWell(
  75. // // onTap: () {
  76. // // Navigator.push(context, MaterialPageRoute(builder: (context)) => __LoginPage())
  77. // // },
  78. // child: Container(
  79. // // width: MediaQuery.of(context).size.width,
  80. // width: 200,
  81. // // height: ,
  82. // padding: EdgeInsets.symmetric(vertical:8),
  83. // alignment: Alignment.center,
  84. // decoration: BoxDecoration(
  85. // color: Colors.red,
  86. // // shape:
  87. //
  88. // borderRadius: BorderRadius.circular(30),
  89. // ),
  90. // child: Text(
  91. // "Login",
  92. // style: TextStyle(fontSize: 25, color: Colors.white),
  93. // ),
  94. //
  95. // )
  96. // );
  97. // }
  98. Widget _RegisterButton(BuildContext context){
  99. return InkWell(
  100. onTap: () {
  101. Navigator.push(
  102. context, MaterialPageRoute(builder: (context) => RegisterPage()));
  103. },
  104. child: Container(
  105. // width: MediaQuery.of(context).size.width,
  106. width: 180,
  107. padding: EdgeInsets.symmetric(vertical:8),
  108. alignment: Alignment.center,
  109. decoration: BoxDecoration(
  110. color: Colors.red,
  111. // shape:
  112. borderRadius: BorderRadius.circular(30),
  113. ),
  114. child: Text(
  115. "Register",
  116. style: TextStyle(fontSize: 22, color: Colors.white),
  117. ),
  118. )
  119. );
  120. }
  121. @override
  122. Widget build(BuildContext context) {
  123. final height = MediaQuery.of(context).size.height;
  124. return Scaffold(
  125. body: Container(
  126. height: height,
  127. child:Container(
  128. width: MediaQuery.of(context).size.width,
  129. padding: EdgeInsets.symmetric(horizontal: 20),
  130. // height: MediaQuery.of(context).size.height,
  131. decoration: BoxDecoration(
  132. borderRadius: BorderRadius.all(Radius.circular(4)),
  133. boxShadow: [
  134. BoxShadow(
  135. color: Colors.white,
  136. offset: Offset(0,3),
  137. blurRadius: 5,
  138. spreadRadius: 2)
  139. ]
  140. ),
  141. child: SingleChildScrollView(
  142. child: Column(
  143. crossAxisAlignment: CrossAxisAlignment.center,
  144. mainAxisAlignment: MainAxisAlignment.center,
  145. children: <Widget> [
  146. SizedBox(
  147. height: 80,
  148. ),
  149. _title(context),
  150. SizedBox(
  151. height: 150,
  152. ),
  153. // _LogInButton(context),
  154. _Fills(),
  155. SizedBox(
  156. height: 60,
  157. ),
  158. _message(context),
  159. SizedBox(
  160. height: 10,
  161. ),
  162. _RegisterButton(context),
  163. SizedBox(
  164. height: 10,
  165. )
  166. ],
  167. )
  168. ),
  169. ),
  170. )
  171. );
  172. }
  173. }