mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
new: ExpandTile & fix: macos Podfile
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
12
lib/view/widget/expand_tile.dart
Normal file
12
lib/view/widget/expand_tile.dart
Normal 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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user