Skip to content

Commit

Permalink
new: picker & opt. rm -r
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Oct 5, 2023
1 parent ef144e2 commit a23a284
Show file tree
Hide file tree
Showing 28 changed files with 192 additions and 316 deletions.
6 changes: 3 additions & 3 deletions .dart_tool/flutter_gen/gen_l10n/l10n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1202,11 +1202,11 @@ abstract class S {
/// **'Preparing to connect...'**
String get sftpDlPrepare;

/// No description provided for @sftpRmrfDirSummary.
/// No description provided for @sftpRmrDirSummary.
///
/// In en, this message translates to:
/// **'Use `rm -rf` to delete a folder in SFTP.'**
String get sftpRmrfDirSummary;
/// **'Use `rm -r` to delete a folder in SFTP.'**
String get sftpRmrDirSummary;

/// No description provided for @sftpSSHConnected.
///
Expand Down
2 changes: 1 addition & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ class SDe extends S {
String get sftpDlPrepare => 'Verbindung vorbereiten...';

@override
String get sftpRmrfDirSummary => 'Verwenden Sie \"rm -rf\", um das Verzeichnis in SFTP zu löschen.';
String get sftpRmrDirSummary => 'Verwenden Sie \"rm -r\", um das Verzeichnis in SFTP zu löschen.';

@override
String get sftpSSHConnected => 'SFTP Verbunden';
Expand Down
2 changes: 1 addition & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ class SEn extends S {
String get sftpDlPrepare => 'Preparing to connect...';

@override
String get sftpRmrfDirSummary => 'Use `rm -rf` to delete a folder in SFTP.';
String get sftpRmrDirSummary => 'Use `rm -r` to delete a folder in SFTP.';

@override
String get sftpSSHConnected => 'SFTP Connected';
Expand Down
2 changes: 1 addition & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ class SId extends S {
String get sftpDlPrepare => 'Bersiap untuk terhubung ...';

@override
String get sftpRmrfDirSummary => 'Gunakan `rm -rf` untuk menghapus dir di SFTP';
String get sftpRmrDirSummary => 'Gunakan `rm -r` untuk menghapus dir di SFTP';

@override
String get sftpSSHConnected => 'Sftp terhubung';
Expand Down
4 changes: 2 additions & 2 deletions .dart_tool/flutter_gen/gen_l10n/l10n_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ class SZh extends S {
String get sftpDlPrepare => '准备连接至服务器...';

@override
String get sftpRmrfDirSummary => '在 SFTP 中使用 `rm -rf` 来删除文件夹';
String get sftpRmrDirSummary => '在 SFTP 中使用 `rm -r` 来删除文件夹';

@override
String get sftpSSHConnected => 'SFTP 已连接...';
Expand Down Expand Up @@ -1318,7 +1318,7 @@ class SZhTw extends SZh {
String get sftpDlPrepare => '準備連接至服務器...';

@override
String get sftpRmrfDirSummary => '在 SFTP 中使用 `rm -rf` 來刪除文件夾';
String get sftpRmrDirSummary => '在 SFTP 中使用 `rm -r` 來刪除文件夾';

@override
String get sftpSSHConnected => 'SFTP 已連接...';
Expand Down
36 changes: 18 additions & 18 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -596,7 +596,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -720,7 +720,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -730,7 +730,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -748,7 +748,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -758,7 +758,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -779,7 +779,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -792,7 +792,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
Expand All @@ -818,7 +818,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -831,7 +831,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -854,7 +854,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -867,7 +867,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -890,7 +890,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -902,7 +902,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
Expand Down Expand Up @@ -931,7 +931,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -943,7 +943,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
Expand All @@ -969,7 +969,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 577;
CURRENT_PROJECT_VERSION = 578;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -981,7 +981,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.577;
MARKETING_VERSION = 1.0.578;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
Expand Down
18 changes: 5 additions & 13 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,14 @@ class MyApp extends StatelessWidget {

Widget _wrapSystemColor(BuildContext context, Widget child) {
return DynamicColorBuilder(builder: (light, dark) {
_setupPrimaryColor(context, light, dark);
if (context.isDark && light != null) {
primaryColor = light.primary;
} else if (!context.isDark && dark != null) {
primaryColor = dark.primary;
}
return child;
});
}

void _setupPrimaryColor(
BuildContext context,
ColorScheme? light,
ColorScheme? dark,
) {
if (context.isDark && light != null) {
primaryColor = light.primary;
} else if (!context.isDark && dark != null) {
primaryColor = dark.primary;
}
}
}

ThemeData _getAmoledTheme(ThemeData darkTheme) => darkTheme.copyWith(
Expand Down
87 changes: 50 additions & 37 deletions lib/core/extension/context/dialog.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'package:choice/choice.dart';
import 'package:flutter/material.dart';
import 'package:toolbox/core/extension/context/common.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/view/widget/choice_chip.dart';

import '../../../data/model/server/snippet.dart';
import '../../../data/res/ui.dart';
import '../../../view/widget/input_field.dart';
import '../../../view/widget/picker.dart';
import '../../route.dart';

extension DialogX on BuildContext {
Future<T?> showRoundDialog<T>({
Expand Down Expand Up @@ -53,45 +51,60 @@ extension DialogX on BuildContext {
);
}

void showSnippetDialog(
void Function(Snippet s) onSelected,
) {
if (Pros.snippet.snippets.isEmpty) {
showRoundDialog(
child: Text(l10n.noSavedSnippet),
actions: [
TextButton(
onPressed: () => pop(),
child: Text(l10n.ok),
),
TextButton(
onPressed: () {
pop();
AppRoute.snippetEdit().go(this);
},
child: Text(l10n.add),
)
],
);
return;
}

var snippet = Pros.snippet.snippets.first;
showRoundDialog(
Future<List<T>?> showPickDialog<T>({
required List<T?> items,
required String Function(T) name,
bool multi = true,
}) async {
var vals = <T>[];
final sure = await showRoundDialog<bool>(
title: Text(l10n.choose),
child: Picker(
items: Pros.snippet.snippets.map((e) => Text(e.name)).toList(),
onSelected: (idx) => snippet = Pros.snippet.snippets[idx],
child: Choice<T>(
onChanged: (value) => vals = value,
multiple: multi,
clearable: true,
builder: (state, _) {
return Wrap(
children: List<Widget>.generate(
items.length,
(index) {
final item = items[index];
if (item == null) return UIs.placeholder;
return ChoiceChipX<T>(
label: name(item),
state: state,
value: item,
);
},
),
);
},
),
actions: [
TextButton(
onPressed: () async {
pop();
onSelected(snippet);
},
onPressed: () => pop(true),
child: Text(l10n.ok),
)
),
],
);
if (sure == true && vals.isNotEmpty) {
return vals;
}
return null;
}

Future<T?> showPickSingleDialog<T>({
required List<T?> items,
required String Function(T) name,
}) async {
final vals = await showPickDialog<T>(
items: items,
name: name,
multi: false,
);
if (vals != null && vals.isNotEmpty) {
return vals.first;
}
return null;
}
}
6 changes: 3 additions & 3 deletions lib/data/res/build_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

class BuildData {
static const String name = "ServerBox";
static const int build = 577;
static const int build = 578;
static const String engine = "3.13.5";
static const String buildAt = "2023-09-25 18:52:38";
static const int modifications = 3;
static const String buildAt = "2023-09-25 19:49:19";
static const int modifications = 4;
static const int script = 19;
}
6 changes: 3 additions & 3 deletions lib/data/store/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ class SettingStore extends PersistentStore {
true,
);

/// Whether use `rm -rf` to delete directory on SFTP
late final sftpRmrfDir = StoreProperty(
/// Whether use `rm -r` to delete directory on SFTP
late final sftpRmrDir = StoreProperty(
box,
'sftpRmrfDir',
'sftpRmrDir',
false,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"serverTabUnkown": "Unbekannter Status",
"setting": "Einstellungen",
"sftpDlPrepare": "Verbindung vorbereiten...",
"sftpRmrfDirSummary": "Verwenden Sie \"rm -rf\", um das Verzeichnis in SFTP zu löschen.",
"sftpRmrDirSummary": "Verwenden Sie \"rm -r\", um das Verzeichnis in SFTP zu löschen.",
"sftpSSHConnected": "SFTP Verbunden",
"showDistLogo": "Distributionslogo anzeigen",
"snippet": "Snippet",
Expand Down
Loading

0 comments on commit a23a284

Please sign in to comment.