mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
|
||||
class BgRunMC {
|
||||
const BgRunMC._();
|
||||
|
||||
abstract final class BgRunMC {
|
||||
static const _channel = MethodChannel('${Miscs.pkgName}/app_retain');
|
||||
|
||||
static void moveToBg() {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
|
||||
class HomeWidgetMC {
|
||||
const HomeWidgetMC._();
|
||||
|
||||
abstract final class HomeWidgetMC {
|
||||
static const _channel = MethodChannel('${Miscs.pkgName}/home_widget');
|
||||
|
||||
static void update() {
|
||||
|
||||
@@ -5,9 +5,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:toolbox/data/res/path.dart';
|
||||
|
||||
// class SecureStore {
|
||||
// SecureStore._();
|
||||
|
||||
// abstract final class SecureStore {
|
||||
// static const _secureStorage = FlutterSecureStorage();
|
||||
|
||||
// static HiveAesCipher? _cipher;
|
||||
|
||||
@@ -25,11 +25,9 @@ class SyncResult<T, E> {
|
||||
}
|
||||
}
|
||||
|
||||
class ICloud {
|
||||
abstract final class ICloud {
|
||||
static const _containerId = 'iCloud.tech.lolli.serverbox';
|
||||
|
||||
const ICloud._();
|
||||
|
||||
/// Upload file to iCloud
|
||||
///
|
||||
/// - [relativePath] is the path relative to [docDir],
|
||||
|
||||
@@ -5,9 +5,7 @@ import 'package:local_auth/local_auth.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:local_auth/error_codes.dart' as errs;
|
||||
|
||||
class BioAuth {
|
||||
const BioAuth._();
|
||||
|
||||
abstract final class BioAuth {
|
||||
static final _auth = LocalAuthentication();
|
||||
|
||||
static bool get isPlatformSupported => isAndroid || isIOS || isWindows;
|
||||
|
||||
@@ -5,9 +5,7 @@ import 'package:share_plus/share_plus.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
|
||||
class Shares {
|
||||
const Shares._();
|
||||
|
||||
abstract final class Shares {
|
||||
static Future<bool> files(List<String> filePaths) async {
|
||||
for (final filePath in filePaths) {
|
||||
if (!await File(filePath).exists()) {
|
||||
|
||||
@@ -4,9 +4,7 @@ import '../model/app/dynamic_color.dart';
|
||||
|
||||
late Color primaryColor;
|
||||
|
||||
class DynamicColors {
|
||||
const DynamicColors._();
|
||||
|
||||
abstract final class DynamicColors {
|
||||
static const content = DynamicColor(Colors.black87, Colors.white70);
|
||||
static const bg = DynamicColor(Colors.white, Colors.black);
|
||||
static const progress = DynamicColor(Colors.black12, Colors.white10);
|
||||
|
||||
@@ -2,9 +2,7 @@ import 'dart:ui';
|
||||
|
||||
import 'package:toolbox/data/model/ssh/virtual_key.dart';
|
||||
|
||||
class Defaults {
|
||||
const Defaults._();
|
||||
|
||||
abstract final class Defaults {
|
||||
// default server details page cards order
|
||||
static const detailCardOrder = [
|
||||
'uptime',
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'package:toolbox/data/model/app/github_id.dart';
|
||||
|
||||
class GithubIds {
|
||||
const GithubIds._();
|
||||
|
||||
abstract final class GithubIds {
|
||||
// Thanks
|
||||
// If you want to change the url, please open an issue.
|
||||
// If you want to change your Github ID, please open an issue.
|
||||
static const contributors = <GhId>{
|
||||
'its-tom',
|
||||
'RainSunMe',
|
||||
@@ -41,6 +39,8 @@ class GithubIds {
|
||||
'balh55y',
|
||||
'wc7086',
|
||||
'michaelsara',
|
||||
'xingleiwu'
|
||||
'xingleiwu',
|
||||
'Cooper098',
|
||||
'xushuojie',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ import 'package:highlight/languages/vim.dart';
|
||||
import 'package:highlight/languages/xml.dart';
|
||||
import 'package:highlight/languages/yaml.dart';
|
||||
|
||||
class Highlights {
|
||||
const Highlights._();
|
||||
|
||||
abstract final class Highlights {
|
||||
/// - KEY: fileNameSuffix
|
||||
/// - VAL: highlight
|
||||
static final all = {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class Loggers {
|
||||
const Loggers._();
|
||||
|
||||
abstract final class Loggers {
|
||||
static final root = Logger('Root');
|
||||
static final app = Logger('App');
|
||||
static final parse = Logger('Parse');
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Miscs {
|
||||
const Miscs._();
|
||||
|
||||
abstract final class Miscs {
|
||||
/// RegExp for number
|
||||
static final numReg = RegExp(r'\s{1,}');
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/core/utils/platform/path.dart';
|
||||
|
||||
class Paths {
|
||||
const Paths._();
|
||||
|
||||
abstract final class Paths {
|
||||
static String? _docDir;
|
||||
static String? _sftpDir;
|
||||
static String? _fontDir;
|
||||
|
||||
@@ -7,9 +7,7 @@ import 'package:toolbox/data/provider/sftp.dart';
|
||||
import 'package:toolbox/data/provider/snippet.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
|
||||
class Pros {
|
||||
const Pros._();
|
||||
|
||||
abstract final class Pros {
|
||||
static final app = locator<AppProvider>();
|
||||
static final debug = locator<DebugProvider>();
|
||||
static final docker = locator<DockerProvider>();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:toolbox/data/model/app/rebuild.dart';
|
||||
|
||||
class RebuildNodes {
|
||||
const RebuildNodes._();
|
||||
|
||||
abstract final class RebuildNodes {
|
||||
static final app = RebuildNode();
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import '../model/server/net_speed.dart';
|
||||
import '../model/server/conn.dart';
|
||||
import '../model/server/system.dart';
|
||||
|
||||
class InitStatus {
|
||||
const InitStatus._();
|
||||
|
||||
abstract final class InitStatus {
|
||||
static OneTimeCpuStatus get _initOneTimeCpuStatus => OneTimeCpuStatus(
|
||||
'cpu',
|
||||
0,
|
||||
|
||||
@@ -7,9 +7,7 @@ import 'package:toolbox/data/store/setting.dart';
|
||||
import 'package:toolbox/data/store/snippet.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
|
||||
class Stores {
|
||||
const Stores._();
|
||||
|
||||
abstract final class Stores {
|
||||
static final setting = locator<SettingStore>();
|
||||
static final server = locator<ServerStore>();
|
||||
static final docker = locator<DockerStore>();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:xterm/ui.dart';
|
||||
|
||||
class TerminalThemes {
|
||||
const TerminalThemes._();
|
||||
|
||||
abstract final class TerminalThemes {
|
||||
static const dark = TerminalTheme(
|
||||
cursor: Color.fromARGB(137, 174, 175, 173),
|
||||
selection: Color.fromARGB(147, 174, 175, 173),
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UIs {
|
||||
const UIs._();
|
||||
|
||||
abstract final class UIs {
|
||||
/// Font style
|
||||
|
||||
static const textSize9Grey = TextStyle(color: Colors.grey, fontSize: 9);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class Urls {
|
||||
const Urls._();
|
||||
|
||||
abstract final class Urls {
|
||||
static const resBase = 'https://res.lolli.tech/serverbox';
|
||||
static const myGithub = 'https://github.com/lollipopkit';
|
||||
static const appHelp = '$myGithub/flutter_server_box#-help';
|
||||
|
||||
@@ -325,47 +325,45 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
if (processes.isNotEmpty) {
|
||||
children.addAll(processes.map((e) => _buildGpuProcessItem(e)));
|
||||
}
|
||||
return CardX(
|
||||
ListTile(
|
||||
title: Text(item.name, style: UIs.textSize13),
|
||||
leading: Text(
|
||||
'${item.temp}°C',
|
||||
style: UIs.textSize11Grey,
|
||||
textScaler: _textFactor,
|
||||
),
|
||||
subtitle: Text(
|
||||
'${item.power} - ${mem.used} / ${mem.total} ${mem.unit}',
|
||||
style: UIs.textSize11Grey,
|
||||
textScaler: _textFactor,
|
||||
),
|
||||
trailing: InkWell(
|
||||
onTap: () {
|
||||
final height = () {
|
||||
if (processes.length > 5) {
|
||||
return 5 * 47.0;
|
||||
}
|
||||
return processes.length * 47.0;
|
||||
}();
|
||||
context.showRoundDialog(
|
||||
title: Text(item.name),
|
||||
child: SizedBox(
|
||||
width: double.maxFinite,
|
||||
height: height,
|
||||
child: ListView.builder(
|
||||
itemCount: processes.length,
|
||||
itemBuilder: (_, idx) => _buildGpuProcessItem(processes[idx]),
|
||||
),
|
||||
return ListTile(
|
||||
title: Text(item.name, style: UIs.textSize13),
|
||||
leading: Text(
|
||||
'${item.temp}°C',
|
||||
style: UIs.textSize11Grey,
|
||||
textScaler: _textFactor,
|
||||
),
|
||||
subtitle: Text(
|
||||
'${item.power} - ${mem.used} / ${mem.total} ${mem.unit}',
|
||||
style: UIs.textSize11Grey,
|
||||
textScaler: _textFactor,
|
||||
),
|
||||
trailing: InkWell(
|
||||
onTap: () {
|
||||
final height = () {
|
||||
if (processes.length > 5) {
|
||||
return 5 * 47.0;
|
||||
}
|
||||
return processes.length * 47.0;
|
||||
}();
|
||||
context.showRoundDialog(
|
||||
title: Text(item.name),
|
||||
child: SizedBox(
|
||||
width: double.maxFinite,
|
||||
height: height,
|
||||
child: ListView.builder(
|
||||
itemCount: processes.length,
|
||||
itemBuilder: (_, idx) => _buildGpuProcessItem(processes[idx]),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(l10n.close),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.info_outline, size: 17),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(l10n.close),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.info_outline, size: 17),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user