Subiendo actividades

parent 48bb5d54
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 myWidget extends StatelessWidget {
const myWidget({super.key});
class MyWidget extends StatelessWidget {
const MyWidget({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
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
body: Column(children: []), // Va a tener varios hijos
);
}
}
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(),
};
}
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'),
),
);
}
......
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
);
}
}
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'),
),
],
),
),
);
}
}
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment