added local db

This commit is contained in:
2026-07-29 13:06:39 +05:30
parent d72522e737
commit d9886880cc
38 changed files with 2895 additions and 2261 deletions

View File

@@ -7,7 +7,6 @@ import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart';
import '../../../core/utils/formatters.dart';
import '../../../domain/entities/store_account.dart';
import '../../../domain/entities/sync_event.dart';
import '../../auth/providers/auth_controller.dart';
import '../../sync/providers/sync_controller.dart';
import '../widgets/module_widgets.dart';
@@ -196,10 +195,7 @@ class _SettingsViewState extends ConsumerState<SettingsView> {
Widget _connectivityCard() {
final ready = ref.watch(catalogueReadyProvider);
final lastImport = ref.watch(lastImportAtProvider);
final outstanding = ref
.watch(syncEventsProvider)
.where((e) => e.status != SyncStatus.synced)
.length;
final outstanding = ref.watch(unsyncedCountProvider).value ?? 0;
return PanelCard(
title: 'Connectivity & sync',
@@ -213,7 +209,7 @@ class _SettingsViewState extends ConsumerState<SettingsView> {
'Last import',
lastImport == null ? 'Never' : Formatters.dateTime(lastImport),
),
_row('Outstanding pushes', '$outstanding'),
_row('Unsynced bills', '$outstanding'),
_toggle(
'Simulate offline',
'Forces import and push to fail, so you can confirm nothing is '
@@ -222,7 +218,7 @@ class _SettingsViewState extends ConsumerState<SettingsView> {
(v) {
setState(() => _offline = v);
ref.read(remoteCatalogueProvider).simulateOffline = v;
ref.read(remoteReportSinkProvider).simulateOffline = v;
ref.read(remoteOrderSinkProvider).simulateOffline = v;
},
),
],
@@ -237,7 +233,7 @@ class _SettingsViewState extends ConsumerState<SettingsView> {
children: [
_row('Application', '${AppConstants.appName} 1.0.0'),
_row('Terminal', 'TERM-01'),
_row('Data store', 'Local — offline first'),
_row('Data store', 'SQLite (on device)'),
const SizedBox(height: AppSpacing.md),
SizedBox(
width: double.infinity,
@@ -256,20 +252,24 @@ class _SettingsViewState extends ConsumerState<SettingsView> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 148,
Flexible(
flex: 3,
child: Text(
label,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 13,
color: AppColors.textSecondary,
),
),
),
Expanded(
const SizedBox(width: AppSpacing.md),
Flexible(
flex: 4,
child: Text(
value,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,