From 7a11e829b39bb3a7dd96729d5dc9d638f683df10 Mon Sep 17 00:00:00 2001 From: Mark M2 Macbook Date: Sat, 23 May 2026 11:08:39 +0200 Subject: [PATCH] a --- .../ui/latest_store_operations_card.dart | 6 +- lib/features/home/ui/home_screen.dart | 9 +- .../notes/ui/dashboard_notes_widget.dart | 131 +++++++++++------- lib/features/notes/ui/notes_form_screen.dart | 4 +- 4 files changed, 86 insertions(+), 64 deletions(-) diff --git a/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart b/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart index d0976ab..3f871a5 100644 --- a/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart +++ b/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart @@ -45,13 +45,13 @@ class _LatestOperationsCardContent extends StatelessWidget { return Card( elevation: 0, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.5)), + borderRadius: BorderRadius.circular(12), + side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.3)), ), child: InkWell( onTap: () => context.pushNamed(Routes.operations), child: Padding( - padding: const EdgeInsets.all(16.0), + padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/features/home/ui/home_screen.dart b/lib/features/home/ui/home_screen.dart index f382203..63ab3b6 100644 --- a/lib/features/home/ui/home_screen.dart +++ b/lib/features/home/ui/home_screen.dart @@ -12,6 +12,7 @@ import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart'; import 'package:flux/features/master_data/staff/models/staff_member_model.dart'; import 'package:flux/features/notes/data/notes_repository.dart'; import 'package:flux/features/notes/models/note_model.dart'; +import 'package:flux/features/notes/ui/dashboard_notes_widget.dart'; import 'package:get_it/get_it.dart'; import 'package:go_router/go_router.dart'; @@ -73,13 +74,7 @@ class HomeScreen extends StatelessWidget { color: Colors.orange, context: context, ), - _buildDashboardWidget( - title: context.l10n.commonStickyNotes, - icon: Icons.sticky_note_2_outlined, - color: Colors.yellow.shade700, - context: context, - onTap: () => context.pushNamed(Routes.notes), - ), + DashboardNotesWidget(), _buildDashboardWidget( title: context.l10n.homeMyTasks, icon: Icons.check_box_outlined, diff --git a/lib/features/notes/ui/dashboard_notes_widget.dart b/lib/features/notes/ui/dashboard_notes_widget.dart index 084ec36..d707c66 100644 --- a/lib/features/notes/ui/dashboard_notes_widget.dart +++ b/lib/features/notes/ui/dashboard_notes_widget.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flux/core/routes/routes.dart'; +import 'package:flux/core/theme/theme.dart'; import 'package:flux/features/notes/blocs/notes_bloc.dart'; import 'package:flux/features/notes/models/note_model.dart'; import 'package:go_router/go_router.dart'; // Supponendo tu usi GoRouter per la navigazione @@ -9,66 +11,93 @@ class DashboardNotesWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Intestazione del riquadro - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Le mie Note', - style: Theme.of( - context, - ).textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold), - ), - TextButton( - onPressed: () { - // Vai alla bacheca completa - context.push('/notes'); - }, - child: const Text('Vedi tutte'), - ), - ], + return Card( + elevation: 0, + clipBehavior: Clip.antiAlias, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: BorderSide( + color: Theme.of(context).dividerColor.withValues(alpha: 0.3), + style: BorderStyle.solid, ), - const SizedBox(height: 12), + ), + child: InkWell( + onTap: () => context.pushNamed(Routes.notes), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Intestazione del riquadro + Row( + children: [ + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Colors.yellow.shade700.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(8), + ), + child: Icon( + Icons.sticky_note_2_outlined, + size: 16, + color: Colors.yellow.shade700, + ), + ), + const SizedBox(width: 12), + Text( + 'Le mie Note', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: context.primaryText, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + const SizedBox(height: 12), - // Il corpo del widget collegato al Bloc - BlocBuilder( - builder: (context, state) { - if (state.status == NotesStatus.loading && state.notes.isEmpty) { - return const Center(child: CircularProgressIndicator()); - } + // Il corpo del widget collegato al Bloc + BlocBuilder( + builder: (context, state) { + if (state.status == NotesStatus.loading && + state.notes.isEmpty) { + return const Center(child: CircularProgressIndicator()); + } - if (state.status == NotesStatus.failure) { - return const Center( - child: Text( - 'Errore nel caricamento delle note.', - style: TextStyle(color: Colors.red), - ), - ); - } + if (state.status == NotesStatus.failure) { + return const Center( + child: Text( + 'Errore nel caricamento delle note.', + style: TextStyle(color: Colors.red), + ), + ); + } - if (state.notes.isEmpty) { - return _buildEmptyState(context); - } + if (state.notes.isEmpty) { + return _buildEmptyState(context); + } - // Prendiamo solo le prime 4 note per non intaccare troppo spazio in Dashboard - final displayNotes = state.notes.take(4).toList(); + // Prendiamo solo le prime 4 note per non intaccare troppo spazio in Dashboard + final displayNotes = state.notes.take(4).toList(); - return SizedBox( - height: 140, // Altezza fissa per lo scroll orizzontale - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: displayNotes.length, - itemBuilder: (context, index) { - return _buildMiniPostIt(context, displayNotes[index]); + return SizedBox( + height: 140, // Altezza fissa per lo scroll orizzontale + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: displayNotes.length, + itemBuilder: (context, index) { + return _buildMiniPostIt(context, displayNotes[index]); + }, + ), + ); }, ), - ); - }, + ], + ), ), - ], + ), ); } diff --git a/lib/features/notes/ui/notes_form_screen.dart b/lib/features/notes/ui/notes_form_screen.dart index 225e9bc..afa0810 100644 --- a/lib/features/notes/ui/notes_form_screen.dart +++ b/lib/features/notes/ui/notes_form_screen.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flux/core/blocs/session/session_cubit.dart'; import 'package:flux/core/utils/debouncer.dart'; -import 'package:flux/core/widgets/shared_forms/attachments_section.dart'; -import 'package:flux/features/attachments/blocs/attachments_bloc.dart'; import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart'; import 'package:flux/features/notes/blocs/notes_bloc.dart'; import 'package:flux/features/notes/models/note_model.dart'; @@ -382,7 +380,7 @@ class _NoteFormScreenState extends State { ), ), value: _isSharedAll, - activeColor: Colors.black87, + activeThumbColor: Colors.black87, contentPadding: EdgeInsets.zero, onChanged: (val) { setState(() {