This commit is contained in:
lollipopkit
2024-05-14 23:39:17 +08:00
parent 04dfede535
commit ba4abcecfb
25 changed files with 86 additions and 279 deletions

View File

@@ -1,55 +0,0 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/data/provider/debug.dart';
import 'package:toolbox/data/res/provider.dart';
class DebugPage extends StatelessWidget {
const DebugPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
leading: IconButton(
onPressed: () => context.pop(),
icon: const Icon(Icons.arrow_back, color: Colors.white),
),
title: const Text('Logs', style: TextStyle(color: Colors.white)),
backgroundColor: Colors.black,
actions: [
IconButton(
onPressed: () => Pros.debug.clear(),
icon: const Icon(Icons.delete, color: Colors.white),
),
],
),
body: _buildTerminal(context),
backgroundColor: Colors.black,
);
}
Widget _buildTerminal(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
color: Colors.black,
child: DefaultTextStyle(
style: const TextStyle(
color: Colors.white,
),
child: ChangeNotifierProvider.value(
value: Pros.debug,
child: Consumer<DebugProvider>(
builder: (_, provider, __) {
return ListView(
key: ValueKey(provider.widgets.length),
children: provider.widgets,
);
},
),
),
),
);
}
}

View File

@@ -9,7 +9,6 @@ import 'package:flutter_highlight/theme_map.dart';
import 'package:flutter_highlight/themes/a11y-light.dart';
import 'package:flutter_highlight/themes/monokai.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/utils/misc.dart';
import 'package:toolbox/data/res/highlight.dart';
import 'package:toolbox/data/res/store.dart';
@@ -118,7 +117,7 @@ class _EditorPageState extends State<EditorPage> {
return CustomAppBar(
centerTitle: true,
title: TwoLineText(
up: widget.title ?? getFileName(widget.path) ?? l10n.unknown,
up: widget.title ?? widget.path?.getFileName() ?? l10n.unknown,
down: l10n.editor,
),
actions: [

View File

@@ -10,7 +10,6 @@ import 'package:toolbox/core/channel/home_widget.dart';
import 'package:toolbox/core/extension/build.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/route.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/github_id.dart';
import 'package:toolbox/data/model/app/tab.dart';
import 'package:toolbox/data/res/build_data.dart';
@@ -48,7 +47,7 @@ class _HomePageState extends State<HomePage>
@override
void initState() {
super.initState();
switchStatusBar(hide: false);
SystemUIs.switchStatusBar(hide: false);
WidgetsBinding.instance.addObserver(this);
_selectIndex.value = Stores.setting.launchPage.fetch();
// avoid index out of range
@@ -286,11 +285,11 @@ class _HomePageState extends State<HomePage>
child: _buildAboutContent(),
actions: [
TextButton(
onPressed: () => openUrl(Urls.appWiki),
onPressed: () => Urls.appWiki.launch(),
child: const Text('Wiki'),
),
TextButton(
onPressed: () => openUrl(Urls.appHelp),
onPressed: () => Urls.appHelp.launch(),
child: Text(l10n.feedback),
),
TextButton(

View File

@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
import 'package:icons_plus/icons_plus.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/shell_func.dart';
import 'package:toolbox/data/model/server/custom.dart';
import 'package:toolbox/data/model/server/wol_cfg.dart';
@@ -456,7 +455,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
),
title: Text(l10n.doc),
trailing: const Icon(Icons.open_in_new, size: 17),
onTap: () => openUrl(l10n.customCmdDocUrl),
onTap: () => l10n.customCmdDocUrl.launch(),
).cardx,
];
}

View File

@@ -13,7 +13,6 @@ import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/data/res/url.dart';
import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/app/net_view.dart';
import '../../../data/provider/app.dart';
import '../../../data/res/build_data.dart';
@@ -424,7 +423,7 @@ class _SettingPageState extends State<SettingPage> {
}
Widget _buildFont() {
final fontName = getFileName(_setting.fontPath.fetch());
final fontName = _setting.fontPath.fetch().getFileName();
return ListTile(
leading: const Icon(MingCute.font_fill),
title: Text(l10n.font),
@@ -457,7 +456,7 @@ class _SettingPageState extends State<SettingPage> {
Future<void> _pickFontFile() async {
final path = await Pfs.pickFilePath();
if (path == null) return;
// iOS can't copy file to app dir, so we need to use the original path
if (isIOS) {
_setting.fontPath.put(path);

View File

@@ -4,7 +4,6 @@ import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/data/model/app/server_detail_card.dart';
import 'package:toolbox/data/res/store.dart';
class ServerDetailOrderPage extends StatefulWidget {
const ServerDetailOrderPage({super.key});

View File

@@ -19,7 +19,6 @@ import 'package:xterm/core.dart';
import 'package:xterm/ui.dart' hide TerminalThemes;
import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/server/server_private_info.dart';
import '../../../data/model/ssh/virtual_key.dart';
import '../../../data/res/terminal.dart';
@@ -509,7 +508,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
}
void _initStoredCfg() {
final fontFamilly = getFileName(Stores.setting.fontPath.fetch());
final fontFamilly = Stores.setting.fontPath.fetch().getFileName();
final textSize = Stores.setting.termFontSize.fetch();
final textStyle = TextStyle(
fontFamily: fontFamilly,

View File

@@ -10,7 +10,6 @@ import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/view/widget/omit_start_text.dart';
import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/app/path_with_prefix.dart';
class LocalStoragePage extends StatefulWidget {
@@ -134,7 +133,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
onPressed: () async {
final path = await Pfs.pickFilePath();
if (path == null) return;
final name = getFileName(path) ?? 'imported';
final name = path.getFileName() ?? 'imported';
await File(path).copy(_path!.path.joinPath(name));
setState(() {});
},