4da36aa31d
Flutter Android client for FabledAssistant with: - Session-cookie auth via persistent cookie jar (Dio + cookie_jar) - OAuth/SSO login via in-app WebView (flutter_inappwebview) - Notes: list, detail (markdown render), create/edit - Tasks: list with status tabs, create/edit with priority - Chat: SSE streaming bubbles, conversation management - Quick Capture FAB for rapid note/task creation - Settings screen (change server URL, logout) - Android home screen widget → opens chat - Riverpod state management, go_router navigation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
2.1 KiB
Dart
65 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../core/constants.dart';
|
|
import '../../providers/notes_provider.dart';
|
|
|
|
class NotesListScreen extends ConsumerWidget {
|
|
const NotesListScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final notesAsync = ref.watch(notesProvider);
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Notes')),
|
|
body: notesAsync.when(
|
|
loading: () => const Center(child: CircularProgressIndicator()),
|
|
error: (e, _) => Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text('Error: $e'),
|
|
TextButton(
|
|
onPressed: () => ref.invalidate(notesProvider),
|
|
child: const Text('Retry'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
data: (notes) {
|
|
if (notes.isEmpty) {
|
|
return const Center(child: Text('No notes yet. Tap + to create one.'));
|
|
}
|
|
return RefreshIndicator(
|
|
onRefresh: () => ref.refresh(notesProvider.future),
|
|
child: ListView.separated(
|
|
itemCount: notes.length,
|
|
separatorBuilder: (_, _) => const Divider(height: 1),
|
|
itemBuilder: (context, i) {
|
|
final note = notes[i];
|
|
return ListTile(
|
|
title: Text(note.title),
|
|
subtitle: Text(
|
|
note.updatedAt.toLocal().toString().substring(0, 16),
|
|
style: Theme.of(context).textTheme.bodySmall,
|
|
),
|
|
onTap: () => context.push(
|
|
Routes.noteDetail.replaceFirst(':id', '${note.id}'),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
},
|
|
),
|
|
floatingActionButton: FloatingActionButton(
|
|
heroTag: 'notes_fab',
|
|
onPressed: () => context.push(Routes.noteNew),
|
|
child: const Icon(Icons.add),
|
|
),
|
|
);
|
|
}
|
|
}
|