mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-07-04 11:43:10 +02:00
Flutter app for Android + Linux desktop. Captures ideas with per-keystroke local autosave to a CRDT-backed SQLite store (sqlite_crdt), and syncs through a private GitHub repo using per-device changeset files (conflict-free last-writer-wins merge). Includes GitHub OAuth device-flow sign-in with PAT fallback, a barebones notes list, and sync settings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
|
|
|
import 'data/note_repository.dart';
|
|
import 'ui/capture_screen.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Desktop platforms need the FFI sqlite implementation initialised
|
|
// before any database is opened; mobile uses the bundled library.
|
|
if (!kIsWeb && (Platform.isLinux || Platform.isWindows || Platform.isMacOS)) {
|
|
sqfliteFfiInit();
|
|
}
|
|
|
|
final dir = await getApplicationSupportDirectory();
|
|
final dbPath = p.join(dir.path, 'todo.db');
|
|
final repository = await NoteRepository.open(dbPath);
|
|
|
|
runApp(TodoApp(repository: repository));
|
|
}
|
|
|
|
/// Root widget. Holds the single [NoteRepository] instance and hands it
|
|
/// to the screens that need it.
|
|
class TodoApp extends StatelessWidget {
|
|
const TodoApp({required this.repository, super.key});
|
|
|
|
final NoteRepository repository;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'todo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
home: CaptureScreen(repository: repository),
|
|
);
|
|
}
|
|
}
|