|
@@ -1,14 +1,16 @@
|
|
|
|
+// ignore_for_file: use_build_context_synchronously
|
|
|
|
+
|
|
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/actividad_model.dart';
|
|
-import 'package:sis_flutter/models/tarea_model.dart';
|
|
|
|
import 'package:sis_flutter/themes/themes.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_model.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/custom_bottom_navigation_bar.dart';
|
|
-import 'package:sis_flutter/widgets/widgets_components.dart';
|
|
|
|
|
|
+
|
|
|
|
+import '../../data/session/session_storage.dart';
|
|
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
class HomeScreen extends StatefulWidget {
|
|
static const String route = '/home';
|
|
static const String route = '/home';
|
|
@@ -20,11 +22,6 @@ class HomeScreen extends StatefulWidget {
|
|
}
|
|
}
|
|
|
|
|
|
class Formulario extends State<HomeScreen> {
|
|
class Formulario extends State<HomeScreen> {
|
|
- DateTime? fechaInicio = DateTime.now();
|
|
|
|
- DateTime? fechaFin;
|
|
|
|
- ScrollController horizontalScrollController = ScrollController();
|
|
|
|
- ScrollController verticalScrollController = ScrollController();
|
|
|
|
-
|
|
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
super.initState();
|
|
super.initState();
|
|
@@ -33,37 +30,29 @@ class Formulario extends State<HomeScreen> {
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
return Scaffold(
|
|
- backgroundColor: Colors.grey.shade200,
|
|
|
|
- drawer: AppDrawer(),
|
|
|
|
- appBar: encabezado(
|
|
|
|
- estilo: TextStyle(
|
|
|
|
- color: Colors.white,
|
|
|
|
- fontSize: 20,
|
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
|
- ),
|
|
|
|
- backgroundColor: AppTheme.divider,
|
|
|
|
- acciones: [
|
|
|
|
- IconButton(
|
|
|
|
- onPressed: () {}, icon: const Icon(Icons.restart_alt_rounded)),
|
|
|
|
- ],
|
|
|
|
- titulo: "Actividades",
|
|
|
|
|
|
+ backgroundColor: AppTheme.progressBackground,
|
|
|
|
+ appBar: AppBar(
|
|
|
|
+ backgroundColor: Colors.white,
|
|
),
|
|
),
|
|
- body: const Bodytest(),
|
|
|
|
|
|
+ drawerScrimColor:
|
|
|
|
+ const Color.fromARGB(255, 119, 119, 119).withOpacity(0.5),
|
|
|
|
+ drawer: AppDrawer(),
|
|
|
|
+ body: const SafeArea(child: HomeBody()),
|
|
bottomNavigationBar: const CustomBottomNavigationBar(),
|
|
bottomNavigationBar: const CustomBottomNavigationBar(),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-class Bodytest extends StatefulWidget {
|
|
|
|
- const Bodytest({
|
|
|
|
|
|
+class HomeBody extends StatefulWidget {
|
|
|
|
+ const HomeBody({
|
|
super.key,
|
|
super.key,
|
|
});
|
|
});
|
|
|
|
|
|
@override
|
|
@override
|
|
- State<Bodytest> createState() => _BodytestState();
|
|
|
|
|
|
+ State<HomeBody> createState() => _HomeBodyState();
|
|
}
|
|
}
|
|
|
|
|
|
-class _BodytestState extends State<Bodytest> {
|
|
|
|
|
|
+class _HomeBodyState extends State<HomeBody> {
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
super.initState();
|
|
super.initState();
|
|
@@ -71,10 +60,6 @@ class _BodytestState extends State<Bodytest> {
|
|
() async {
|
|
() async {
|
|
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)
|
|
Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
.fetchActividad(idusuario);
|
|
.fetchActividad(idusuario);
|
|
},
|
|
},
|
|
@@ -91,15 +76,58 @@ class _BodytestState extends State<Bodytest> {
|
|
var vm = Provider.of<PrioridadesViewMode>(context);
|
|
var vm = Provider.of<PrioridadesViewMode>(context);
|
|
// var prioridades = vm.prioridades;
|
|
// var prioridades = vm.prioridades;
|
|
var actividadDetalle = vm.actividadList;
|
|
var actividadDetalle = vm.actividadList;
|
|
-
|
|
|
|
|
|
+ var usuario = Provider.of<LoginViewModel>(context, listen: false);
|
|
final height = MediaQuery.of(context).size.height;
|
|
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,
|
|
|
|
children: [
|
|
children: [
|
|
Container(
|
|
Container(
|
|
|
|
+ padding: const EdgeInsets.all(10),
|
|
|
|
+ decoration: const BoxDecoration(
|
|
|
|
+ color: Colors.white,
|
|
|
|
+ borderRadius:
|
|
|
|
+ BorderRadius.vertical(bottom: Radius.circular(15))),
|
|
|
|
+ child: Padding(
|
|
|
|
+ padding: const EdgeInsets.all(8.0),
|
|
|
|
+ child: Column(
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ const Text("Bienvenido ",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 25,
|
|
|
|
+ )),
|
|
|
|
+ Text(usuario.name,
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ fontSize: 45,
|
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
|
+ height: -1)),
|
|
|
|
+ const SizedBox(height: 10),
|
|
|
|
+ Container(
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ borderRadius: BorderRadius.circular(10),
|
|
|
|
+ color: const Color.fromARGB(141, 232, 234, 237),
|
|
|
|
+ ),
|
|
|
|
+ child: const TextField(
|
|
|
|
+ decoration: InputDecoration(
|
|
|
|
+ contentPadding: EdgeInsets.symmetric(vertical: 15),
|
|
|
|
+ border: InputBorder.none,
|
|
|
|
+ prefix: Icon(
|
|
|
|
+ Icons.search,
|
|
|
|
+ color: Colors.black87,
|
|
|
|
+ ),
|
|
|
|
+ hintText: "Busqueda por Usuarios",
|
|
|
|
+ hintStyle:
|
|
|
|
+ TextStyle(color: Colors.grey, fontSize: 15)),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ]),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ const SizedBox(height: 10),
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: double.infinity,
|
|
height: height * 0.9,
|
|
height: height * 0.9,
|
|
child: ListView.builder(
|
|
child: ListView.builder(
|
|
itemCount: actividadDetalle.length,
|
|
itemCount: actividadDetalle.length,
|
|
@@ -134,7 +162,8 @@ class _BodytestState extends State<Bodytest> {
|
|
leading: const Icon(Icons.local_fire_department_rounded),
|
|
leading: const Icon(Icons.local_fire_department_rounded),
|
|
title: Text(
|
|
title: Text(
|
|
"${actividad.nombreProyecto!} - ${actividad.nombre!} ",
|
|
"${actividad.nombreProyecto!} - ${actividad.nombre!} ",
|
|
- style: const TextStyle(fontSize: 20),
|
|
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black54),
|
|
strutStyle: const StrutStyle(fontWeight: FontWeight.bold),
|
|
strutStyle: const StrutStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
trailing: const Icon(Icons.arrow_drop_down),
|
|
trailing: const Icon(Icons.arrow_drop_down),
|
|
@@ -148,12 +177,9 @@ class _BodytestState extends State<Bodytest> {
|
|
child: ClipRRect(
|
|
child: ClipRRect(
|
|
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
child: LinearProgressIndicator(
|
|
child: LinearProgressIndicator(
|
|
- value: double.parse(actividad.avance!) / 100,
|
|
|
|
- backgroundColor: Colors.grey,
|
|
|
|
- valueColor: AlwaysStoppedAnimation<Color>(
|
|
|
|
- _calcularColorPorcentaje(actividad.avance!),
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
|
|
+ value: double.parse(actividad.avance!) / 100,
|
|
|
|
+ backgroundColor: Colors.grey,
|
|
|
|
+ valueColor: const AlwaysStoppedAnimation(AppTheme.primary)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
@@ -163,10 +189,3 @@ class _BodytestState extends State<Bodytest> {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-Color _calcularColorPorcentaje(String avance) {
|
|
|
|
- final porcentaje = double.parse(avance);
|
|
|
|
- if (porcentaje > 66) return Colors.green;
|
|
|
|
- if (porcentaje > 33) return Colors.orange;
|
|
|
|
- return Colors.red;
|
|
|
|
-}
|
|
|