55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter_code_editor/flutter_code_editor.dart';
|
||
|
|
import 'markdown.dart';
|
||
|
|
import 'day.dart';
|
||
|
|
import '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: SingleChildScrollView(
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 15.0),
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
Center(
|
||
|
|
child: Image.asset(
|
||
|
|
'assets/plasmoid_fg.png',
|
||
|
|
width: 200,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
SizedBox(height: 20),
|
||
|
|
CodeTheme(
|
||
|
|
data: CodeThemeData(styles: theme),
|
||
|
|
child: WrappedCodeField(
|
||
|
|
controller: CodeController(
|
||
|
|
text: content,
|
||
|
|
language: markdown,
|
||
|
|
),
|
||
|
|
wrap: true,
|
||
|
|
readOnly: true,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
SizedBox(height: 80)
|
||
|
|
],
|
||
|
|
)
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|