Actividad 5 home

parent 568a3cdb
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:practica1_flutter/src/pages/home_page.dart';
class ArticlesPage extends StatelessWidget { class ArticlesPage extends StatelessWidget {
const ArticlesPage({Key? key}) : super(key: key); const ArticlesPage({Key? key}) : super(key: key);
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:practica1_flutter/src/pages/articles_page.dart';
class HomeSellerPage extends StatelessWidget { class HomeSellerPage extends StatelessWidget {
const HomeSellerPage({Key? key}) : super(key: key); const HomeSellerPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return DefaultTabController(// Agrega un DefaultTabController para manejar el estado de las pestañas.
appBar: AppBar( length: 2, // Define el número de pestañas.
title: Text('Estoy en Home'), child: MaterialApp(
backgroundColor: Colors.green, debugShowCheckedModeBanner: false,
), title: 'Estoy en Home',
body: Center( theme: ThemeData(
child: ElevatedButton( primaryColor: Colors.blue,
onPressed: () { ),
// Navega a la página 'homePage' cuando se presiona el botón. home: Scaffold(
Navigator.pushNamed(context, 'articulos'); appBar: AppBar(
}, title: const Text("ShopMaster"),
child: Text('Avanzar a Articulos'), bottom: const TabBar( // Agrega el TabBar en la parte inferior de la AppBar.
tabs: [
Tab(icon: Icon(Icons.article_outlined), text: "Articulos"),
Tab(icon: Icon(Icons.shop_2), text: "Ventas"),
],
),
),
drawer: MenuLateral(),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/*ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, 'articulos');
},
child: const Text('Acceder a articulos -->'),
),*/
const SizedBox(height: 200),
FloatingActionButton(
onPressed: () {
},
child: Icon(Icons.add),
tooltip: 'Agregar Categoría',//Mensaje
),
],
),
),
), ),
), ),
); );
} }
} }
//Clase del meuno lateral
class MenuLateral extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: [
const UserAccountsDrawerHeader(
accountName: Text("Mi cuenta"),
accountEmail: Text("Prueba@gmail.com"),
),
Ink(
color: Colors.indigo, // Cambiar color de cada menú.
child: ListTile(
title: const Text("Menu 1", style: TextStyle(color: Colors.white)),
),
),
const ListTile(
title: Text("Menu 2"),
),
const ListTile(
title: Text("Menu 2"),
),
],
),
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatelessWidget {
const LoginPage({Key? key}) : super(key: key); const LoginPage({Key? key}) : super(key: key);
@override @override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Iniciar sesión'), title: const Text('Estoy en Login'),
backgroundColor: Colors.lightBlue, backgroundColor: Colors.lightBlue, // Agregar color en la appBar
actions: const [
Icon(Icons.search),
Icon(Icons.menu),
],
), ),
body: Padding( body: Center(
padding: const EdgeInsets.all(16.0), child: Column(
child: Center( mainAxisAlignment: MainAxisAlignment.center,
child: Column( children: [
mainAxisAlignment: MainAxisAlignment.center, Image.asset('assets/img/logo_visorus.jpg', height: 100),
children: [ const SizedBox(height: 20),//Espacio entre la imagen y campo de texto
Image.asset('assets/img/logo_visorus.jpg'),
const SizedBox(height: 20),
//Campo de Usuario Padding(
TextField( padding: const EdgeInsets.symmetric(horizontal: 80.0), // añado mi margen horizontal
child: TextField(
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: 'Usuario', labelText: 'Usuario',
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
), ),
const SizedBox(height: 20), ),
const SizedBox(height: 20),
//Campo de contraseña Padding(
TextField( padding: const EdgeInsets.symmetric(horizontal: 80.0), // Añado mi margen horizontal
child: TextField(
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: 'Contraseña', labelText: 'Contraseña',
border: OutlineInputBorder(), border: OutlineInputBorder(),
), ),
obscureText: true, obscureText: true,
), ),
const SizedBox(height: 20), ),
const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.pushNamed(context, 'homeSeller'); Navigator.pushNamed(context, 'homeSeller');
}, },
child: const Text('Acceder'), child: const Text('Acceder'),
), ),
], ],
),
), ),
), ),
); );
} }
} }
...@@ -31,8 +31,6 @@ environment: ...@@ -31,8 +31,6 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6 cupertino_icons: ^1.0.6
......
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