Initial commit: Captain Claude Mobile App
- Flutter app with chat and terminal screens - WebSocket integration for real-time chat - xterm integration for screen sessions - Markdown rendering with code blocks - JWT authentication Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
68
lib/widgets/markdown_viewer.dart
Normal file
68
lib/widgets/markdown_viewer.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'code_block.dart';
|
||||
|
||||
class MarkdownViewer extends StatelessWidget {
|
||||
final String data;
|
||||
final bool selectable;
|
||||
|
||||
const MarkdownViewer({
|
||||
super.key,
|
||||
required this.data,
|
||||
this.selectable = true,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MarkdownBody(
|
||||
data: data,
|
||||
selectable: selectable,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: const TextStyle(fontSize: 15, height: 1.5),
|
||||
h1: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
h2: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
h3: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
h4: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
code: TextStyle(
|
||||
fontFamily: 'JetBrainsMono',
|
||||
backgroundColor: Colors.black.withOpacity(0.3),
|
||||
fontSize: 13,
|
||||
),
|
||||
codeblockDecoration: BoxDecoration(
|
||||
color: const Color(0xFF0D1117),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
blockquotePadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
blockquoteDecoration: BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
listBullet: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
tableHead: const TextStyle(fontWeight: FontWeight.bold),
|
||||
tableBody: const TextStyle(),
|
||||
tableBorder: TableBorder.all(
|
||||
color: Colors.grey.shade700,
|
||||
width: 1,
|
||||
),
|
||||
tableCellsPadding: const EdgeInsets.all(8),
|
||||
horizontalRuleDecoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(color: Colors.grey.shade700, width: 1),
|
||||
),
|
||||
),
|
||||
),
|
||||
builders: {
|
||||
'code': CodeBlockBuilder(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user