|
@@ -2,16 +2,12 @@
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:provider/provider.dart';
|
|
|
-import 'package:sis_flutter/models/actividad_model.dart';
|
|
|
import 'package:sis_flutter/themes/themes.dart';
|
|
|
-
|
|
|
-import 'package:sis_flutter/viewmodels/login_view_model.dart';
|
|
|
-import 'package:sis_flutter/viewmodels/tarea_view_model.dart';
|
|
|
+import 'package:sis_flutter/views/home/home_view.dart';
|
|
|
+import 'package:sis_flutter/views/profile/profile_screen.dart';
|
|
|
import 'package:sis_flutter/widgets/app_drawer.dart';
|
|
|
import 'package:sis_flutter/widgets/custom_bottom_navigation_bar.dart';
|
|
|
|
|
|
-import '../../data/session/session_storage.dart';
|
|
|
-
|
|
|
class HomeScreen extends StatefulWidget {
|
|
|
static const String route = '/home';
|
|
|
|
|
@@ -21,10 +17,19 @@ class HomeScreen extends StatefulWidget {
|
|
|
Formulario createState() => Formulario();
|
|
|
}
|
|
|
|
|
|
-class Formulario extends State<HomeScreen> {
|
|
|
+class Formulario extends State<HomeScreen> with SingleTickerProviderStateMixin {
|
|
|
+ late TabController _tabController;
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
+ _tabController = TabController(length: 2, vsync: this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ // TODO: implement dispose
|
|
|
+ super.dispose();
|
|
|
+ _tabController.dispose();
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -37,155 +42,20 @@ class Formulario extends State<HomeScreen> {
|
|
|
drawerScrimColor:
|
|
|
const Color.fromARGB(255, 119, 119, 119).withOpacity(0.5),
|
|
|
drawer: AppDrawer(),
|
|
|
- body: const SafeArea(child: HomeBody()),
|
|
|
- bottomNavigationBar: const CustomBottomNavigationBar(),
|
|
|
- );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-class HomeBody extends StatefulWidget {
|
|
|
- const HomeBody({
|
|
|
- super.key,
|
|
|
- });
|
|
|
-
|
|
|
- @override
|
|
|
- State<HomeBody> createState() => _HomeBodyState();
|
|
|
-}
|
|
|
-
|
|
|
-class _HomeBodyState extends State<HomeBody> {
|
|
|
- @override
|
|
|
- void initState() {
|
|
|
- super.initState();
|
|
|
- Future(
|
|
|
- () async {
|
|
|
- final idusuario =
|
|
|
- Provider.of<LoginViewModel>(context, listen: false).idUsuario;
|
|
|
- Provider.of<PrioridadesViewMode>(context, listen: false)
|
|
|
- .fetchActividad(idusuario);
|
|
|
- },
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- @override
|
|
|
- void dispose() {
|
|
|
- super.dispose();
|
|
|
- }
|
|
|
-
|
|
|
- @override
|
|
|
- Widget build(BuildContext context) {
|
|
|
- var vm = Provider.of<PrioridadesViewMode>(context);
|
|
|
- // var prioridades = vm.prioridades;
|
|
|
- var actividadDetalle = vm.actividadList;
|
|
|
- var usuario = Provider.of<LoginViewModel>(context, listen: false);
|
|
|
- final height = MediaQuery.of(context).size.height;
|
|
|
-
|
|
|
- return SingleChildScrollView(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- 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,
|
|
|
- child: ListView.builder(
|
|
|
- itemCount: actividadDetalle.length,
|
|
|
- itemBuilder: (context, index) {
|
|
|
- var actividad = actividadDetalle[index];
|
|
|
-
|
|
|
- return _infoCard(actividad);
|
|
|
- }),
|
|
|
- ),
|
|
|
+ body: TabBarView(
|
|
|
+ controller: _tabController,
|
|
|
+ children: <Widget>[
|
|
|
+ const HomeBody(),
|
|
|
+ const ProfileScreen(),
|
|
|
],
|
|
|
),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- 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(
|
|
|
- margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8),
|
|
|
- elevation: 4,
|
|
|
- shape: BeveledRectangleBorder(borderRadius: BorderRadius.circular(6.0)),
|
|
|
- child: ExpansionTile(
|
|
|
- backgroundColor: Colors.white24,
|
|
|
- leading: const Icon(Icons.local_fire_department_rounded),
|
|
|
- title: Text(
|
|
|
- "${actividad.nombreProyecto!} - ${actividad.nombre!} ",
|
|
|
- style: const TextStyle(
|
|
|
- fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black54),
|
|
|
- strutStyle: const StrutStyle(fontWeight: FontWeight.bold),
|
|
|
- ),
|
|
|
- trailing: const Icon(Icons.arrow_drop_down),
|
|
|
- subtitle: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.start,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text(actividad.avance!),
|
|
|
- const SizedBox(width: 10),
|
|
|
- Expanded(
|
|
|
- child: ClipRRect(
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
|
- child: LinearProgressIndicator(
|
|
|
- value: double.parse(actividad.avance!) / 100,
|
|
|
- backgroundColor: Colors.grey,
|
|
|
- valueColor: const AlwaysStoppedAnimation(AppTheme.primary)),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- children: tareaWidgets,
|
|
|
- ),
|
|
|
+ bottomNavigationBar: CustomBottomNavigationBar(
|
|
|
+ indexValue: _tabController.index,
|
|
|
+ onIndexSelected: (index) {
|
|
|
+ setState(() {
|
|
|
+ _tabController.index = index;
|
|
|
+ });
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
}
|