Reestructuracion de la app
This commit is contained in:
@@ -79,6 +79,79 @@ class _NotesAppState extends State<NotesApp>
|
||||
ThemeData? _lightTheme;
|
||||
ThemeData? _darkTheme;
|
||||
|
||||
bool _isSyncBannerVisible() {
|
||||
switch (_syncStatus) {
|
||||
case SyncStatus.preparing:
|
||||
case SyncStatus.encrypting:
|
||||
case SyncStatus.uploading:
|
||||
case SyncStatus.waitingResponse:
|
||||
case SyncStatus.decrypting:
|
||||
case SyncStatus.syncing:
|
||||
return true;
|
||||
case SyncStatus.idle:
|
||||
case SyncStatus.synced:
|
||||
case SyncStatus.error:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildSyncBanner(BuildContext context) {
|
||||
if (!_isSyncBannerVisible()) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
final AppPalette palette = _activePalette();
|
||||
final String message = _syncErrorMessage ?? _syncDetailMessage ?? 'Sincronizando...';
|
||||
final double? progress = _syncProgress;
|
||||
|
||||
return Material(
|
||||
color: palette.surfaceElevated,
|
||||
elevation: 12,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(top: BorderSide(color: palette.border)),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.cloud_sync_outlined, color: palette.textSecondary, size: 18),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
message,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: palette.textPrimary,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: 4,
|
||||
value: progress,
|
||||
backgroundColor: palette.borderMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Brightness _effectiveBrightness() {
|
||||
switch (_themeMode) {
|
||||
case ThemeMode.dark:
|
||||
@@ -964,6 +1037,10 @@ class _NotesAppState extends State<NotesApp>
|
||||
child: activeScreen,
|
||||
),
|
||||
),
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 180),
|
||||
child: _buildSyncBanner(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user