Subiendo actividades

parent 48bb5d54
import 'package:flutter/material.dart'; 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() { void main() {
runApp(const MyApp()); runApp(const MyApp());
...@@ -13,34 +15,31 @@ class MyApp extends StatelessWidget { ...@@ -13,34 +15,31 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true, 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 { class MyWidget extends StatelessWidget {
const myWidget({super.key}); const MyWidget({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
//child: Text("Hola mundo") appBar: AppBar( // Barra que se encuentra en la parte superior
appBar: AppBar( //Barra que se encuentra en la parte superior title: Text("Prueba flutter estamo en el main "), // Agregar titulo en appBar
title: Text("Prueba AppBarsss"),//Agregar titulo en appBar backgroundColor: Colors.lightBlue, // Agregar color en la appBar
backgroundColor: Colors.lightBlue,//Agregar color en la appBar actions: const [ // Agregar iconos
actions: const [//Agregar iconos Icon(Icons.search),
Icon(Icons.search), Icon(Icons.menu)
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>{ return <String, WidgetBuilder>{
'login': (context)=>const LoginPage(), 'login': (BuildContext context) => const LoginPage(),
'homeSeller': (context)=> const HomeSellerPage(), 'homeSeller': (BuildContext context) => const HomeSellerPage(),
'articulos': (BuildContext context) => const ArticlesPage(),
}; };
} }
\ No newline at end of file
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { class ArticlesPage extends StatelessWidget {
runApp(const MyApp()); const ArticlesPage({Key? key}) : super(key: key);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return Scaffold(
debugShowCheckedModeBanner: false, appBar: AppBar(
title: 'hola articles page ', title: Text('Estoy en Articulos'),
theme: ThemeData( backgroundColor: Colors.red,
actions:[
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), Center(
useMaterial3: true, child: const Icon(Icons.shop),
)
],
),
body: Center(
child: Text('Bienvenido a los articulos'),
), ),
); );
} }
} }
\ No newline at end of file
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { class HomeSellerPage extends StatelessWidget {
runApp(const MyApp()); const HomeSellerPage({Key? key}) : super(key: key);
}
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});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
//child: Text("Hola mundo") appBar: AppBar(
appBar: AppBar( //Barra que se encuentra en la parte superior title: Text('Estoy en Home'),
title: Text("hola mundo home page "),//Agregar titulo en appBar backgroundColor: Colors.green,
backgroundColor: Colors.lightBlue,//Agregar color en la appBar ),
actions: const [//Agregar iconos body: Center(
Icon(Icons.search), child: ElevatedButton(
Icon(Icons.menu) 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
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { class LoginPage extends StatelessWidget {
runApp(const MyApp()); const LoginPage({Key? key}) : super(key: key);
}
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});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
//child: Text("Hola mundo") appBar: AppBar(
appBar: AppBar( //Barra que se encuentra en la parte superior title: const Text('Estoy en Login'),
title: Text("Hola mundo login page"),//Agregar titulo en appBar backgroundColor: Colors.lightBlue, // Agregar color en la appBar
backgroundColor: Colors.lightBlue,//Agregar color en la appBar actions: const [ // Agregar iconos
actions: const [//Agregar iconos
Icon(Icons.search), 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
name: practica1_flutter name: practica1_flutter
description: "A new Flutter project." description: "A new Flutter project."
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
...@@ -57,7 +58,8 @@ flutter: ...@@ -57,7 +58,8 @@ flutter:
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.
uses-material-design: true uses-material-design: true
assets:
- assets/img/
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
# - images/a_dot_burr.jpeg # - 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