new: ExpandTile & fix: macos Podfile

This commit is contained in:
lollipopkit
2023-10-14 22:28:18 +08:00
parent 79df3c847e
commit c9d54f4fea
12 changed files with 56 additions and 65 deletions

View File

@@ -31,7 +31,7 @@ Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartss
Platform | Support | Sign
--- | --- | ---
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | Full | Signed with my own certificate
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.7z) | Not tested | signed with flutter default certificate. It's advised to build your own version.
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.7z) | Not tested | Signed with flutter default certificate. It's advised to build your own version.
Due to Chinese government policy and the [BEIAN](https://github.com/lollipopkit/flutter_server_box/discussions/180) issue. iOS app is now free. Please download it from other regions of AppStore.

View File

@@ -8,6 +8,7 @@ import 'package:toolbox/core/route.dart';
import 'package:toolbox/data/model/docker/image.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/view/widget/expand_tile.dart';
import 'package:toolbox/view/widget/input_field.dart';
import '../../data/model/docker/ps.dart';
@@ -220,17 +221,14 @@ class _DockerManagePageState extends State<DockerManagePage> {
}
Widget _buildImage() {
final items = <Widget>[
ListTile(
title: Text(l10n.imagesList),
subtitle: Text(
l10n.dockerImagesFmt(Pros.docker.images!.length),
style: UIs.textGrey,
),
return ExpandTile(
title: Text(l10n.imagesList),
subtitle: Text(
l10n.dockerImagesFmt(Pros.docker.images!.length),
style: UIs.textGrey,
),
];
items.addAll(Pros.docker.images!.map(_buildImageItem));
return Column(children: items);
children: Pros.docker.images?.map(_buildImageItem).toList() ?? [],
);
}
Widget _buildImageItem(DockerImage e) {

View File

@@ -15,6 +15,7 @@ import 'package:toolbox/core/utils/platform/base.dart';
import 'package:toolbox/core/utils/rebuild.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/view/widget/expand_tile.dart';
import '../../../core/persistant_store.dart';
import '../../../core/route.dart';
@@ -916,29 +917,24 @@ class _SettingPageState extends State<SettingPage> {
}
Widget _buildServerOrder() {
return ListTile(
return ExpandTile(
title: Text(l10n.serverOrder),
subtitle: Text('${l10n.serverOrder} / ${l10n.serverDetailOrder}',
style: UIs.textGrey),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => context.showRoundDialog(
title: Text(l10n.choose),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Text(l10n.serverOrder),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => AppRoute.serverOrder().go(context),
),
ListTile(
title: Text(l10n.serverDetailOrder),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => AppRoute.serverDetailOrder().go(context),
),
],
),
subtitle: Text(
'${l10n.serverOrder} / ${l10n.serverDetailOrder}',
style: UIs.textGrey,
),
children: [
ListTile(
title: Text(l10n.serverOrder),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => AppRoute.serverOrder().go(context),
),
ListTile(
title: Text(l10n.serverDetailOrder),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () => AppRoute.serverDetailOrder().go(context),
),
],
);
}

View File

@@ -69,7 +69,6 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
future: getToken(),
loading: Text(l10n.gettingToken),
error: (error, trace) => Text('${l10n.error}: $error'),
noData: Text(l10n.nullToken),
success: (text) {
_pushToken.value = text;
return Text(
@@ -120,7 +119,6 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
onTap: () async => _onTapWatchApp(ctx),
);
},
noData: UIs.placeholder,
);
}

View File

@@ -21,9 +21,13 @@ class PlatformPublicSettings {
success: (can) {
return ListTile(
title: Text(l10n.bioAuth),
subtitle:
can ? null : const Text('Not available', style: UIs.textGrey),
trailing: can
subtitle: can == true
? null
: const Text(
'Not available',
style: UIs.textGrey,
),
trailing: can == true
? StoreSwitch(
prop: Stores.setting.useBioAuth,
func: (val) async {
@@ -42,7 +46,6 @@ class PlatformPublicSettings {
: null,
);
},
noData: UIs.placeholder,
);
}
}

View File

@@ -208,7 +208,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
if (!Stores.setting.recordHistory.fetch()) {
return [];
}
return Stores.history.sftpPath.all.where(
return Stores.history.sftpGoPath.all.where(
(element) => element.contains(val.text),
);
},
@@ -232,7 +232,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
_status.path?.update(p);
final suc = await _listDir();
if (suc && Stores.setting.recordHistory.fetch()) {
Stores.history.sftpPath.add(p);
Stores.history.sftpGoPath.add(p);
}
},
icon: const Icon(Icons.gps_fixed),

View File

@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
const _shape = Border();
class ExpandTile extends ExpansionTile {
const ExpandTile({
super.key,
required super.title,
super.children,
super.subtitle,
}) : super(shape: _shape, collapsedShape: _shape);
}

View File

@@ -1,26 +1,25 @@
import 'package:flutter/material.dart';
import 'package:toolbox/data/res/ui.dart';
class FutureWidget<T> extends StatelessWidget {
final Future<T> future;
final Widget loading;
final Widget Function(Object? error, StackTrace? trace) error;
final Widget Function(T data) success;
final Widget noData;
final Widget Function(T? data) success;
final Widget Function(AsyncSnapshot<Object?> snapshot)? active;
const FutureWidget({
super.key,
required this.future,
required this.loading,
this.loading = UIs.placeholder,
required this.error,
required this.success,
required this.noData,
this.active,
});
@override
Widget build(BuildContext context) {
return FutureBuilder(
return FutureBuilder<T>(
future: future,
builder: (context, snapshot) {
if (snapshot.hasError) {
@@ -36,10 +35,7 @@ class FutureWidget<T> extends StatelessWidget {
}
return loading;
case ConnectionState.done:
if (snapshot.hasData) {
return success(snapshot.data as T);
}
return noData;
return success(snapshot.data);
}
},
);

View File

@@ -31,9 +31,9 @@ target 'Runner' do
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
# target 'RunnerTests' do
# inherit! :search_paths
# end
end
post_install do |installer|

View File

@@ -55,6 +55,6 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3
PODFILE CHECKSUM: 8cdf29216ea1ab6b9743188287968d22b4579c1d
COCOAPODS: 1.13.0

View File

@@ -55,7 +55,6 @@
/* Begin PBXFileReference section */
0CA3C900AA7C73CA8287C8EB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* server_box.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = server_box.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -93,14 +92,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
331C80D6294CF71000263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
331C80D7294CF71000263BE5 /* RunnerTests.swift */,
);
path = RunnerTests;
sourceTree = "<group>";
};
33BA886A226E78AF003329D5 /* Configs */ = {
isa = PBXGroup;
children = (
@@ -117,7 +108,6 @@
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
331C80D6294CF71000263BE5 /* RunnerTests */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
D29F91BB271305884DC23479 /* Pods */,

View File

@@ -28,7 +28,5 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
</dict>
</plist>