Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inputWidget.dart 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import 'package:flutter/material.dart';
  2. import 'dart:developer' as logDev;
  3. class InputWidgetEmail extends StatelessWidget {
  4. final double topRight;
  5. final double bottomRight;
  6. InputWidgetEmail(this.topRight, this.bottomRight);
  7. @override
  8. Widget build(BuildContext context) {
  9. return Padding(
  10. padding: EdgeInsets.only(right: 40, bottom: 20),
  11. child: Container(
  12. width: MediaQuery.of(context).size.width - 40,
  13. child: Material(
  14. elevation: 10,
  15. color: Colors.white,
  16. shape: RoundedRectangleBorder(
  17. borderRadius: BorderRadius.only(
  18. bottomRight: Radius.circular(bottomRight),
  19. topRight: Radius.circular(topRight))),
  20. child: Padding(
  21. padding: EdgeInsets.only(left: 25, right: 20, top: 10, bottom: 10),
  22. child: TextFormField(
  23. controller: emailController,
  24. keyboardType: TextInputType.emailAddress,
  25. textInputAction: TextInputAction.next,
  26. decoration: InputDecoration(
  27. border: InputBorder.none,
  28. prefixIcon: Icon(Icons.person),
  29. prefixIconConstraints: BoxConstraints(
  30. minWidth: 40,
  31. minHeight: 40,
  32. ),
  33. hintText: "username",
  34. hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16)),
  35. validator: (text) {
  36. if (text!.contains('@') && text.isNotEmpty) {
  37. return "Enter a valid email address!";
  38. } else if (text.isEmpty) {
  39. return "Email Required";
  40. }
  41. return null;
  42. },
  43. ),
  44. ),
  45. ),
  46. ),
  47. );
  48. }
  49. }
  50. class InputWidgetPassword extends StatelessWidget {
  51. final double topRight;
  52. final double bottomRight;
  53. InputWidgetPassword(this.topRight, this.bottomRight);
  54. @override
  55. Widget build(BuildContext context) {
  56. return Padding(
  57. padding: EdgeInsets.only(right: 40, bottom: 30),
  58. child: Container(
  59. width: MediaQuery.of(context).size.width - 40,
  60. child: Material(
  61. elevation: 10,
  62. color: Colors.white,
  63. shape: RoundedRectangleBorder(
  64. borderRadius: BorderRadius.only(
  65. bottomRight: Radius.circular(bottomRight),
  66. topRight: Radius.circular(topRight))),
  67. child: Padding(
  68. padding: EdgeInsets.only(left: 25, right: 20, top: 10, bottom: 10),
  69. child: TextFormField(
  70. controller: passwordController,
  71. textInputAction: TextInputAction.done,
  72. obscureText: true,
  73. decoration: InputDecoration(
  74. border: InputBorder.none,
  75. prefixIcon: Icon(Icons.lock),
  76. prefixIconConstraints: BoxConstraints(
  77. minWidth: 40,
  78. minHeight: 40,
  79. ),
  80. hintText: "Password",
  81. hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16)),
  82. validator: (text) {
  83. if (text == null) {
  84. return "Password Required";
  85. }
  86. return null;
  87. },
  88. ),
  89. ),
  90. ),
  91. ),
  92. );
  93. }
  94. }
  95. TextEditingController emailController = TextEditingController();
  96. TextEditingController passwordController = TextEditingController();
  97. /*bool validate() {
  98. bool result = true;
  99. if (emailController.text.contains('@') && emailController.text.isNotEmpty) {
  100. emailController. "Enter a valid email address!";
  101. result = false;
  102. } else if (emailValue.isEmpty) {
  103. return "Email Required";
  104. }
  105. if (passwordController.text == null) {
  106. return "Password Required";
  107. }
  108. return
  109. null;
  110. }*/