Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
Practica_Flutter_E
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
Efren David Jimenez Martinez
Practica_Flutter_E
Commits
24fadfa6
Commit
24fadfa6
authored
Jul 31, 2024
by
Efren David Jimenez Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subiendo actividades
parent
48bb5d54
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
112 deletions
+84
-112
logo_visorus.jpg
assets/img/logo_visorus.jpg
+0
-0
main.dart
lib/main.dart
+16
-17
routes.dart
lib/src/config/routes.dart
+10
-6
articles_page.dart
lib/src/pages/articles_page.dart
+15
-15
home_page.dart
lib/src/pages/home_page.dart
+15
-38
login_page.dart
lib/src/pages/login_page.dart
+25
-35
pubspec.yaml
pubspec.yaml
+3
-1
No files found.
assets/img/logo_visorus.jpg
0 → 100644
View file @
24fadfa6
4.34 KB
lib/main.dart
View file @
24fadfa6
import
'package:flutter/material.dart'
;
import
'package:practica1_flutter/src/config/routes.dart'
;
import
'package:practica1_flutter/src/config/routes.dart'
;
// Importa el archivo de rutas
void
main
(
)
{
runApp
(
const
MyApp
());
...
...
@@ -13,34 +15,31 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner:
false
,
title:
'Flutter Demo'
,
theme:
ThemeData
(
colorScheme:
ColorScheme
.
fromSeed
(
seedColor:
Colors
.
deepPurple
),
useMaterial3:
true
,
),
home:
myWidget
(),
//home: myWidget() : Se quita la propiedad home para permitir la navegación basada en rutas
initialRoute:
'login'
,
// se define la ruta inicial
routes:
getApplicationRoutes
(),
// Se usa las rutas definidas en routes.dart y se quito el myWidget
);
}
}
class
m
yWidget
extends
StatelessWidget
{
const
m
yWidget
({
super
.
key
});
class
M
yWidget
extends
StatelessWidget
{
const
M
yWidget
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
//child: Text("Hola mundo")
appBar:
AppBar
(
//Barra que se encuentra en la parte superior
title:
Text
(
"Prueba AppBarsss"
),
//Agregar titulo en appBar
backgroundColor:
Colors
.
lightBlue
,
//Agregar color en la appBar
actions:
const
[
//Agregar iconos
Icon
(
Icons
.
search
),
Icon
(
Icons
.
menu
)
],
),
body:
Column
(
children:
[]),
//Va a tener varios hijos
appBar:
AppBar
(
// Barra que se encuentra en la parte superior
title:
Text
(
"Prueba flutter estamo en el main "
),
// Agregar titulo en appBar
backgroundColor:
Colors
.
lightBlue
,
// Agregar color en la appBar
actions:
const
[
// Agregar iconos
Icon
(
Icons
.
search
),
Icon
(
Icons
.
menu
)
],
),
body:
Column
(
children:
[]),
// Va a tener varios hijos
);
}
}
lib/src/config/routes.dart
View file @
24fadfa6
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:practica1_flutter/src/config/routes.dart'
;
import
'../pages/home_page.dart'
;
import
'../pages/login_page.dart'
;
import
'../pages/articles_page.dart'
;
Map
<
String
,
WidgetBuilder
>
getApplicationRoutes
(){
Map
<
String
,
WidgetBuilder
>
getApplicationRoutes
()
{
return
<
String
,
WidgetBuilder
>{
'login'
:
(
context
)=>
const
LoginPage
(),
'homeSeller'
:
(
context
)=>
const
HomeSellerPage
(),
'login'
:
(
BuildContext
context
)
=>
const
LoginPage
(),
'homeSeller'
:
(
BuildContext
context
)
=>
const
HomeSellerPage
(),
'articulos'
:
(
BuildContext
context
)
=>
const
ArticlesPage
(),
};
}
\ No newline at end of file
}
lib/src/pages/articles_page.dart
View file @
24fadfa6
import
'package:flutter/material.dart'
;
void
main
(
)
{
runApp
(
const
MyApp
());
}
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
class
ArticlesPage
extends
StatelessWidget
{
const
ArticlesPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'hola articles page '
,
theme:
ThemeData
(
colorScheme:
ColorScheme
.
fromSeed
(
seedColor:
Colors
.
deepPurple
),
useMaterial3:
true
,
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'Estoy en Articulos'
),
backgroundColor:
Colors
.
red
,
actions:
[
Center
(
child:
const
Icon
(
Icons
.
shop
),
)
],
),
body:
Center
(
child:
Text
(
'Bienvenido a los articulos'
),
),
);
}
}
\ No newline at end of file
}
lib/src/pages/home_page.dart
View file @
24fadfa6
import
'package:flutter/material.dart'
;
void
main
(
)
{
runApp
(
const
MyApp
());
}
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'Flutter Demo'
,
theme:
ThemeData
(
colorScheme:
ColorScheme
.
fromSeed
(
seedColor:
Colors
.
deepPurple
),
useMaterial3:
true
,
),
home:
myWidget
(),
);
}
}
class
myWidget
extends
StatelessWidget
{
const
myWidget
({
super
.
key
});
class
HomeSellerPage
extends
StatelessWidget
{
const
HomeSellerPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
//child: Text("Hola mundo")
appBar:
AppBar
(
//Barra que se encuentra en la parte superior
title:
Text
(
"hola mundo home page "
),
//Agregar titulo en appBar
backgroundColor:
Colors
.
lightBlue
,
//Agregar color en la appBar
actions:
const
[
//Agregar iconos
Icon
(
Icons
.
search
),
Icon
(
Icons
.
menu
)
],
appBar:
AppBar
(
title:
Text
(
'Estoy en Home'
),
backgroundColor:
Colors
.
green
,
),
body:
Center
(
child:
ElevatedButton
(
onPressed:
()
{
// Navega a la página 'homePage' cuando se presiona el botón.
Navigator
.
pushNamed
(
context
,
'articulos'
);
},
child:
Text
(
'Avanzar a Articulos'
),
),
),
body:
Column
(
children:
[]),
//Va a tener varios hijos
);
}
}
\ No newline at end of file
}
lib/src/pages/login_page.dart
View file @
24fadfa6
import
'package:flutter/material.dart'
;
void
main
(
)
{
runApp
(
const
MyApp
());
}
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'Flutter Demo'
,
theme:
ThemeData
(
colorScheme:
ColorScheme
.
fromSeed
(
seedColor:
Colors
.
deepPurple
),
useMaterial3:
true
,
),
home:
myWidget
(),
);
}
}
class
myWidget
extends
StatelessWidget
{
const
myWidget
({
super
.
key
});
class
LoginPage
extends
StatelessWidget
{
const
LoginPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
//child: Text("Hola mundo")
appBar:
AppBar
(
//Barra que se encuentra en la parte superior
title:
Text
(
"Hola mundo login page"
),
//Agregar titulo en appBar
backgroundColor:
Colors
.
lightBlue
,
//Agregar color en la appBar
actions:
const
[
//Agregar iconos
appBar:
AppBar
(
title:
const
Text
(
'Estoy en Login'
),
backgroundColor:
Colors
.
lightBlue
,
// Agregar color en la appBar
actions:
const
[
// Agregar iconos
Icon
(
Icons
.
search
),
Icon
(
Icons
.
menu
)
Icon
(
Icons
.
menu
)
,
],
),
body:
Column
(
children:
[]),
//Va a tener varios hijos
body:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
// Agrega la imagen local
Image
.
asset
(
'assets/img/logo_visorus.jpg'
,
height:
100
),
// Botón para navegar a la página 'homeSeller'
ElevatedButton
(
onPressed:
()
{
// Navega a la página 'homeSeller' cuando se presiona el botón.
Navigator
.
pushNamed
(
context
,
'homeSeller'
);
},
child:
const
Text
(
'Avanzar a Home'
),
),
],
),
),
);
}
}
\ No newline at end of file
}
pubspec.yaml
View file @
24fadfa6
name
:
practica1_flutter
description
:
"
A
new
Flutter
project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
...
...
@@ -57,7 +58,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