mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
#21 font setting only take effect to SSH
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:toolbox/core/utils/misc.dart';
|
|
||||||
|
|
||||||
import '/core/extension/colorx.dart';
|
import '/core/extension/colorx.dart';
|
||||||
import 'core/utils/ui.dart';
|
import 'core/utils/ui.dart';
|
||||||
@@ -18,7 +17,6 @@ class MyApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
setTransparentNavigationBar(context);
|
setTransparentNavigationBar(context);
|
||||||
final fontName = getFileName(_setting.fontPath.fetch());
|
|
||||||
primaryColor = Color(_setting.primaryColor.fetch()!);
|
primaryColor = Color(_setting.primaryColor.fetch()!);
|
||||||
|
|
||||||
final textStyle = TextStyle(color: primaryColor);
|
final textStyle = TextStyle(color: primaryColor);
|
||||||
@@ -51,7 +49,6 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
final theme = ThemeData(
|
final theme = ThemeData(
|
||||||
useMaterial3: false,
|
useMaterial3: false,
|
||||||
fontFamily: fontName,
|
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
primarySwatch: primarySwatch,
|
primarySwatch: primarySwatch,
|
||||||
appBarTheme: appBarTheme,
|
appBarTheme: appBarTheme,
|
||||||
@@ -64,7 +61,6 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
final darkTheme = ThemeData(
|
final darkTheme = ThemeData(
|
||||||
useMaterial3: false,
|
useMaterial3: false,
|
||||||
fontFamily: fontName,
|
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
primarySwatch: primarySwatch,
|
primarySwatch: primarySwatch,
|
||||||
floatingActionButtonTheme: fabTheme,
|
floatingActionButtonTheme: fabTheme,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 250;
|
static const int build = 252;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2ad6cd72c0 (3 weeks ago) • 2023-03-08 09:41:59 -0800\nEngine • revision 1837b5be5f\nTools • Dart 2.19.4 • DevTools 2.20.1\n";
|
"Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2ad6cd72c0 (3 weeks ago) • 2023-03-08 09:41:59 -0800\nEngine • revision 1837b5be5f\nTools • Dart 2.19.4 • DevTools 2.20.1\n";
|
||||||
static const String buildAt = "2023-03-28 17:16:16.365127";
|
static const String buildAt = "2023-03-28 17:42:34.827687";
|
||||||
static const int modifications = 2;
|
static const int modifications = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
// Server
|
// Server
|
||||||
_buildTitle(_s.server),
|
_buildTitle(_s.server),
|
||||||
_buildServer(),
|
_buildServer(),
|
||||||
|
// SSH
|
||||||
|
_buildTitle('SSH'),
|
||||||
|
_buildSSH(),
|
||||||
const SizedBox(height: 37),
|
const SizedBox(height: 37),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -102,7 +105,6 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildThemeMode(),
|
_buildThemeMode(),
|
||||||
_buildAppColorPreview(),
|
_buildAppColorPreview(),
|
||||||
_buildLaunchPage(),
|
_buildLaunchPage(),
|
||||||
_buildFont(),
|
|
||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
];
|
];
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
@@ -121,12 +123,20 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
children: [
|
children: [
|
||||||
_buildDistLogoSwitch(),
|
_buildDistLogoSwitch(),
|
||||||
_buildUpdateInterval(),
|
_buildUpdateInterval(),
|
||||||
_buildTermTheme(),
|
|
||||||
_buildMaxRetry(),
|
_buildMaxRetry(),
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildSSH() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
_buildTermTheme(),
|
||||||
|
_buildFont(),
|
||||||
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildDistLogoSwitch() {
|
Widget _buildDistLogoSwitch() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
@@ -482,11 +492,17 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
Future<void> _pickFontFile() async {
|
Future<void> _pickFontFile() async {
|
||||||
final path = await pickOneFile();
|
final path = await pickOneFile();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
final fontDir_ = await fontDir;
|
// iOS can't copy file to app dir, so we need to use the original path
|
||||||
final fontFile = File(path);
|
if (isIOS) {
|
||||||
final newPath = '${fontDir_.path}/${path.split('/').last}';
|
_setting.fontPath.put(path);
|
||||||
await fontFile.copy(newPath);
|
} else {
|
||||||
_setting.fontPath.put(newPath);
|
final fontDir_ = await fontDir;
|
||||||
|
final fontFile = File(path);
|
||||||
|
final newPath = '${fontDir_.path}/${path.split('/').last}';
|
||||||
|
await fontFile.copy(newPath);
|
||||||
|
_setting.fontPath.put(newPath);
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
_showRestartSnackbar();
|
_showRestartSnackbar();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user