mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
Settings: Move Editor Settings to their own screen
It just has the default settings right now, but we need to expose some settings in the Markdown Editor.
This commit is contained in:
46
lib/screens/settings_editors.dart
Normal file
46
lib/screens/settings_editors.dart
Normal file
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gitjournal/settings.dart';
|
||||
import 'package:gitjournal/screens/settings_widgets.dart';
|
||||
|
||||
class SettingsEditorsScreen extends StatefulWidget {
|
||||
@override
|
||||
SettingsEditorsScreenState createState() => SettingsEditorsScreenState();
|
||||
}
|
||||
|
||||
class SettingsEditorsScreenState extends State<SettingsEditorsScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var settings = Settings.instance;
|
||||
|
||||
var body = Column(children: <Widget>[
|
||||
ListPreference(
|
||||
title: "Default Editor",
|
||||
currentOption: settings.defaultEditor.toPublicString(),
|
||||
options:
|
||||
SettingsEditorType.options.map((f) => f.toPublicString()).toList(),
|
||||
onChange: (String publicStr) {
|
||||
var val = SettingsEditorType.fromPublicString(publicStr);
|
||||
Settings.instance.defaultEditor = val;
|
||||
Settings.instance.save();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
]);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Editor Settings'),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: body,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||
import 'package:gitjournal/screens/settings_editors.dart';
|
||||
import 'package:gitjournal/settings.dart';
|
||||
import 'package:gitjournal/state_container.dart';
|
||||
import 'package:gitjournal/utils.dart';
|
||||
@ -168,17 +169,14 @@ class SettingsListState extends State<SettingsList> {
|
||||
enabled: remoteGitConfigured,
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
SettingsHeader("Editor Settings"),
|
||||
ListPreference(
|
||||
title: "Default Editor",
|
||||
currentOption: settings.defaultEditor.toPublicString(),
|
||||
options:
|
||||
SettingsEditorType.options.map((f) => f.toPublicString()).toList(),
|
||||
onChange: (String publicStr) {
|
||||
var val = SettingsEditorType.fromPublicString(publicStr);
|
||||
Settings.instance.defaultEditor = val;
|
||||
Settings.instance.save();
|
||||
setState(() {});
|
||||
ListTile(
|
||||
title: const Text("Editor Settings"),
|
||||
subtitle: const Text("Configure how different editors work"),
|
||||
onTap: () {
|
||||
var route = MaterialPageRoute(
|
||||
builder: (context) => SettingsEditorsScreen(),
|
||||
);
|
||||
Navigator.of(context).push(route);
|
||||
},
|
||||
),
|
||||
SettingsHeader("Storage"),
|
||||
|
Reference in New Issue
Block a user