Files
sharedinbox/lib/ui/screens/changelog_screen.dart
T
Thomas SharedInboxandClaude Sonnet 4.6 902b9bfbce fix: load changelog via DefaultAssetBundle for testability (#214)
Use DefaultAssetBundle.of(context) instead of rootBundle so the asset
bundle can be injected in tests. Add changelog_screen_test.dart with a
FakeAssetBundle that verifies content is shown and that missing-asset
errors are reported correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 17:42:54 +02:00

48 lines
1.4 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
import 'package:url_launcher/url_launcher.dart';
class ChangeLogScreen extends StatelessWidget {
const ChangeLogScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('ChangeLog')),
body: FutureBuilder<String>(
future:
DefaultAssetBundle.of(context).loadString('assets/changelog.txt'),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return Center(
child: Text('Error loading changelog: ${snapshot.error}'),
);
}
final content = snapshot.data ?? 'No changelog entries found.';
return Markdown(
data: content,
onTapLink: (text, href, title) {
if (href != null) {
unawaited(
launchUrl(
Uri.parse(href),
mode: LaunchMode.externalApplication,
),
);
}
},
styleSheet: MarkdownStyleSheet(
p: const TextStyle(fontFamily: 'monospace', fontSize: 13),
),
);
},
),
);
}
}