feat: Refactor sync status handling and improve synchronization feedback in the app
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:notas/screens/note_editor_screen.dart';
|
||||
import 'package:notas/widgets/menu_drawer.dart';
|
||||
import 'package:notas/widgets/note_card.dart';
|
||||
import 'package:notas/widgets/search_app_bar.dart';
|
||||
import 'package:notas/widgets/sync_status.dart';
|
||||
import 'package:notas/widgets/sync_status_indicator.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
@@ -20,6 +21,8 @@ class HomeScreen extends StatefulWidget {
|
||||
required this.onRequestSync,
|
||||
this.onVaultInvalid,
|
||||
this.syncStatus = SyncStatus.idle,
|
||||
this.syncProgress,
|
||||
this.syncDetailMessage,
|
||||
this.syncErrorMessage,
|
||||
this.refreshToken = 0,
|
||||
});
|
||||
@@ -29,6 +32,8 @@ class HomeScreen extends StatefulWidget {
|
||||
final Future<void> Function() onRequestSync;
|
||||
final Future<void> Function()? onVaultInvalid;
|
||||
final SyncStatus syncStatus;
|
||||
final double? syncProgress;
|
||||
final String? syncDetailMessage;
|
||||
final String? syncErrorMessage;
|
||||
final int refreshToken;
|
||||
|
||||
@@ -272,7 +277,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
});
|
||||
},
|
||||
feedback: MouseRegion(
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
elevation: 8,
|
||||
@@ -280,7 +285,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
width: cellWidth,
|
||||
child: TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.97, end: 1.0),
|
||||
duration: const Duration(milliseconds: 180),
|
||||
duration: const Duration(
|
||||
milliseconds: 180,
|
||||
),
|
||||
curve: Curves.easeOutCubic,
|
||||
builder: (context, scale, child) {
|
||||
return Transform.scale(
|
||||
@@ -302,14 +309,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
),
|
||||
childWhenDragging: MouseRegion(
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
child: Opacity(
|
||||
opacity: 0.3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromRGBO(24, 25, 26, 1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: const Color.fromRGBO(
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
12,
|
||||
),
|
||||
border: Border.all(
|
||||
color: Colors.white24,
|
||||
width: 1,
|
||||
@@ -388,7 +402,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
});
|
||||
},
|
||||
feedback: MouseRegion(
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
elevation: 8,
|
||||
@@ -396,7 +410,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
width: cellWidth,
|
||||
child: TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.97, end: 1.0),
|
||||
duration: const Duration(milliseconds: 180),
|
||||
duration: const Duration(
|
||||
milliseconds: 180,
|
||||
),
|
||||
curve: Curves.easeOutCubic,
|
||||
builder: (context, scale, child) {
|
||||
return Transform.scale(
|
||||
@@ -418,14 +434,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
),
|
||||
childWhenDragging: MouseRegion(
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
cursor: SystemMouseCursors.grabbing,
|
||||
child: Opacity(
|
||||
opacity: 0.3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromRGBO(24, 25, 26, 1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: const Color.fromRGBO(
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
12,
|
||||
),
|
||||
border: Border.all(
|
||||
color: Colors.white24,
|
||||
width: 1,
|
||||
@@ -525,6 +548,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
},
|
||||
trailingWidget: SyncStatusIndicator(
|
||||
status: widget.syncStatus,
|
||||
progress: widget.syncProgress,
|
||||
detailMessage: widget.syncDetailMessage,
|
||||
errorMessage: widget.syncErrorMessage,
|
||||
onTap: widget.onRequestSync,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user