Files
BalanceMono/BalanceFlutter/lib/main.dart
T
wt 2c278044bb
Android CI / Build and Test (push) Failing after 21m18s
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s
delete CloudKit and added BalanceFlutter
2026-10-28 15:37:32 +07:00

60 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'
show LicenseRegistry, LicenseEntryWithLineBreaks;
import 'package:flutter/services.dart' show rootBundle;
import 'services/app_store.dart';
import 'services/background.dart';
import 'ui/app.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
LicenseRegistry.addLicense(() async* {
yield LicenseEntryWithLineBreaks([
'Roboto',
], await rootBundle.loadString('assets/fonts/LICENSE.txt'));
});
final store = AppStore();
try {
await store.initialize();
try {
await configureBackgroundSync();
} catch (_) {
store.error =
'Не удалось включить фоновую синхронизацию. Синхронизация при открытии приложения доступна.';
}
runApp(BalanceApp(store: store));
} catch (error) {
runApp(
MaterialApp(
home: Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(24),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.storage_outlined, size: 48),
const SizedBox(height: 16),
const Text(
'Не удалось открыть хранилище',
style: TextStyle(fontSize: 24),
),
const SizedBox(height: 12),
SelectableText('$error'),
const SizedBox(height: 20),
FilledButton(
onPressed: main,
child: const Text('Повторить'),
),
],
),
),
),
),
),
),
);
}
}