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;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 286;
CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -367,7 +367,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.286;
MARKETING_VERSION = 1.0.287;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -490,7 +490,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 286;
CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -498,7 +498,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.286;
MARKETING_VERSION = 1.0.287;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -515,7 +515,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 286;
CURRENT_PROJECT_VERSION = 287;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -523,7 +523,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.286;
MARKETING_VERSION = 1.0.287;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -2,8 +2,8 @@
class BuildData {
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 buildAt = "2023-05-07 18:10:41.721685";
static const int modifications = 19;
static const String buildAt = "2023-05-07 18:25:45.312302";
static const int modifications = 2;
}

View File

@@ -120,107 +120,111 @@ class _PkgManagePageState extends State<PkgManagePage>
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: TwoLineText(up: _s.pkg, down: widget.spi.name),
),
body: Consumer<PkgProvider>(builder: (_, apt, __) {
if (apt.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(
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(),
);
}),
return Consumer<PkgProvider>(builder: (_, pkg, __) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: TwoLineText(up: _s.pkg, down: widget.spi.name),
),
body: _buildBody(pkg),
floatingActionButton: _buildFAB(pkg),
);
});
}
Widget _buildFAB(PkgProvider pkg) {
if (pkg.isBusy || (pkg.upgradeable?.isEmpty ?? true)) {
return const SizedBox();
}
return FloatingActionButton(
onPressed: () {
pkg.upgrade();
},
child: const Icon(Icons.upgrade),
);
}
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) {
return ListTile(
children.add(ListTile(
title: Text(
_s.noUpdateAvailable,
textAlign: TextAlign.center,
),
subtitle: const Text('>_<', textAlign: TextAlign.center),
);
));
return children;
}
return ExpansionTile(
title: Text(_s.foundNUpdate(apt.upgradeable!.length)),
subtitle: Text(
apt.upgradeable!.map((e) => e.package).join(', '),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: grey,
),
initiallyExpanded: true,
children: apt.upgradeLog == null
? [
TextButton(
child: Text(_s.updateAll),
onPressed: () {
apt.upgrade();
},
),
...apt.upgradeable!.map((e) => _buildUpdateItem(e, apt)).toList()
]
: [
SingleChildScrollView(
padding: const EdgeInsets.all(18),
controller: _scrollController,
child: Text(apt.upgradeLog!),
)
],
);
if (apt.upgradeLog == null) {
children.addAll(
apt.upgradeable?.map((e) => _buildUpdateItem(e, apt)).toList() ?? [],
);
} else {
children.add(SingleChildScrollView(
padding: const EdgeInsets.all(18),
controller: _scrollController,
child: Text(apt.upgradeLog ?? ''),
));
}
return children;
}
Widget _buildUpdateItem(UpgradePkgInfo info, PkgProvider apt) {

View File

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