|
@@ -1,10 +1,13 @@
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
+import 'package:sis_flutter/models/actividad_model.dart';
|
|
import 'package:sis_flutter/models/tarea_model.dart';
|
|
import 'package:sis_flutter/models/tarea_model.dart';
|
|
|
|
+import 'package:sis_flutter/themes/themes.dart';
|
|
|
|
|
|
import 'package:sis_flutter/viewmodels/login_view_model.dart';
|
|
import 'package:sis_flutter/viewmodels/login_view_model.dart';
|
|
-import 'package:sis_flutter/viewmodels/tarea_view_mode.dart';
|
|
|
|
|
|
+import 'package:sis_flutter/viewmodels/tarea_view_model.dart';
|
|
import 'package:sis_flutter/widgets/app_drawer.dart';
|
|
import 'package:sis_flutter/widgets/app_drawer.dart';
|
|
|
|
+import 'package:sis_flutter/widgets/custom_bottom_navigation_bar.dart';
|
|
import 'package:sis_flutter/widgets/widgets_components.dart';
|
|
import 'package:sis_flutter/widgets/widgets_components.dart';
|
|
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
class HomeScreen extends StatefulWidget {
|
|
@@ -33,13 +36,20 @@ class Formulario extends State<HomeScreen> {
|
|
backgroundColor: Colors.grey.shade200,
|
|
backgroundColor: Colors.grey.shade200,
|
|
drawer: AppDrawer(),
|
|
drawer: AppDrawer(),
|
|
appBar: encabezado(
|
|
appBar: encabezado(
|
|
|
|
+ estilo: TextStyle(
|
|
|
|
+ color: Colors.white,
|
|
|
|
+ fontSize: 20,
|
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
|
+ ),
|
|
|
|
+ backgroundColor: AppTheme.divider,
|
|
acciones: [
|
|
acciones: [
|
|
IconButton(
|
|
IconButton(
|
|
onPressed: () {}, icon: const Icon(Icons.restart_alt_rounded)),
|
|
onPressed: () {}, icon: const Icon(Icons.restart_alt_rounded)),
|
|
],
|
|
],
|
|
- titulo: 'Inicio',
|
|
|
|
|
|
+ titulo: "Actividades",
|
|
),
|
|
),
|
|
body: const Bodytest(),
|
|
body: const Bodytest(),
|
|
|
|
+ bottomNavigationBar: const CustomBottomNavigationBar(),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -62,11 +72,11 @@ class _BodytestState extends State<Bodytest> {
|
|
final idusuario =
|
|
final idusuario =
|
|
Provider.of<LoginViewModel>(context, listen: false).idUsuario;
|
|
Provider.of<LoginViewModel>(context, listen: false).idUsuario;
|
|
|
|
|
|
- Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
|
|
- .fetchPriodidades(idusuario);
|
|
|
|
|
|
+ // Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
|
|
+ // .fetchPriodidades(idusuario);
|
|
|
|
|
|
Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
- .fetchDetalle(idusuario);
|
|
|
|
|
|
+ .fetchActividad(idusuario);
|
|
},
|
|
},
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -79,31 +89,42 @@ class _BodytestState extends State<Bodytest> {
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
var vm = Provider.of<PrioridadesViewMode>(context);
|
|
var vm = Provider.of<PrioridadesViewMode>(context);
|
|
- var prioridades = vm.prioridades;
|
|
|
|
- var detalles = vm.detalle;
|
|
|
|
|
|
+ // var prioridades = vm.prioridades;
|
|
|
|
+ var actividadDetalle = vm.actividadList;
|
|
|
|
+
|
|
|
|
+ final height = MediaQuery.of(context).size.height;
|
|
|
|
+ final width = MediaQuery.of(context).size.width;
|
|
|
|
|
|
return SingleChildScrollView(
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- SizedBox(
|
|
|
|
- height: 500,
|
|
|
|
- child: ListView.builder(
|
|
|
|
- itemCount: detalles.length,
|
|
|
|
- itemBuilder: (context, index) {
|
|
|
|
- var detalle = detalles[index];
|
|
|
|
- var prioridad = prioridades[index];
|
|
|
|
- return _infoCard(prioridad, detalle);
|
|
|
|
- })),
|
|
|
|
|
|
+ Container(
|
|
|
|
+ height: height * 0.9,
|
|
|
|
+ child: ListView.builder(
|
|
|
|
+ itemCount: actividadDetalle.length,
|
|
|
|
+ itemBuilder: (context, index) {
|
|
|
|
+ var actividad = actividadDetalle[index];
|
|
|
|
+
|
|
|
|
+ return _infoCard(actividad);
|
|
|
|
+ }),
|
|
|
|
+ ),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- Card _infoCard(Tarea prioridad, Detalle detalle) {
|
|
|
|
- print(detalle);
|
|
|
|
- print(detalle.nombreProyecto);
|
|
|
|
- print(detalle.nombre);
|
|
|
|
|
|
+ Card _infoCard(Actividad actividad) {
|
|
|
|
+ List<Widget> tareaWidgets = [];
|
|
|
|
+ for (var tarea in actividad.tareas!) {
|
|
|
|
+ final posicion = (actividad.tareas!.indexOf(tarea) + 1).toString();
|
|
|
|
+ tareaWidgets.add(
|
|
|
|
+ ListTile(
|
|
|
|
+ title: Text(tarea.contenido!),
|
|
|
|
+ subtitle: Text("Subtarea $posicion"),
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
return Card(
|
|
return Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8),
|
|
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8),
|
|
elevation: 4,
|
|
elevation: 4,
|
|
@@ -112,8 +133,7 @@ class _BodytestState extends State<Bodytest> {
|
|
backgroundColor: Colors.white24,
|
|
backgroundColor: Colors.white24,
|
|
leading: const Icon(Icons.local_fire_department_rounded),
|
|
leading: const Icon(Icons.local_fire_department_rounded),
|
|
title: Text(
|
|
title: Text(
|
|
- //!detalle nombre
|
|
|
|
- "${detalle.nombreProyecto!} - ${detalle.nombre!}",
|
|
|
|
|
|
+ "${actividad.nombreProyecto!} - ${actividad.nombre!} ",
|
|
style: const TextStyle(fontSize: 20),
|
|
style: const TextStyle(fontSize: 20),
|
|
strutStyle: const StrutStyle(fontWeight: FontWeight.bold),
|
|
strutStyle: const StrutStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
@@ -122,34 +142,23 @@ class _BodytestState extends State<Bodytest> {
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
children: [
|
|
- Text(detalle.avance!),
|
|
|
|
- const SizedBox(
|
|
|
|
- width:
|
|
|
|
- 10), // Añadir espacio entre el texto y el indicador de progreso
|
|
|
|
|
|
+ Text(actividad.avance!),
|
|
|
|
+ const SizedBox(width: 10),
|
|
Expanded(
|
|
Expanded(
|
|
child: ClipRRect(
|
|
child: ClipRRect(
|
|
- borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
child: LinearProgressIndicator(
|
|
child: LinearProgressIndicator(
|
|
- value: double.parse(detalle.avance!) / 100,
|
|
|
|
|
|
+ value: double.parse(actividad.avance!) / 100,
|
|
backgroundColor: Colors.grey,
|
|
backgroundColor: Colors.grey,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
- _calcularColorPorcentaje(detalle.avance!),
|
|
|
|
|
|
+ _calcularColorPorcentaje(actividad.avance!),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
- children: [
|
|
|
|
- ListTile(
|
|
|
|
- title: Text(prioridad.id),
|
|
|
|
- subtitle: Text("Subtarea 1"),
|
|
|
|
- ),
|
|
|
|
- ListTile(
|
|
|
|
- title: Text("Tarea 2"),
|
|
|
|
- subtitle: Text("Subtarea 2"),
|
|
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ children: tareaWidgets,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|