Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2021
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class LoginScreen extends StatefulWidget {
  4. const LoginScreen({ Key? key }) : super(key: key);
  5.  
  6. @override
  7. _LoginScreenState createState() => _LoginScreenState();
  8. }
  9.  
  10. class _LoginScreenState extends State<LoginScreen> {
  11. // form key
  12. final _formKey = GlobalKey<FormState>();
  13.  
  14. // Editing Controller
  15. final TextEditingController emailController = new TextEditingController();
  16. final TextEditingController passwordController = new TextEditingController();
  17. final TextEditingController locationController = new TextEditingController();
  18.  
  19. @override
  20. Widget build(BuildContext context) {
  21.  
  22. //Name field
  23. final emailField = TextFormField(
  24. autofocus: false,
  25. controller: emailController,
  26. keyboardType: TextInputType.emailAddress,
  27. //validator: {} {},
  28. onSaved: (value)
  29. {
  30. emailController.text = value!;
  31.  
  32. },
  33. textInputAction: TextInputAction.next,
  34. decoration: InputDecoration(
  35. prefixIcon: Icon(Icons.account_circle_outlined),
  36. contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  37. hintText: "Вашето име",
  38. border: OutlineInputBorder(
  39. borderRadius: BorderRadius.circular(20),
  40. ),
  41. ),
  42. );
  43.  
  44. //password field
  45. final passwordField = TextFormField(
  46. autofocus: false,
  47. controller: passwordController,
  48. //validator: {} {},
  49. onSaved: (value)
  50. {
  51. passwordController.text = value!;
  52.  
  53. },
  54. textInputAction: TextInputAction.next,
  55. decoration: InputDecoration(
  56. prefixIcon: Icon(Icons.call_end_outlined),
  57. contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  58. hintText: "Вашиот телефонски број",
  59. border: OutlineInputBorder(
  60. borderRadius: BorderRadius.circular(20),
  61. ),
  62. ),
  63. );
  64.  
  65. //Location field
  66. final locationField = TextFormField(
  67. autofocus: false,
  68. controller: locationController,
  69.  
  70. //validator: {} {},
  71. onSaved: (value)
  72. {
  73. locationController.text = value!;
  74.  
  75. },
  76. textInputAction: TextInputAction.done,
  77. decoration: InputDecoration(
  78. prefixIcon: Icon(Icons.add_location_alt_outlined),
  79. contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  80. hintText: "Вашата локација",
  81. border: OutlineInputBorder(
  82. borderRadius: BorderRadius.circular(20),
  83.  
  84. ),
  85. )),
  86.  
  87. // button
  88.  
  89. loginButton = Material(
  90. elevation: 5,
  91. borderRadius: BorderRadius.circular(30),
  92. color: Colors.redAccent,
  93. child: MaterialButton(
  94. padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
  95. minWidth: MediaQuery.of(context).size.width,
  96. onPressed: () {},
  97. child: Text(
  98. "Логирање",
  99. textAlign: TextAlign.center,
  100. style: TextStyle(fontSize: 20,
  101. color: Colors.white,
  102. fontWeight: FontWeight.bold,
  103. ),
  104. ),
  105. ),
  106. );
  107.  
  108. return Scaffold(
  109. backgroundColor: Colors.white,
  110. body: Center(
  111. child: SingleChildScrollView(
  112. child: Container(
  113. color: Colors.white,
  114. child: Padding(
  115. padding: const EdgeInsets.all(35.0),
  116. child: Form(
  117. key: _formKey,
  118. child: Column(
  119. mainAxisAlignment: MainAxisAlignment.center,
  120. crossAxisAlignment: CrossAxisAlignment.center,
  121. children: <Widget> [
  122. SizedBox(
  123. height: 250,
  124.  
  125. child: Image.asset(
  126. "assets/logo.png",
  127.  
  128. fit: BoxFit.contain,
  129. )
  130. ),
  131. SizedBox(
  132.  
  133.  
  134.  
  135. child: Image.asset(
  136. "assets/top.png",
  137.  
  138.  
  139.  
  140. fit: BoxFit.contain,
  141. )
  142. ),
  143.  
  144.  
  145.  
  146.  
  147. emailField,
  148. SizedBox(height: 30),
  149.  
  150. passwordField,
  151. SizedBox(height: 30),
  152.  
  153. locationField,
  154. SizedBox(height: 30),
  155. loginButton,
  156. SizedBox(height: 30),
  157. ],
  158. ),
  159. ),
  160. ),
  161. ),
  162. ) ,
  163. ),
  164. );
  165. }
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement