new macos folder

This commit is contained in:
Junyuan Feng
2022-12-04 21:42:48 +08:00
parent ca17af30cf
commit 62a1122174
50 changed files with 158 additions and 257 deletions

View File

@@ -32,7 +32,7 @@ class BackupPage extends StatelessWidget {
final s = S.of(context);
return Scaffold(
appBar: AppBar(
title: Text(s.importAndExport, style: size18),
title: Text(s.importAndExport, style: textSize18),
),
body: Center(
child: Column(

View File

@@ -157,7 +157,7 @@ class _ConvertPageState extends State<ConvertPage>
title: Text(
e,
style: TextStyle(
color: _theme.textTheme.bodyText2!.color!.withAlpha(177),
color: _theme.textTheme.bodyText2?.color?.withAlpha(177),
),
),
trailing: _buildRadio(typeOption.indexOf(e)),
@@ -180,7 +180,7 @@ class _ConvertPageState extends State<ConvertPage>
groupValue: _typeOptionIndex,
onChanged: (int? value) {
setState(() {
_typeOptionIndex = value!;
_typeOptionIndex = value ?? 0;
});
},
);

View File

@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_it/get_it.dart';
import 'package:toolbox/core/analysis.dart';
import 'package:toolbox/core/build_mode.dart';
import 'package:toolbox/core/route.dart';
import 'package:toolbox/core/update.dart';
import 'package:toolbox/core/utils.dart';
@@ -40,7 +39,6 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage>
with
AutomaticKeepAliveClientMixin,
SingleTickerProviderStateMixin,
AfterLayoutMixin,
WidgetsBindingObserver {
late final ServerProvider _serverProvider;
@@ -103,7 +101,7 @@ class _MyHomePageState extends State<MyHomePage>
return Scaffold(
drawer: _buildDrawer(),
appBar: AppBar(
title: Text(tabTitleName(context, _selectIndex), style: size18),
title: Text(tabTitleName(context, _selectIndex), style: textSize18),
actions: [
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
@@ -181,7 +179,7 @@ class _MyHomePageState extends State<MyHomePage>
children: [
_buildIcon(),
const Text(BuildData.name),
Text(_buildVersionStr()),
Text(_versionStr),
SizedBox(
height: MediaQuery.of(context).size.height * 0.07,
),
@@ -241,7 +239,7 @@ class _MyHomePageState extends State<MyHomePage>
AboutListTile(
icon: const Icon(Icons.text_snippet),
applicationName: BuildData.name,
applicationVersion: _buildVersionStr(),
applicationVersion: _versionStr,
applicationIcon: _buildIcon(),
aboutBoxChildren: [
UrlText(
@@ -285,7 +283,7 @@ class _MyHomePageState extends State<MyHomePage>
);
}
String _buildVersionStr() {
String get _versionStr {
var mod = '';
if (BuildData.modifications != 0) {
mod = '(+${BuildData.modifications})';
@@ -301,8 +299,6 @@ class _MyHomePageState extends State<MyHomePage>
await GetIt.I.allReady();
await locator<ServerProvider>().loadLocalData();
await doUpdate(context);
if (BuildMode.isRelease) {
await Analysis.init(false);
}
await Analysis.init();
}
}

View File

@@ -51,7 +51,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
appBar: AppBar(title: Text(s.edit, style: textSize18), actions: [
widget.info != null
? IconButton(
tooltip: s.delete,

View File

@@ -30,7 +30,7 @@ class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(s.privateKey, style: size18),
title: Text(s.privateKey, style: textSize18),
),
body: Consumer<PrivateKeyProvider>(
builder: (_, key, __) {

View File

@@ -12,9 +12,6 @@ import 'package:toolbox/data/res/padding.dart';
import 'package:toolbox/generated/l10n.dart';
import 'package:toolbox/view/widget/round_rect_card.dart';
const style11 = TextStyle(fontSize: 11);
const style13 = TextStyle(fontSize: 13);
class ServerDetailPage extends StatefulWidget {
const ServerDetailPage(this.id, {Key? key}) : super(key: key);
@@ -39,19 +36,22 @@ class _ServerDetailPageState extends State<ServerDetailPage>
@override
Widget build(BuildContext context) {
return Consumer<ServerProvider>(builder: (_, provider, __) {
return _buildMainPage(provider.servers
.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id));
return _buildMainPage(
provider.servers
.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id),
);
});
}
Widget _buildMainPage(ServerInfo si) {
return Scaffold(
appBar: AppBar(
title: Text(si.info.name, style: size18),
title: Text(si.info.name, style: textSize18),
),
body: ListView(
padding: const EdgeInsets.all(13),
children: [
SizedBox(height: _media.size.height * 0.03),
_buildLinuxIcon(si.status.sysVer),
SizedBox(height: _media.size.height * 0.03),
_buildUpTimeAndSys(si.status),
@@ -70,9 +70,13 @@ class _ServerDetailPageState extends State<ServerDetailPage>
if (iconPath == null) return const SizedBox();
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight: _media.size.height * 0.12,
maxWidth: _media.size.width * 0.6),
child: Image.asset(iconPath),
maxHeight: _media.size.height * 0.13,
maxWidth: _media.size.width * 0.6,
),
child: Image.asset(
iconPath,
fit: BoxFit.contain,
),
);
}
@@ -176,10 +180,10 @@ class _ServerDetailPageState extends State<ServerDetailPage>
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(ss.sysVer, style: style11, textScaleFactor: 1.0),
Text(ss.sysVer, style: textSize11, textScaleFactor: 1.0),
Text(
ss.uptime,
style: style11,
style: textSize11,
textScaleFactor: 1.0,
),
],
@@ -252,7 +256,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
const SizedBox(width: 4),
Text(
value,
style: style11,
style: textSize11,
textScaleFactor: 1.0,
textAlign: TextAlign.center,
)
@@ -284,10 +288,11 @@ class _ServerDetailPageState extends State<ServerDetailPage>
children: [
Text(
'${disk.usedPercent}% of ${disk.size}',
style: style11,
style: textSize11,
textScaleFactor: 1.0,
),
Text(disk.mountPath, style: style11, textScaleFactor: 1.0)
Text(disk.mountPath,
style: textSize11, textScaleFactor: 1.0)
],
),
_buildProgress(disk.usedPercent.toDouble())
@@ -349,18 +354,18 @@ class _ServerDetailPageState extends State<ServerDetailPage>
children: [
SizedBox(
width: _media.size.width / 4,
child: Text(device, style: style11, textScaleFactor: 1.0)),
child: Text(device, style: textSize11, textScaleFactor: 1.0)),
SizedBox(
width: _media.size.width / 4,
child: Text(ns.speedIn(device: device),
style: style11,
style: textSize11,
textAlign: TextAlign.center,
textScaleFactor: 1.0),
),
SizedBox(
width: _media.size.width / 4,
child: Text(ns.speedOut(device: device),
style: style11,
style: textSize11,
textAlign: TextAlign.right,
textScaleFactor: 1.0))
],

View File

@@ -63,7 +63,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
appBar: AppBar(title: Text(s.edit, style: textSize18), actions: [
widget.spi != null
? IconButton(
onPressed: () {

View File

@@ -26,14 +26,14 @@ class _SettingPageState extends State<SettingPage> {
late SettingStore _store;
late int _selectedColorValue;
late int _launchPageIdx;
double _intervalValue = 0;
late Color priColor;
static const textStyle = TextStyle(fontSize: 14);
late final ServerProvider _serverProvider;
late MediaQueryData _media;
late ThemeData _theme;
late S s;
var _intervalValue = 0.0;
@override
void didChangeDependencies() {
super.didChangeDependencies();
@@ -56,7 +56,7 @@ class _SettingPageState extends State<SettingPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(s.setting, style: size18),
title: Text(s.setting),
),
body: ListView(
padding: const EdgeInsets.all(17),
@@ -87,7 +87,7 @@ class _SettingPageState extends State<SettingPage> {
trailing: const Icon(Icons.keyboard_arrow_right),
title: Text(
display,
style: textStyle,
style: textSize13,
textAlign: TextAlign.start,
),
onTap: () => doUpdate(context, force: true));
@@ -101,7 +101,7 @@ class _SettingPageState extends State<SettingPage> {
textColor: priColor,
title: Text(
s.updateServerStatusInterval,
style: textStyle,
style: textSize13,
textAlign: TextAlign.start,
),
subtitle: Text(
@@ -159,7 +159,7 @@ class _SettingPageState extends State<SettingPage> {
),
title: Text(
s.appPrimaryColor,
style: textStyle,
style: textSize13,
),
children: [
_buildAppColorPicker(priColor),
@@ -193,13 +193,13 @@ class _SettingPageState extends State<SettingPage> {
childrenPadding: roundRectCardPadding,
title: Text(
s.launchPage,
style: textStyle,
style: textSize13,
),
trailing: ConstrainedBox(
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
child: Text(
tabTitleName(context, _launchPageIdx),
style: textStyle,
style: textSize13,
textAlign: TextAlign.right,
),
),

View File

@@ -31,7 +31,7 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
appBar: AppBar(
title: Text(
s.download,
style: size18,
style: textSize18,
),
),
body: _buildBody(),

View File

@@ -41,7 +41,7 @@ class _SnippetEditPageState extends State<SnippetEditPage>
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
appBar: AppBar(title: Text(s.edit, style: textSize18), actions: [
widget.snippet != null
? IconButton(
onPressed: () {

View File

@@ -39,7 +39,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(s.snippet, style: size18),
title: Text(s.snippet, style: textSize18),
),
body: _buildBody(),
floatingActionButton: FloatingActionButton(