Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
primera_practica
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yenisleydi Benitez Martinez
primera_practica
Commits
e65ec0b1
Commit
e65ec0b1
authored
Jul 31, 2024
by
yenisleydi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formulario, definicion de rutas y navegacion
parent
39733683
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
22 deletions
+77
-22
logo_visorus.jpg
assets/img/logo_visorus.jpg
+0
-0
main.dart
lib/main.dart
+9
-9
routes.dart
lib/src/config/routes.dart
+12
-0
articles_page.dart
lib/src/pages/articles_page.dart
+2
-2
home_page.dart
lib/src/pages/home_page.dart
+17
-5
login_page.dart
lib/src/pages/login_page.dart
+35
-5
pubspec.yaml
pubspec.yaml
+2
-1
No files found.
assets/img/logo_visorus.jpg
0 → 100644
View file @
e65ec0b1
4.34 KB
lib/main.dart
View file @
e65ec0b1
import
'package:flutter/material.dart'
;
import
'package:primer_practica/src/pages/login_page.dart'
;
import
'package:primer_practica/src/pages/home_page.dart'
;
import
'package:primer_practica/src/pages/articles_page.dart'
;
import
'package:primer_practica/src/config/routes.dart'
;
void
main
(
)
{
runApp
(
const
MyApp
());
}
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'Primer practica'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
),
initialRoute:
'login'
,
// Establece la ruta inicial
debugShowCheckedModeBanner:
false
,
title:
'Primera practica'
,
routes:
{
'login'
:
(
_
)
=>
ArticlesPage
(),
},
initialRoute:
'login'
,
routes:
getApplicationRoutes
(),
// Usa las rutas definidas
);
}
}
lib/src/config/routes.dart
0 → 100644
View file @
e65ec0b1
import
'package:flutter/material.dart'
;
import
'package:primer_practica/src/pages/login_page.dart'
;
import
'package:primer_practica/src/pages/home_page.dart'
;
import
'package:primer_practica/src/pages/articles_page.dart'
;
Map
<
String
,
WidgetBuilder
>
getApplicationRoutes
()
{
return
<
String
,
WidgetBuilder
>{
'login'
:
(
BuildContext
context
)
=>
const
LoginPage
(),
'home'
:
(
BuildContext
context
)
=>
const
HomePage
(),
'articles'
:
(
BuildContext
context
)
=>
const
ArticlesPage
(),
};
}
lib/src/pages/articles_page.dart
View file @
e65ec0b1
import
'package:flutter/material.dart'
;
class
ArticlesPage
extends
StatelessWidget
{
const
ArticlesPage
({
Key
?
key
})
:
super
(
key:
key
);
const
ArticlesPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -10,7 +10,7 @@ class ArticlesPage extends StatelessWidget {
title:
const
Text
(
'Articles Page'
),
),
body:
const
Center
(
child:
Text
(
'Hola articles
_
page'
),
child:
Text
(
'Hola articles
page'
),
),
);
}
...
...
lib/src/pages/home_page.dart
View file @
e65ec0b1
import
'package:flutter/material.dart'
;
class
HomePage
extends
StatelessWidget
{
const
HomePage
({
Key
?
key
})
:
super
(
key:
key
);
const
HomePage
({
Key
?
key
})
:
super
(
key:
key
);
// Constructor
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Home Page'
),
appBar:
AppBar
(
// Barra de aplicaciones
title:
const
Text
(
'Home Page'
),
// Título de la barra
),
body:
Center
(
// Centra el contenido
child:
Column
(
// Dispone los hijos en una columna
mainAxisAlignment:
MainAxisAlignment
.
center
,
// Centra verticalmente
children:
[
// Lista de hijos
const
Text
(
'Hola home page'
),
// Texto
const
SizedBox
(
height:
20
),
// Tamaño del texto
ElevatedButton
(
// Botón
onPressed:
()
{
// Acción al presionar
Navigator
.
pushNamed
(
context
,
'articles'
);
// Navega a 'articles'
},
child:
const
Text
(
'Ir a Articles Page'
),
// Texto del botón
),
],
),
body:
const
Center
(
child:
Text
(
'Hola home_page'
),
),
);
}
...
...
lib/src/pages/login_page.dart
View file @
e65ec0b1
import
'package:flutter/material.dart'
;
class
LoginPage
extends
StatelessWidget
{
const
LoginPage
({
Key
?
key
})
:
super
(
key:
key
);
const
LoginPage
({
Key
?
key
})
:
super
(
key:
key
);
// Constructor
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Login Page'
),
appBar:
AppBar
(
// Barra de aplicaciones en la parte superior
title:
const
Text
(
'Login Page'
),
// Título de la barra
),
body:
Padding
(
// Espacia el contenido del cuerpo
padding:
const
EdgeInsets
.
all
(
180.0
),
// Padding alrededor del contenido
child:
Center
(
// Centra el contenido en la pantalla
child:
Column
(
// Organiza los widgets en una columna vertical
mainAxisAlignment:
MainAxisAlignment
.
center
,
// Centra verticalmente
children:
[
// Lista de widgets en la columna
Image
.
asset
(
'assets/img/logo_visorus.jpg'
,
height:
100
),
// Muestra el logo con altura de 100
const
SizedBox
(
height:
80
),
// Espacio de 80 píxeles entre el logo y el primer campo de texto
TextField
(
// Campo de texto para el usuario
decoration:
const
InputDecoration
(
labelText:
'Usuario'
,
// Etiqueta del campo de texto
border:
OutlineInputBorder
(),
// Borde del campo de texto
),
),
const
SizedBox
(
height:
20
),
// Espacio de 20 píxeles entre los campos de texto
TextField
(
// Campo de texto para la contraseña
obscureText:
true
,
// Oculta el texto introducido
decoration:
const
InputDecoration
(
labelText:
'Contraseña'
,
// Etiqueta del campo de texto
border:
OutlineInputBorder
(),
// Borde del campo de texto
),
),
const
SizedBox
(
height:
20
),
// Espacio de 20 píxeles antes del botón
ElevatedButton
(
onPressed:
()
{
// Acción al presionar el botón
Navigator
.
pushNamed
(
context
,
'home'
);
// Navega a la página 'home'
},
child:
const
Text
(
'Acceder'
),
// Texto del botón
),
],
),
),
body:
const
Center
(
child:
Text
(
'Hola login_page'
),
),
);
}
...
...
pubspec.yaml
View file @
e65ec0b1
...
...
@@ -57,7 +57,8 @@ flutter:
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design
:
true
assets
:
-
assets/img/
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment