muzzle-velocity/lib/read_only.dart
2025-02-22 20:59:42 +02:00

67 lines
No EOL
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_code_editor/flutter_code_editor.dart';
import 'themes//markdown.dart';
import 'themes/day.dart';
import 'themes/night.dart';
import 'codefield.dart'; // Ensure this includes WrappedCodeField
class ReadOnlyPage extends StatelessWidget {
final String title;
final String content;
final bool isDarkMode;
ReadOnlyPage({
required this.title,
required this.content,
required this.isDarkMode,
});
@override
Widget build(BuildContext context) {
final theme = isDarkMode ? nightTheme : dayTheme;
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: title == "About"
? Column(
children: [
Center(
child: Image.asset(
'assets/blaster_fg.png',
width: 200,
)
),
CodeTheme(
data: CodeThemeData(styles: theme),
child: SingleChildScrollView(
child: WrappedCodeField(
controller: CodeController(
text: content,
language: markdown,
),
wrap: true,
readOnly: true,
),
),
),
]
)
: CodeTheme(
data: CodeThemeData(styles: theme),
child: SingleChildScrollView(
child: WrappedCodeField(
controller: CodeController(
text: content,
language: markdown,
),
wrap: true,
readOnly: true,
),
),
),
),
);
}
}