mmmh
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flux/features/tasks/blocs/task_form_cubit.dart';
|
||||
import 'package:flux/features/tasks/models/task_status.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class TaskFormScreen extends StatefulWidget {
|
||||
@@ -182,6 +183,43 @@ class _TaskFormScreenState extends State<TaskFormScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (state.id != null &&
|
||||
state.taskStatus != TaskStatus.completed)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 24.0),
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
// Chiama direttamente l'update immediato nel DB!
|
||||
context
|
||||
.read<TaskFormCubit>()
|
||||
.updateTaskStatus(TaskStatus.completed);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.check_circle_outline,
|
||||
size: 28,
|
||||
),
|
||||
label: const Text(
|
||||
'Segna come Completato',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green.shade600,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 30),
|
||||
_buildFormFields(context, state, cubit),
|
||||
const SizedBox(height: 30),
|
||||
ElevatedButton.icon(
|
||||
|
||||
Reference in New Issue
Block a user