a
This commit is contained in:
@@ -45,13 +45,13 @@ class _LatestOperationsCardContent extends StatelessWidget {
|
|||||||
return Card(
|
return Card(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(12),
|
||||||
side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.5)),
|
side: BorderSide(color: theme.dividerColor.withValues(alpha: 0.3)),
|
||||||
),
|
),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => context.pushNamed(Routes.operations),
|
onTap: () => context.pushNamed(Routes.operations),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -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/master_data/staff/models/staff_member_model.dart';
|
||||||
import 'package:flux/features/notes/data/notes_repository.dart';
|
import 'package:flux/features/notes/data/notes_repository.dart';
|
||||||
import 'package:flux/features/notes/models/note_model.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:get_it/get_it.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
@@ -73,13 +74,7 @@ class HomeScreen extends StatelessWidget {
|
|||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
context: context,
|
context: context,
|
||||||
),
|
),
|
||||||
_buildDashboardWidget(
|
DashboardNotesWidget(),
|
||||||
title: context.l10n.commonStickyNotes,
|
|
||||||
icon: Icons.sticky_note_2_outlined,
|
|
||||||
color: Colors.yellow.shade700,
|
|
||||||
context: context,
|
|
||||||
onTap: () => context.pushNamed(Routes.notes),
|
|
||||||
),
|
|
||||||
_buildDashboardWidget(
|
_buildDashboardWidget(
|
||||||
title: context.l10n.homeMyTasks,
|
title: context.l10n.homeMyTasks,
|
||||||
icon: Icons.check_box_outlined,
|
icon: Icons.check_box_outlined,
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/blocs/notes_bloc.dart';
|
||||||
import 'package:flux/features/notes/models/note_model.dart';
|
import 'package:flux/features/notes/models/note_model.dart';
|
||||||
import 'package:go_router/go_router.dart'; // Supponendo tu usi GoRouter per la navigazione
|
import 'package:go_router/go_router.dart'; // Supponendo tu usi GoRouter per la navigazione
|
||||||
@@ -9,66 +11,93 @@ class DashboardNotesWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Card(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
elevation: 0,
|
||||||
children: [
|
clipBehavior: Clip.antiAlias,
|
||||||
// Intestazione del riquadro
|
shape: RoundedRectangleBorder(
|
||||||
Row(
|
borderRadius: BorderRadius.circular(12),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
side: BorderSide(
|
||||||
children: [
|
color: Theme.of(context).dividerColor.withValues(alpha: 0.3),
|
||||||
Text(
|
style: BorderStyle.solid,
|
||||||
'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'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
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
|
// Il corpo del widget collegato al Bloc
|
||||||
BlocBuilder<NotesBloc, NotesState>(
|
BlocBuilder<NotesBloc, NotesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state.status == NotesStatus.loading && state.notes.isEmpty) {
|
if (state.status == NotesStatus.loading &&
|
||||||
return const Center(child: CircularProgressIndicator());
|
state.notes.isEmpty) {
|
||||||
}
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
if (state.status == NotesStatus.failure) {
|
if (state.status == NotesStatus.failure) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Errore nel caricamento delle note.',
|
'Errore nel caricamento delle note.',
|
||||||
style: TextStyle(color: Colors.red),
|
style: TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.notes.isEmpty) {
|
if (state.notes.isEmpty) {
|
||||||
return _buildEmptyState(context);
|
return _buildEmptyState(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prendiamo solo le prime 4 note per non intaccare troppo spazio in Dashboard
|
// Prendiamo solo le prime 4 note per non intaccare troppo spazio in Dashboard
|
||||||
final displayNotes = state.notes.take(4).toList();
|
final displayNotes = state.notes.take(4).toList();
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 140, // Altezza fissa per lo scroll orizzontale
|
height: 140, // Altezza fissa per lo scroll orizzontale
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: displayNotes.length,
|
itemCount: displayNotes.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return _buildMiniPostIt(context, displayNotes[index]);
|
return _buildMiniPostIt(context, displayNotes[index]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flux/core/blocs/session/session_cubit.dart';
|
import 'package:flux/core/blocs/session/session_cubit.dart';
|
||||||
import 'package:flux/core/utils/debouncer.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/master_data/staff/blocs/staff_cubit.dart';
|
||||||
import 'package:flux/features/notes/blocs/notes_bloc.dart';
|
import 'package:flux/features/notes/blocs/notes_bloc.dart';
|
||||||
import 'package:flux/features/notes/models/note_model.dart';
|
import 'package:flux/features/notes/models/note_model.dart';
|
||||||
@@ -382,7 +380,7 @@ class _NoteFormScreenState extends State<NoteFormScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
value: _isSharedAll,
|
value: _isSharedAll,
|
||||||
activeColor: Colors.black87,
|
activeThumbColor: Colors.black87,
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
onChanged: (val) {
|
onChanged: (val) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
Reference in New Issue
Block a user