forked from dienianindya/gsi_ess_mobile
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.
120 lines
3.8 KiB
120 lines
3.8 KiB
import 'package:flutter/material.dart';
|
|
import 'dart:developer' as logDev;
|
|
|
|
class InputWidgetEmail extends StatelessWidget {
|
|
final double topRight;
|
|
final double bottomRight;
|
|
|
|
InputWidgetEmail(this.topRight, this.bottomRight);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.only(right: 40, bottom: 20),
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width - 40,
|
|
child: Material(
|
|
elevation: 10,
|
|
color: Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.only(
|
|
bottomRight: Radius.circular(bottomRight),
|
|
topRight: Radius.circular(topRight))),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 25, right: 20, top: 10, bottom: 10),
|
|
child: TextFormField(
|
|
controller: emailController,
|
|
keyboardType: TextInputType.emailAddress,
|
|
textInputAction: TextInputAction.next,
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none,
|
|
prefixIcon: Icon(Icons.person),
|
|
prefixIconConstraints: BoxConstraints(
|
|
minWidth: 40,
|
|
minHeight: 40,
|
|
),
|
|
hintText: "hris_selfservice@example.com",
|
|
hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16)),
|
|
validator: (text) {
|
|
if (text!.contains('@') && text.isNotEmpty) {
|
|
return "Enter a valid email address!";
|
|
} else if (text.isEmpty) {
|
|
return "Email Required";
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class InputWidgetPassword extends StatelessWidget {
|
|
final double topRight;
|
|
final double bottomRight;
|
|
|
|
InputWidgetPassword(this.topRight, this.bottomRight);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.only(right: 40, bottom: 30),
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width - 40,
|
|
child: Material(
|
|
elevation: 10,
|
|
color: Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.only(
|
|
bottomRight: Radius.circular(bottomRight),
|
|
topRight: Radius.circular(topRight))),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 25, right: 20, top: 10, bottom: 10),
|
|
child: TextFormField(
|
|
controller: passwordController,
|
|
textInputAction: TextInputAction.done,
|
|
obscureText: true,
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none,
|
|
prefixIcon: Icon(Icons.lock),
|
|
prefixIconConstraints: BoxConstraints(
|
|
minWidth: 40,
|
|
minHeight: 40,
|
|
),
|
|
hintText: "Password",
|
|
hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16)),
|
|
validator: (text) {
|
|
if (text == null) {
|
|
return "Password Required";
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
TextEditingController emailController = TextEditingController();
|
|
TextEditingController passwordController = TextEditingController();
|
|
|
|
/*bool validate() {
|
|
bool result = true;
|
|
if (emailController.text.contains('@') && emailController.text.isNotEmpty) {
|
|
emailController. "Enter a valid email address!";
|
|
result = false;
|
|
} else if (emailValue.isEmpty) {
|
|
return "Email Required";
|
|
}
|
|
|
|
if (passwordController.text == null) {
|
|
return "Password Required";
|
|
}
|
|
|
|
return
|
|
null;
|
|
}*/
|