feat: All windows class added
This commit is contained in:
167
lib/main.dart
167
lib/main.dart
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'src/views/rutas.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -7,115 +8,101 @@ void main() {
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
||||
// the application has a purple toolbar. Then, without quitting the app,
|
||||
// try changing the seedColor in the colorScheme below to Colors.green
|
||||
// and then invoke "hot reload" (save your changes or press the "hot
|
||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
||||
// the command line to start the app).
|
||||
//
|
||||
// Notice that the counter didn't reset back to zero; the application
|
||||
// state is not lost during the reload. To reset the state, use hot
|
||||
// restart instead.
|
||||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: .fromSeed(seedColor: Colors.deepPurple),
|
||||
),
|
||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'Hackaton App',
|
||||
home: const RegistroView(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
class RegistroView extends StatelessWidget {
|
||||
const RegistroView({super.key});
|
||||
|
||||
// This widget is the home page of your application. It is stateful, meaning
|
||||
// that it has a State object (defined below) that contains fields that affect
|
||||
// how it looks.
|
||||
|
||||
// This class is the configuration for the state. It holds the values (in this
|
||||
// case the title) provided by the parent (in this case the App widget) and
|
||||
// used by the build method of the State. Fields in a Widget subclass are
|
||||
// always marked "final".
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
// This call to setState tells the Flutter framework that something has
|
||||
// changed in this State, which causes it to rerun the build method below
|
||||
// so that the display can reflect the updated values. If we changed
|
||||
// _counter without calling setState(), then the build method would not be
|
||||
// called again, and so nothing would appear to happen.
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
final Color colorAzul = const Color(0xFF0F0D38);
|
||||
final Color colorVerde = const Color(0xFF2E4D31);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
// The Flutter framework has been optimized to make rerunning build methods
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
// TRY THIS: Try changing the color here to a specific color (to
|
||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
||||
// change color while the other colors stay the same.
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text(widget.title),
|
||||
backgroundColor: colorAzul,
|
||||
title: const Text('Registro',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 28)),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Column(
|
||||
// Column is also a layout widget. It takes a list of children and
|
||||
// arranges them vertically. By default, it sizes itself to fit its
|
||||
// children horizontally, and tries to be as tall as its parent.
|
||||
//
|
||||
// Column has various properties to control how it sizes itself and
|
||||
// how it positions its children. Here we use mainAxisAlignment to
|
||||
// center the children vertically; the main axis here is the vertical
|
||||
// axis because Columns are vertical (the cross axis would be
|
||||
// horizontal).
|
||||
//
|
||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
||||
// action in the IDE, or press "p" in the console), to see the
|
||||
// wireframe for each widget.
|
||||
mainAxisAlignment: .center,
|
||||
children: [
|
||||
const Text('You have pushed the button this many times:'),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildInput(Icons.person_outline, 'Nombre'),
|
||||
_buildInput(Icons.person_outline, 'Apellidos'),
|
||||
_buildInput(Icons.email_outlined, 'Correo'),
|
||||
_buildInput(Icons.lock_outline, 'Contraseña'),
|
||||
const SizedBox(height: 50),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colorAzul,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 15),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const HorariosView()));
|
||||
},
|
||||
child: const Text('Registrar', style: TextStyle(color: Colors.white, fontSize: 18)),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colorAzul,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 15),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15))
|
||||
),
|
||||
onPressed: () {},
|
||||
child: const Text('Iniciar Sesion', style: TextStyle(color: Colors.white, fontSize: 18)),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInput(IconData icon, String hint) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.black, width: 2),
|
||||
),
|
||||
child: Icon(icon, size: 40, color: Colors.black),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: TextStyle(color: colorVerde.withOpacity(0.5), fontWeight: FontWeight.bold, fontSize: 22),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: BorderSide(color: colorVerde, width: 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
71
lib/src/views/configuracion.dart
Normal file
71
lib/src/views/configuracion.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'rutas.dart';
|
||||
|
||||
class ConfiguracionView extends StatelessWidget {
|
||||
const ConfiguracionView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: colorAzul,
|
||||
title: const Text('Configuracion', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 4),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.notifications_active_outlined, size: 60),
|
||||
SizedBox(width: 10),
|
||||
Text('{Rango dias}', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Spacer(),
|
||||
Icon(Icons.keyboard_arrow_down, size: 50)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _customNavBarConfig(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customNavBarConfig(BuildContext context) {
|
||||
return Container(
|
||||
height: 90, color: colorAzul,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: const Icon(Icons.home_outlined, color: Colors.white, size: 40)),
|
||||
IconButton(onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const HorariosView())),
|
||||
icon: const Icon(Icons.alt_route_rounded, color: Colors.white, size: 40)),
|
||||
const SizedBox(width: 80),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: -25, right: 30, // Posición según img 3
|
||||
child: Container(
|
||||
width: 85, height: 85,
|
||||
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle, border: Border.all(color: colorVerde, width: 4)),
|
||||
child: const Icon(Icons.settings, color: colorVerde, size: 45),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
87
lib/src/views/domicilios.dart
Normal file
87
lib/src/views/domicilios.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'rutas.dart';
|
||||
|
||||
class DomiciliosView extends StatelessWidget {
|
||||
const DomiciliosView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: colorAzul,
|
||||
title: const Text('Domicilios', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 4),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.home_outlined, size: 60),
|
||||
const SizedBox(width: 10),
|
||||
const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('{NAME}', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Text('Colonia y Ruta', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(onPressed: () {}, icon: const Icon(Icons.more_horiz, size: 40))
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: colorAzul,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: const Icon(Icons.add, color: Colors.black, size: 80),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _customNavBarDomicilio(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customNavBarDomicilio(BuildContext context) {
|
||||
return Container(
|
||||
height: 90, color: colorAzul,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
const SizedBox(width: 80),
|
||||
IconButton(onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const HorariosView())),
|
||||
icon: const Icon(Icons.alt_route_rounded, color: Colors.white, size: 40)),
|
||||
IconButton(onPressed: () {}, icon: const Icon(Icons.notifications_none, color: Colors.white, size: 40)),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: -25, left: 30, // Posición según img 2
|
||||
child: Container(
|
||||
width: 85, height: 85,
|
||||
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle, border: Border.all(color: colorVerde, width: 4)),
|
||||
child: const Icon(Icons.home, color: colorVerde, size: 45),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class HorariosView extends StatelessWidget {
|
||||
|
||||
final List<Map<String, String>> rutas = List.generate(
|
||||
6,
|
||||
(index) => {
|
||||
(index) => {
|
||||
'colonia': 'Colonia',
|
||||
'ruta': 'Ruta',
|
||||
'horario': '(horario estimado)',
|
||||
@@ -86,7 +86,7 @@ class HorariosView extends StatelessWidget {
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior:
|
||||
Clip.none, // Permite que el botón central sobresalga hacia arriba
|
||||
Clip.none, // Permite que el botón central sobresalga hacia arriba
|
||||
children: [
|
||||
// Iconos de los lados
|
||||
Row(
|
||||
99
lib/src/views/rutas.dart
Normal file
99
lib/src/views/rutas.dart
Normal file
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'domicilios.dart';
|
||||
import 'configuracion.dart';
|
||||
|
||||
const Color colorVerde = Color(0xFF2E4D31);
|
||||
const Color colorAzul = Color(0xFF0F0D38);
|
||||
|
||||
class HorariosView extends StatelessWidget {
|
||||
const HorariosView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Map<String, String>> rutas = List.generate(
|
||||
6,
|
||||
(index) => {
|
||||
'colonia': 'Colonia',
|
||||
'ruta': 'Ruta',
|
||||
'horario': '(horario estimado)',
|
||||
},
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: colorAzul,
|
||||
title: const Text('Horarios',
|
||||
style: TextStyle(color: Colors.white, fontSize: 32, fontWeight: FontWeight.bold)),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 24),
|
||||
itemCount: rutas.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = rutas[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(item['colonia']!, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Text(item['ruta']!, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
Text(item['horario']!, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: _customNavBar(context, 1),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Widget reutilizable para la barra inferior de las 3 vistas
|
||||
Widget _customNavBar(BuildContext context, int activeIndex) {
|
||||
return Container(
|
||||
height: 90,
|
||||
color: colorAzul,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.home_outlined, color: Colors.white, size: activeIndex == 0 ? 0 : 40),
|
||||
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const DomiciliosView())),
|
||||
),
|
||||
const SizedBox(width: 80),
|
||||
IconButton(
|
||||
icon: Icon(activeIndex == 2 ? Icons.settings : Icons.notifications_none, color: Colors.white, size: activeIndex == 2 ? 0 : 40),
|
||||
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => const ConfiguracionView())),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: -25,
|
||||
child: Container(
|
||||
width: 85, height: 85,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: colorVerde, width: 4),
|
||||
),
|
||||
child: Icon(
|
||||
activeIndex == 0 ? Icons.home : (activeIndex == 1 ? Icons.alt_route_rounded : Icons.settings),
|
||||
color: colorVerde, size: 45,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user