new: delete all in settings page
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
extension LocaleX on Locale {
|
||||
String get name {
|
||||
String get code {
|
||||
if (countryCode == null) {
|
||||
return languageCode;
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ class AppRoute {
|
||||
String? path,
|
||||
String? text,
|
||||
String? langCode,
|
||||
String? title,
|
||||
}) {
|
||||
return AppRoute(
|
||||
EditorPage(
|
||||
@@ -170,6 +171,7 @@ class AppRoute {
|
||||
path: path,
|
||||
text: text,
|
||||
langCode: langCode,
|
||||
title: title,
|
||||
),
|
||||
'editor');
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 515;
|
||||
static const int build = 517;
|
||||
static const String engine = "3.13.1";
|
||||
static const String buildAt = "2023-08-30 16:31:26.338447";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2023-08-30 17:23:28.418667";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const backendUrl = 'https://res.lolli.tech';
|
||||
const baseUrl = '$backendUrl/serverbox';
|
||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||
const baseResUrl = '$backendUrl/serverbox';
|
||||
const myGithub = 'https://github.com/lollipopkit';
|
||||
const appHelpUrl = '$myGithub/flutter_server_box#-help';
|
||||
const appWikiUrl = '$myGithub/flutter_server_box/wiki';
|
||||
|
||||
@@ -5,7 +5,7 @@ import '../res/url.dart';
|
||||
|
||||
class AppService {
|
||||
Future<AppUpdate> getUpdate() async {
|
||||
final resp = await Dio().get('$baseUrl/update.json');
|
||||
final resp = await Dio().get('$baseResUrl/update.json');
|
||||
return AppUpdate.fromJson(resp.data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,14 @@ class EditorPage extends StatefulWidget {
|
||||
/// Higher priority than [path]
|
||||
final String? langCode;
|
||||
|
||||
final String? title;
|
||||
|
||||
const EditorPage({
|
||||
Key? key,
|
||||
this.path,
|
||||
this.text,
|
||||
this.langCode,
|
||||
this.title,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -110,7 +113,11 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
|
||||
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
return CustomAppBar(
|
||||
title: TwoLineText(up: getFileName(widget.path) ?? '', down: _s.editor),
|
||||
centerTitle: true,
|
||||
title: TwoLineText(
|
||||
up: widget.title ?? getFileName(widget.path) ?? '',
|
||||
down: _s.editor,
|
||||
),
|
||||
actions: [
|
||||
PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.language),
|
||||
@@ -134,21 +141,20 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
|
||||
|
||||
Widget _buildBody() {
|
||||
return SingleChildScrollView(
|
||||
child: CodeTheme(
|
||||
data: CodeThemeData(
|
||||
styles: _codeTheme,
|
||||
),
|
||||
child: CodeField(
|
||||
focusNode: _focusNode,
|
||||
controller: _controller,
|
||||
textStyle: _textStyle,
|
||||
lineNumberStyle: const LineNumberStyle(
|
||||
width: 47,
|
||||
margin: 7,
|
||||
),
|
||||
child: CodeTheme(
|
||||
data: CodeThemeData(
|
||||
styles: _codeTheme,
|
||||
),
|
||||
child: CodeField(
|
||||
focusNode: _focusNode,
|
||||
controller: _controller,
|
||||
textStyle: _textStyle,
|
||||
lineNumberStyle: const LineNumberStyle(
|
||||
width: 47,
|
||||
margin: 7,
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -271,6 +271,10 @@ class _HomePageState extends State<HomePage>
|
||||
title: Text(_s.about),
|
||||
child: _buildAboutContent(),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => openUrl(appWikiUrl),
|
||||
child: const Text('Wiki'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => openUrl(appHelpUrl),
|
||||
child: Text(_s.feedback),
|
||||
@@ -380,6 +384,7 @@ class _HomePageState extends State<HomePage>
|
||||
final result = await AppRoute.editor(
|
||||
text: text,
|
||||
langCode: 'json',
|
||||
title: _s.setting,
|
||||
).go(context);
|
||||
if (result == null) {
|
||||
return;
|
||||
|
||||
@@ -110,6 +110,26 @@ class _SettingPageState extends State<SettingPage> {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(
|
||||
title: Text(_s.setting),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.sureDelete(_s.all)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_setting.box.deleteAll(_setting.box.keys);
|
||||
context.pop();
|
||||
showSnackBar(context, Text(_s.success));
|
||||
},
|
||||
child: Text(_s.ok, style: const TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
icon: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
@@ -609,8 +629,8 @@ class _SettingPageState extends State<SettingPage> {
|
||||
final items = S.supportedLocales
|
||||
.map(
|
||||
(e) => PopupMenuItem<String>(
|
||||
value: e.name,
|
||||
child: Text(e.name),
|
||||
value: e.code,
|
||||
child: Text(e.code),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user