mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
improve code editor
This commit is contained in:
@@ -55,7 +55,7 @@ class _CodeEditorState extends State<CodeEditor> {
|
|||||||
|
|
||||||
Widget buildLineNumbers() {
|
Widget buildLineNumbers() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 32,
|
width: 36,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
for (var i = 1; i <= lineCount; i++)
|
for (var i = 1; i <= lineCount; i++)
|
||||||
|
@@ -298,10 +298,10 @@ class _BodyState extends State<_Body> {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.to(() => _EditFilePage(source.filePath)).then((value) async {
|
context.to(() => _EditFilePage(source.filePath, () async {
|
||||||
await ComicSource.reload();
|
await ComicSource.reload();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> update(ComicSource source) async {
|
static Future<void> update(ComicSource source) async {
|
||||||
@@ -617,10 +617,12 @@ void _addAllPagesWithComicSource(ComicSource source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _EditFilePage extends StatefulWidget {
|
class _EditFilePage extends StatefulWidget {
|
||||||
const _EditFilePage(this.path);
|
const _EditFilePage(this.path, this.onExit);
|
||||||
|
|
||||||
final String path;
|
final String path;
|
||||||
|
|
||||||
|
final void Function() onExit;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_EditFilePage> createState() => __EditFilePageState();
|
State<_EditFilePage> createState() => __EditFilePageState();
|
||||||
}
|
}
|
||||||
@@ -637,6 +639,7 @@ class __EditFilePageState extends State<_EditFilePage> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
File(widget.path).writeAsStringSync(current);
|
File(widget.path).writeAsStringSync(current);
|
||||||
|
widget.onExit();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user