opt. for pkg

This commit is contained in:
lollipopkit
2023-05-07 20:44:15 +08:00
parent ffae93cc72
commit a2361da560
5 changed files with 107 additions and 103 deletions

View File

@@ -359,7 +359,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 = 286; CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -367,7 +367,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.286; MARKETING_VERSION = 1.0.287;
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";
@@ -490,7 +490,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 = 286; CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -498,7 +498,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.286; MARKETING_VERSION = 1.0.287;
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";
@@ -515,7 +515,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 = 286; CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -523,7 +523,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.286; MARKETING_VERSION = 1.0.287;
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";

View File

@@ -2,8 +2,8 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 286; static const int build = 287;
static const String engine = "3.7.11"; static const String engine = "3.7.11";
static const String buildAt = "2023-05-07 18:10:41.721685"; static const String buildAt = "2023-05-07 18:25:45.312302";
static const int modifications = 19; static const int modifications = 2;
} }

View File

@@ -120,107 +120,111 @@ class _PkgManagePageState extends State<PkgManagePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Consumer<PkgProvider>(builder: (_, pkg, __) {
appBar: AppBar( return Scaffold(
centerTitle: true, appBar: AppBar(
title: TwoLineText(up: _s.pkg, down: widget.spi.name), centerTitle: true,
), title: TwoLineText(up: _s.pkg, down: widget.spi.name),
body: Consumer<PkgProvider>(builder: (_, apt, __) { ),
if (apt.error != null) { body: _buildBody(pkg),
return Column( floatingActionButton: _buildFAB(pkg),
mainAxisAlignment: MainAxisAlignment.center, );
children: [ });
const Icon( }
Icons.error,
color: Colors.redAccent, Widget _buildFAB(PkgProvider pkg) {
size: 37, if (pkg.isBusy || (pkg.upgradeable?.isEmpty ?? true)) {
), return const SizedBox();
const SizedBox( }
height: 37, return FloatingActionButton(
), onPressed: () {
ConstrainedBox( pkg.upgrade();
constraints: BoxConstraints( },
maxHeight: _media.size.height * 0.3, child: const Icon(Icons.upgrade),
minWidth: _media.size.width),
child: Padding(
padding: const EdgeInsets.all(17),
child: RoundRectCard(
SingleChildScrollView(
padding: const EdgeInsets.all(17),
child: Text(
apt.error!,
),
),
),
),
),
],
);
}
if (apt.updateLog == null && apt.upgradeable == null) {
return centerLoading;
}
if (apt.updateLog != null && apt.upgradeable == null) {
return SizedBox(
height:
_media.size.height - _media.padding.top - _media.padding.bottom,
child: ConstrainedBox(
constraints: const BoxConstraints.expand(),
child: SingleChildScrollView(
padding: const EdgeInsets.all(18),
controller: _scrollControllerUpdate,
child: Text(apt.updateLog!),
),
),
);
}
return ListView(
padding: const EdgeInsets.all(13),
children: [
_buildUpdatePanel(apt),
].map((e) => RoundRectCard(e)).toList(),
);
}),
); );
} }
Widget _buildUpdatePanel(PkgProvider apt) { Widget _buildBody(PkgProvider pkg) {
if (pkg.error != null) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.error,
color: Colors.redAccent,
size: 37,
),
const SizedBox(
height: 37,
),
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: _media.size.height * 0.3,
minWidth: _media.size.width),
child: Padding(
padding: const EdgeInsets.all(17),
child: RoundRectCard(
SingleChildScrollView(
padding: const EdgeInsets.all(17),
child: Text(
pkg.error!,
),
),
),
),
),
],
);
}
if (pkg.upgradeable == null) {
if (pkg.updateLog == null) {
return centerLoading;
}
return SizedBox(
height: _media.size.height - _media.padding.top - _media.padding.bottom,
child: ConstrainedBox(
constraints: const BoxConstraints.expand(),
child: SingleChildScrollView(
padding: const EdgeInsets.all(18),
controller: _scrollControllerUpdate,
child: Text(pkg.updateLog!),
),
),
);
}
return ListView(
padding: const EdgeInsets.all(13),
children: _buildUpdatePanel(pkg).map((e) => RoundRectCard(e)).toList(),
);
}
List<Widget> _buildUpdatePanel(PkgProvider apt) {
final children = <Widget>[];
if (apt.upgradeable!.isEmpty) { if (apt.upgradeable!.isEmpty) {
return ListTile( children.add(ListTile(
title: Text( title: Text(
_s.noUpdateAvailable, _s.noUpdateAvailable,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
subtitle: const Text('>_<', textAlign: TextAlign.center), subtitle: const Text('>_<', textAlign: TextAlign.center),
); ));
return children;
} }
return ExpansionTile(
title: Text(_s.foundNUpdate(apt.upgradeable!.length)), if (apt.upgradeLog == null) {
subtitle: Text( children.addAll(
apt.upgradeable!.map((e) => e.package).join(', '), apt.upgradeable?.map((e) => _buildUpdateItem(e, apt)).toList() ?? [],
maxLines: 1, );
overflow: TextOverflow.ellipsis, } else {
style: grey, children.add(SingleChildScrollView(
), padding: const EdgeInsets.all(18),
initiallyExpanded: true, controller: _scrollController,
children: apt.upgradeLog == null child: Text(apt.upgradeLog ?? ''),
? [ ));
TextButton( }
child: Text(_s.updateAll),
onPressed: () { return children;
apt.upgrade();
},
),
...apt.upgradeable!.map((e) => _buildUpdateItem(e, apt)).toList()
]
: [
SingleChildScrollView(
padding: const EdgeInsets.all(18),
controller: _scrollController,
child: Text(apt.upgradeLog!),
)
],
);
} }
Widget _buildUpdateItem(UpgradePkgInfo info, PkgProvider apt) { Widget _buildUpdateItem(UpgradePkgInfo info, PkgProvider apt) {

View File

@@ -184,7 +184,7 @@ class _SFTPPageState extends State<SFTPPage> {
if (_status.files == null) { if (_status.files == null) {
_status.path = AbsolutePath('/'); _status.path = AbsolutePath('/');
listDir(path: '/', client: _client); listDir(path: '/', client: _client);
return centerSizedLoading; return centerLoading;
} else { } else {
return RefreshIndicator( return RefreshIndicator(
child: FadeIn( child: FadeIn(