mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: cntering btn text
This commit is contained in:
@@ -470,7 +470,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -478,7 +478,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -602,7 +602,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -610,7 +610,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -628,7 +628,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -636,7 +636,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -657,7 +657,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -670,7 +670,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
@@ -696,7 +696,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -709,7 +709,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -732,7 +732,7 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@@ -745,7 +745,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 489;
|
static const int build = 491;
|
||||||
static const String engine = "3.10.6";
|
static const String engine = "3.10.6";
|
||||||
static const String buildAt = "2023-08-20 22:40:51.896334";
|
static const String buildAt = "2023-08-20 23:32:07.343451";
|
||||||
static const int modifications = 3;
|
static const int modifications = 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import '../../../data/res/ui.dart';
|
|||||||
import '../../../data/store/private_key.dart';
|
import '../../../data/store/private_key.dart';
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../../widget/custom_appbar.dart';
|
import '../../widget/custom_appbar.dart';
|
||||||
import '../../widget/tag/btn.dart';
|
import '../../widget/tag.dart';
|
||||||
import '../private_key/edit.dart';
|
import '../private_key/edit.dart';
|
||||||
|
|
||||||
class ServerEditPage extends StatefulWidget {
|
class ServerEditPage extends StatefulWidget {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import '../../../data/store/setting.dart';
|
|||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../../widget/round_rect_card.dart';
|
import '../../widget/round_rect_card.dart';
|
||||||
import '../../widget/server_func_btns.dart';
|
import '../../widget/server_func_btns.dart';
|
||||||
import '../../widget/tag/switcher.dart';
|
import '../../widget/tag.dart';
|
||||||
import 'edit.dart';
|
import 'edit.dart';
|
||||||
|
|
||||||
class ServerPage extends StatefulWidget {
|
class ServerPage extends StatefulWidget {
|
||||||
@@ -425,7 +425,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
child: Text(
|
child: Text(
|
||||||
'${percent.toStringAsFixed(1)}%',
|
'${percent.toStringAsFixed(1)}%',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: textSize11Grey,
|
style: textSize11,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -52,13 +52,14 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
|||||||
final key = allKeys[idx];
|
final key = allKeys[idx];
|
||||||
final help = key.help(_s);
|
final help = key.help(_s);
|
||||||
return RoundRectCard(
|
return RoundRectCard(
|
||||||
key: ValueKey(idx),
|
key: ValueKey(idx),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: _buildTitle(key),
|
title: _buildTitle(key),
|
||||||
subtitle: help == null ? null : Text(help, style: grey),
|
subtitle: help == null ? null : Text(help, style: grey),
|
||||||
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
||||||
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
itemCount: allKeys.length,
|
itemCount: allKeys.length,
|
||||||
onReorder: (o, n) {
|
onReorder: (o, n) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import '../../../data/provider/snippet.dart';
|
|||||||
import '../../../data/res/ui.dart';
|
import '../../../data/res/ui.dart';
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../../widget/custom_appbar.dart';
|
import '../../widget/custom_appbar.dart';
|
||||||
import '../../widget/tag/btn.dart';
|
import '../../widget/tag.dart';
|
||||||
|
|
||||||
class SnippetEditPage extends StatefulWidget {
|
class SnippetEditPage extends StatefulWidget {
|
||||||
const SnippetEditPage({Key? key, this.snippet}) : super(key: key);
|
const SnippetEditPage({Key? key, this.snippet}) : super(key: key);
|
||||||
|
|||||||
@@ -2,17 +2,16 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/extension/order.dart';
|
import 'package:toolbox/core/extension/order.dart';
|
||||||
import 'package:toolbox/data/model/server/server.dart';
|
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
|
||||||
import 'package:toolbox/data/res/ui.dart';
|
|
||||||
import 'package:toolbox/view/widget/tag/switcher.dart';
|
|
||||||
|
|
||||||
import '../../../core/utils/misc.dart';
|
import '../../../core/utils/misc.dart';
|
||||||
import '../../../core/utils/ui.dart';
|
import '../../../core/utils/ui.dart';
|
||||||
|
import '../../../data/model/server/server.dart';
|
||||||
import '../../../data/model/server/snippet.dart';
|
import '../../../data/model/server/snippet.dart';
|
||||||
|
import '../../../data/provider/server.dart';
|
||||||
|
import '../../../data/res/ui.dart';
|
||||||
import '../../../data/store/setting.dart';
|
import '../../../data/store/setting.dart';
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../../widget/tag/picker.dart';
|
import '../../widget/tag.dart';
|
||||||
import '/core/route.dart';
|
import '/core/route.dart';
|
||||||
import '/data/provider/snippet.dart';
|
import '/data/provider/snippet.dart';
|
||||||
import 'edit.dart';
|
import 'edit.dart';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import '../../data/model/server/snippet.dart';
|
|||||||
import '../../data/provider/snippet.dart';
|
import '../../data/provider/snippet.dart';
|
||||||
import '../../locator.dart';
|
import '../../locator.dart';
|
||||||
import '../page/process.dart';
|
import '../page/process.dart';
|
||||||
import 'tag/picker.dart';
|
import 'tag.dart';
|
||||||
|
|
||||||
class ServerFuncBtns extends StatelessWidget {
|
class ServerFuncBtns extends StatelessWidget {
|
||||||
const ServerFuncBtns({
|
const ServerFuncBtns({
|
||||||
@@ -107,6 +107,7 @@ class ServerFuncBtns extends StatelessWidget {
|
|||||||
.map((e) => IconButton(
|
.map((e) => IconButton(
|
||||||
onPressed: () => _onTapMoreBtns(e, spi, context),
|
onPressed: () => _onTapMoreBtns(e, spi, context),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
tooltip: e.name,
|
||||||
icon: Icon(e.icon, size: iconSize ?? 15),
|
icon: Icon(e.icon, size: iconSize ?? 15),
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import 'package:toolbox/view/widget/input_field.dart';
|
|||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
import '../../../core/utils/ui.dart';
|
import '../../core/utils/ui.dart';
|
||||||
import '../../../data/res/color.dart';
|
import '../../data/res/color.dart';
|
||||||
|
|
||||||
|
const _kTagBtnHeight = 31.0;
|
||||||
|
|
||||||
class TagBtn extends StatelessWidget {
|
class TagBtn extends StatelessWidget {
|
||||||
final String content;
|
final String content;
|
||||||
@@ -26,10 +28,8 @@ class TagBtn extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
content,
|
content,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
textScaleFactor: 1.0,
|
||||||
color: isEnable ? null : Colors.grey,
|
style: isEnable ? textSize13 : textSize13Grey,
|
||||||
fontSize: 13,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
);
|
);
|
||||||
@@ -102,6 +102,7 @@ class TagEditor extends StatelessWidget {
|
|||||||
'#$tag',
|
'#$tag',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: textSize13,
|
style: textSize13,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4.0),
|
const SizedBox(width: 4.0),
|
||||||
Icon(
|
Icon(
|
||||||
@@ -173,8 +174,171 @@ class TagEditor extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _wrap(Widget child, {void Function()? onTap,
|
class TagPicker<T> extends StatefulWidget {
|
||||||
void Function()? onLongPress,}) {
|
final List<T> items;
|
||||||
|
final bool Function(T, String?) containsTag;
|
||||||
|
final String Function(T) name;
|
||||||
|
final Set<String> tags;
|
||||||
|
|
||||||
|
const TagPicker({
|
||||||
|
Key? key,
|
||||||
|
required this.items,
|
||||||
|
required this.containsTag,
|
||||||
|
required this.name,
|
||||||
|
required this.tags,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_TagPickerState<T> createState() => _TagPickerState<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TagPickerState<T> extends State<TagPicker<T>> {
|
||||||
|
late S _s;
|
||||||
|
late MediaQueryData _media;
|
||||||
|
final List<T> _selected = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
_s = S.of(context)!;
|
||||||
|
_media = MediaQuery.of(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final children = <Widget>[];
|
||||||
|
if (widget.tags.isNotEmpty) {
|
||||||
|
children.add(Text(_s.tag));
|
||||||
|
children.add(height13);
|
||||||
|
children.add(SizedBox(
|
||||||
|
height: _kTagBtnHeight,
|
||||||
|
width: _media.size.width * 0.7,
|
||||||
|
child: _buildTags(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if (widget.items.isNotEmpty) {
|
||||||
|
children.add(Text(_s.all));
|
||||||
|
children.add(height13);
|
||||||
|
children.add(SizedBox(
|
||||||
|
height: _kTagBtnHeight,
|
||||||
|
width: _media.size.width * 0.7,
|
||||||
|
child: _buildItems(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
final child = widget.tags.isEmpty && widget.items.isEmpty
|
||||||
|
? Text(_s.noOptions)
|
||||||
|
: Column(mainAxisSize: MainAxisSize.min, children: children);
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(_s.choose),
|
||||||
|
content: child,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => context.pop(_selected),
|
||||||
|
child: Text(_s.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTags() {
|
||||||
|
return ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: widget.tags.length,
|
||||||
|
itemBuilder: (_, idx) {
|
||||||
|
final item = widget.tags.elementAt(idx);
|
||||||
|
final isEnable =
|
||||||
|
widget.items.where((ele) => widget.containsTag(ele, item)).every(
|
||||||
|
(element) => _selected.contains(element),
|
||||||
|
);
|
||||||
|
return TagBtn(
|
||||||
|
isEnable: isEnable,
|
||||||
|
onTap: () {
|
||||||
|
if (isEnable) {
|
||||||
|
_selected.removeWhere(
|
||||||
|
(element) => widget.containsTag(element, item),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
_selected.addAll(widget.items.where(
|
||||||
|
(ele) => widget.containsTag(ele, item),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
content: item,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildItems() {
|
||||||
|
return ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: widget.items.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final e = widget.items[index];
|
||||||
|
return TagBtn(
|
||||||
|
isEnable: _selected.contains(e),
|
||||||
|
onTap: () {
|
||||||
|
if (_selected.contains(e)) {
|
||||||
|
_selected.remove(e);
|
||||||
|
} else {
|
||||||
|
_selected.add(e);
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
content: widget.name(e),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TagSwitcher extends StatelessWidget {
|
||||||
|
final List<String> tags;
|
||||||
|
final double width;
|
||||||
|
final void Function(String?) onTagChanged;
|
||||||
|
final String? initTag;
|
||||||
|
final String all;
|
||||||
|
|
||||||
|
const TagSwitcher({
|
||||||
|
Key? key,
|
||||||
|
required this.tags,
|
||||||
|
required this.width,
|
||||||
|
required this.onTagChanged,
|
||||||
|
required this.all,
|
||||||
|
this.initTag,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (tags.isEmpty) return placeholder;
|
||||||
|
final items = <String?>[null, ...tags];
|
||||||
|
return Container(
|
||||||
|
height: _kTagBtnHeight,
|
||||||
|
width: width,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final item = items[index];
|
||||||
|
return TagBtn(
|
||||||
|
content: item == null ? all : '#$item',
|
||||||
|
isEnable: initTag == item,
|
||||||
|
onTap: () => onTagChanged(item),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: items.length,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _wrap(
|
||||||
|
Widget child, {
|
||||||
|
void Function()? onTap,
|
||||||
|
void Function()? onLongPress,
|
||||||
|
}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(3),
|
padding: const EdgeInsets.all(3),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
@@ -185,7 +349,9 @@ Widget _wrap(Widget child, {void Function()? onTap,
|
|||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onLongPress: onLongPress,
|
onLongPress: onLongPress,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 9.7, vertical: 1.7),
|
/// Hard coded padding
|
||||||
|
/// For centering the text
|
||||||
|
padding: const EdgeInsets.fromLTRB(11.7, 2.7, 11.7, 0),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
||||||
import 'package:toolbox/core/extension/navigator.dart';
|
|
||||||
import 'package:toolbox/data/res/ui.dart';
|
|
||||||
|
|
||||||
import 'btn.dart';
|
|
||||||
|
|
||||||
class TagPicker<T> extends StatefulWidget {
|
|
||||||
final List<T> items;
|
|
||||||
final bool Function(T, String?) containsTag;
|
|
||||||
final String Function(T) name;
|
|
||||||
final Set<String> tags;
|
|
||||||
|
|
||||||
const TagPicker({
|
|
||||||
Key? key,
|
|
||||||
required this.items,
|
|
||||||
required this.containsTag,
|
|
||||||
required this.name,
|
|
||||||
required this.tags,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_TagPickerState<T> createState() => _TagPickerState<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TagPickerState<T> extends State<TagPicker<T>> {
|
|
||||||
late S _s;
|
|
||||||
late MediaQueryData _media;
|
|
||||||
final List<T> _selected = [];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
super.didChangeDependencies();
|
|
||||||
_s = S.of(context)!;
|
|
||||||
_media = MediaQuery.of(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final child = widget.tags.isEmpty && widget.items.isEmpty
|
|
||||||
? Text(_s.noOptions)
|
|
||||||
: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(_s.tag),
|
|
||||||
height13,
|
|
||||||
SizedBox(
|
|
||||||
height: 37,
|
|
||||||
width: _media.size.width * 0.7,
|
|
||||||
child: _buildTags(),
|
|
||||||
),
|
|
||||||
Text(_s.all),
|
|
||||||
height13,
|
|
||||||
SizedBox(
|
|
||||||
height: 37,
|
|
||||||
width: _media.size.width * 0.7,
|
|
||||||
child: _buildItems(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(_s.choose),
|
|
||||||
content: child,
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop(_selected);
|
|
||||||
},
|
|
||||||
child: Text(_s.ok),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildTags() {
|
|
||||||
return ListView.builder(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemCount: widget.tags.length,
|
|
||||||
itemBuilder: (_, idx) {
|
|
||||||
final item = widget.tags.elementAt(idx);
|
|
||||||
final isEnable =
|
|
||||||
widget.items.where((ele) => widget.containsTag(ele, item)).every(
|
|
||||||
(element) => _selected.contains(element),
|
|
||||||
);
|
|
||||||
return TagBtn(
|
|
||||||
isEnable: isEnable,
|
|
||||||
onTap: () {
|
|
||||||
if (isEnable) {
|
|
||||||
_selected.removeWhere(
|
|
||||||
(element) => widget.containsTag(element, item),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
_selected.addAll(widget.items.where(
|
|
||||||
(ele) => widget.containsTag(ele, item),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
content: item,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildItems() {
|
|
||||||
return ListView.builder(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemCount: widget.items.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final e = widget.items[index];
|
|
||||||
return TagBtn(
|
|
||||||
isEnable: _selected.contains(e),
|
|
||||||
onTap: () {
|
|
||||||
if (_selected.contains(e)) {
|
|
||||||
_selected.remove(e);
|
|
||||||
} else {
|
|
||||||
_selected.add(e);
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
content: widget.name(e),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:toolbox/data/res/ui.dart';
|
|
||||||
import 'package:toolbox/view/widget/tag/view.dart';
|
|
||||||
|
|
||||||
class TagSwitcher extends StatelessWidget {
|
|
||||||
final List<String> tags;
|
|
||||||
final double width;
|
|
||||||
final void Function(String?) onTagChanged;
|
|
||||||
final String? initTag;
|
|
||||||
final String all;
|
|
||||||
|
|
||||||
const TagSwitcher({
|
|
||||||
Key? key,
|
|
||||||
required this.tags,
|
|
||||||
required this.width,
|
|
||||||
required this.onTagChanged,
|
|
||||||
required this.all,
|
|
||||||
this.initTag,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (tags.isEmpty) return placeholder;
|
|
||||||
final items = <String?>[null, ...tags];
|
|
||||||
return Container(
|
|
||||||
height: 31,
|
|
||||||
width: width,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: ListView.builder(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final item = items[index];
|
|
||||||
return TagView(
|
|
||||||
tag: item,
|
|
||||||
initTag: initTag,
|
|
||||||
all: all,
|
|
||||||
onTap: onTagChanged,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
itemCount: items.length,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'btn.dart';
|
|
||||||
|
|
||||||
class TagView extends StatelessWidget {
|
|
||||||
final void Function(String?) onTap;
|
|
||||||
final String? tag;
|
|
||||||
final String? initTag;
|
|
||||||
final String all;
|
|
||||||
|
|
||||||
const TagView({
|
|
||||||
super.key,
|
|
||||||
required this.onTap,
|
|
||||||
this.tag,
|
|
||||||
this.initTag,
|
|
||||||
required this.all,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return TagBtn(
|
|
||||||
onTap: () => onTap(tag),
|
|
||||||
isEnable: initTag == tag,
|
|
||||||
content: tag == null ? all : '#$tag',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -474,9 +474,9 @@
|
|||||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -489,9 +489,9 @@
|
|||||||
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -504,9 +504,9 @@
|
|||||||
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CURRENT_PROJECT_VERSION = 489;
|
CURRENT_PROJECT_VERSION = 491;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0.489;
|
MARKETING_VERSION = 1.0.491;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user