|
@@ -8,6 +8,7 @@ import 'package:sis_flutter/services/usuario_session_service.dart';
|
|
|
import 'package:sis_flutter/viewmodels/login_view_model.dart';
|
|
|
import 'package:sis_flutter/viewmodels/actividad_view_model.dart';
|
|
|
import 'package:sis_flutter/viewmodels/viewmodels.dart';
|
|
|
+import 'package:sis_flutter/views/home/tarea_view_form.dart';
|
|
|
import 'package:sis_flutter/widgets/app_dropdown_search.dart';
|
|
|
import 'package:sis_flutter/widgets/app_loader.dart';
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
@@ -93,9 +94,9 @@ class _HomeBodyState extends State<HomeBody> {
|
|
|
)),
|
|
|
Text(_usuario?.name! ?? "Cargando...",
|
|
|
style: const TextStyle(
|
|
|
- fontSize: 45,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- height: -1)),
|
|
|
+ fontSize: 45,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ )),
|
|
|
const SizedBox(height: 10),
|
|
|
Container(
|
|
|
decoration: BoxDecoration(
|
|
@@ -138,6 +139,19 @@ class _HomeBodyState extends State<HomeBody> {
|
|
|
|
|
|
Card _infoCard(Actividad actividad) {
|
|
|
List<Widget> tareaWidgets = [];
|
|
|
+
|
|
|
+ tareaWidgets.add(Center(
|
|
|
+ child: IconButton(
|
|
|
+ style:
|
|
|
+ ButtonStyle(backgroundColor: WidgetStatePropertyAll(Colors.blue)),
|
|
|
+ icon: const Icon(Icons.add),
|
|
|
+ color: Colors.white,
|
|
|
+ onPressed: () {
|
|
|
+ _showAddTaskModal(context);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ));
|
|
|
+
|
|
|
for (var tarea in actividad.tareas!) {
|
|
|
// final posicion = (actividad.tareas!.indexOf(tarea) + 1).toString();
|
|
|
final Color color = getPrioridadColors(tarea.prioridad!);
|
|
@@ -158,25 +172,11 @@ class _HomeBodyState extends State<HomeBody> {
|
|
|
title: Linkify(
|
|
|
text: tarea.contenido!,
|
|
|
onOpen: (link) async {
|
|
|
- if (await canLaunchUrlString(link.url)) {
|
|
|
- await launchUrlString(link.url);
|
|
|
- } else {
|
|
|
- throw CupertinoAlertDialog(
|
|
|
- title: const Text("Error"),
|
|
|
- content: const Text("No se puede abrir el link"),
|
|
|
- actions: [
|
|
|
- CupertinoDialogAction(
|
|
|
- child: const Text("OK"),
|
|
|
- onPressed: () {
|
|
|
- Navigator.of(context).pop();
|
|
|
- },
|
|
|
- )
|
|
|
- ],
|
|
|
- );
|
|
|
- }
|
|
|
+ linkfyDialog(link);
|
|
|
}),
|
|
|
- subtitle: Text(tarea.urgencia!),
|
|
|
-
|
|
|
+ subtitle: Text(tarea.urgencia!),
|
|
|
+ trailing:
|
|
|
+ IconButton(onPressed: () {}, icon: const Icon(Icons.edit)),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
@@ -231,6 +231,25 @@ class _HomeBodyState extends State<HomeBody> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ linkfyDialog(link) async {
|
|
|
+ if (await canLaunchUrlString(link.url)) {
|
|
|
+ await launchUrlString(link.url);
|
|
|
+ } else {
|
|
|
+ throw CupertinoAlertDialog(
|
|
|
+ title: const Text("Error"),
|
|
|
+ content: const Text("No se puede abrir el link"),
|
|
|
+ actions: [
|
|
|
+ CupertinoDialogAction(
|
|
|
+ child: const Text("OK"),
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ },
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Color getPrioridadColors(tarea) {
|
|
|
return tarea == 1
|
|
|
? Colors.red
|
|
@@ -243,3 +262,18 @@ class _HomeBodyState extends State<HomeBody> {
|
|
|
: Colors.grey;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void _showAddTaskModal(BuildContext context) {
|
|
|
+ showModalBottomSheet(
|
|
|
+ context: context,
|
|
|
+ isScrollControlled: true,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return Padding(
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ bottom: MediaQuery.of(context).viewInsets.bottom,
|
|
|
+ ),
|
|
|
+ child: NewTareaForm(),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
+}
|