Professional Documents
Culture Documents
PDM U3 AI7 MartínezRamírez Israel
PDM U3 AI7 MartínezRamírez Israel
INGENIERIA DE SOFTWARE
MATRÍCULA: 2030494
UNIDAD DE APRENDIZAJE:
ACTIVIDAD DE APRENDIZAJE:
AI7. Creación de un Login Page | Buzón.
FECHA DE ENTREGA
23 DE OCTUBRE 2022
1. Código.
2. import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(MyApp());
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text("Formulario"),
centerTitle: true,
),
body: ListView(
children: [
Column(
children: [
Center(
child: Container(
height: 80,
width: 80,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new
DecorationImage(
image: new
NetworkImage("https://i.pinimg.com/564x/ac/95/1a/a
c951a6b30df48534984de9fdece79e6.jpg"),
fit: BoxFit.fill)),
),
),
Divider(
color: Colors.green,
indent: 2.0,
endIndent: 2.0,
),
Padding(
padding: EdgeInsets.only(left:
30.0, right: 30.0),
),
Form(
key: _formKey,
//autovalidateMode: validator,
child: Column(
children: [
TextFormField(
decoration:
InputDecoration(labelText: "Nombre"),
keyboardType:
TextInputType.text,
onFieldSubmitted: (value)
{
//Validator
},
validator: (value) {
if (value == null ||
!RegExp(r'(^[a-zA-Z
]*$)').hasMatch(value!)) {
return 'Nombre
incorrecto';
}
return null;
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText: "Apellido Paterno"),
keyboardType:
TextInputType.text,
onFieldSubmitted: (value)
{
//Validator
},
validator: (value) {
if (value == null ||
!RegExp(r'(^[a-zA-Z
]*$)').hasMatch(value!)) {
return 'Apellido
Paterno incorrecto';
}
return null;
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText: "Apellido Materno"),
keyboardType:
TextInputType.text,
onFieldSubmitted: (value)
{
//Validator
},
validator: (value) {
if (value == null ||
!RegExp(r'(^[a-zA-Z
]*$)').hasMatch(value!)) {
return 'Apellido
Materno incorrecto';
}
return null;
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText: "E-mail"),
keyboardType:
TextInputType.emailAddress,
onFieldSubmitted: (value)
{
//Validator
},
validator: (value) {
if (value == null ||
!RegExp(r"^[a-zA-Z0-
9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-
9]+\.[a-zA-Z]+")
.hasMatch(value!)) {
return 'Ingrese un
correo valido!';
}
return null;
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText: "Teléfono Celular"),
keyboardType:
TextInputType.emailAddress,
onFieldSubmitted: (value)
{
//Validator
},
validator: (value) {
if (value == null ||
!RegExp(r"^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-
9]*$")
.hasMatch(value!)) {
return 'Ingrese solo
números!';
}
return null;
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText: "Contraseña"),
keyboardType:
TextInputType.text,
onFieldSubmitted: (value)
{
//Validator
},
),
Padding(
padding:
EdgeInsets.only(top: 2, bottom: 2),
),
TextFormField(
decoration:
InputDecoration(labelText:
"Ingrese Contraseña Valida"),
keyboardType:
TextInputType.text,
onFieldSubmitted: (value)
{
//Validator
},
),
],
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
MaterialButton(
child: Text("Login"),
color: Colors.blueAccent,
onPressed: () {
if
(_formKey.currentState!.validate()) {
ScaffoldMessenger.of(context).showSnackBar(
const
SnackBar(content: Text('Processing Data')),
);
}
},
),
],
),
],
)
],
));
}
_MailValidator(String value) {
return value.contains("@") == false ? "Not a
valid Email" : null;
}
ScaffoldMessenger.of(context).showSnackBar(snackBa
r);
}
}
2. Validaciones.