Skip to content

Commit

Permalink
rm: pkg (#494)
Browse files Browse the repository at this point in the history
Fixes #470
  • Loading branch information
lollipopkit authored Jul 26, 2024
1 parent 6a02546 commit ceedd86
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 170 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/rel


## 🔖 Feature
- `Status chart` (CPU, Sensors, GPU...), `SSH` Term, `SFTP`, `Docker & Pkg & Process`...
- `Status chart` (CPU, Sensors, GPU...), `SSH` Term, `SFTP`, `Docker & Process`...
- Platform specific: `Bio auth``Msg push``Home widget``watchOS App`...
- English, 简体中文; Deutsch [@its-tom](https://github.com/its-tom), 繁體中文 [@kalashnikov](https://github.com/kalashnikov), Indonesian [@azkadev](https://github.com/azkadev), Français [@FrancXPT](https://github.com/FrancXPT), Dutch [@QazCetelic](https://github.com/QazCetelic); Español, Русский язык, Português, 日本語 (Generated by GPT)

Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/rel


## 🔖 特点
- `状态图表`(CPU、传感器、GPU 等), `SSH` 终端, `SFTP`, `Docker & 包 & 进程` 管理器...
- `状态图表`(CPU、传感器、GPU 等), `SSH` 终端, `SFTP`, `Docker & 进程` 管理...
- 特殊支持:`生物认证``推送``桌面小部件``watchOS App``跟随系统颜色`...
- 本地化
- English, 简体中文
Expand Down
10 changes: 5 additions & 5 deletions lib/data/model/app/menu/server_func.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ enum ServerFuncBtn {
container,
@HiveField(3)
process,
@HiveField(4)
pkg,
//@HiveField(4)
//pkg,
@HiveField(5)
snippet,
@HiveField(6)
Expand All @@ -30,14 +30,14 @@ enum ServerFuncBtn {
sftp,
container,
process,
pkg,
//pkg,
snippet,
].map((e) => e.index).toList();

IconData get icon => switch (this) {
sftp => Icons.insert_drive_file,
snippet => Icons.code,
pkg => Icons.system_security_update,
//pkg => Icons.system_security_update,
container => FontAwesome.docker_brand,
process => Icons.list_alt_outlined,
terminal => Icons.terminal,
Expand All @@ -47,7 +47,7 @@ enum ServerFuncBtn {
String get toStr => switch (this) {
sftp => 'SFTP',
snippet => l10n.snippet,
pkg => l10n.pkg,
//pkg => l10n.pkg,
container => l10n.container,
process => l10n.process,
terminal => l10n.terminal,
Expand Down
5 changes: 0 additions & 5 deletions lib/data/model/app/menu/server_func.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions lib/view/page/server/edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,6 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
hint: 'root',
suggestion: false,
),
Input(
controller: _altUrlController,
type: TextInputType.url,
node: _alterUrlFocus,
label: l10n.fallbackSshDest,
icon: MingCute.link_line,
hint: 'user@ip:port',
suggestion: false,
),
TagEditor(
tags: _tags,
onChanged: (p0) => _tags = p0,
Expand Down Expand Up @@ -328,19 +319,16 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
return ExpandTile(
title: Text(l10n.more),
children: [
const Text('Logo', style: UIs.text13Grey),
UIs.height7,
Input(
controller: _logoUrlCtrl,
type: TextInputType.url,
icon: Icons.image,
label: 'URL',
label: 'Logo URL',
hint: 'https://example.com/logo.png',
suggestion: false,
),
UIs.height7,
Text(l10n.envVars, style: UIs.text13Grey),
UIs.height7,
_buildAltUrl(),
_buildEnvs(),
UIs.height7,
..._buildPVEs(),
Expand All @@ -363,6 +351,18 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
);
}

Widget _buildAltUrl() {
return Input(
controller: _altUrlController,
type: TextInputType.url,
node: _alterUrlFocus,
label: l10n.fallbackSshDest,
icon: MingCute.link_line,
hint: 'user@ip:port',
suggestion: false,
);
}

List<Widget> _buildPVEs() {
const addr = 'https://127.0.0.1:8006';
return [
Expand Down
133 changes: 73 additions & 60 deletions lib/view/page/server/tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class ServerPage extends StatefulWidget {
State<ServerPage> createState() => _ServerPageState();
}

const _cardPad = 74.0;
const _cardPadSingle = 13.0;

class _ServerPageState extends State<ServerPage>
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
late MediaQueryData _media;
Expand Down Expand Up @@ -97,7 +100,7 @@ class _ServerPageState extends State<ServerPage>
),
floatingActionButton: AutoHide(
key: _autoHideKey,
direction: AxisDirection.down,
direction: AxisDirection.right,
offset: 75,
controller: _scrollController,
child: FloatingActionButton(
Expand Down Expand Up @@ -289,8 +292,12 @@ class _ServerPageState extends State<ServerPage>
}
},
child: Padding(
padding:
const EdgeInsets.only(left: 13, right: 3, top: 13, bottom: 13),
padding: const EdgeInsets.only(
left: _cardPadSingle,
right: 3,
top: _cardPadSingle,
bottom: _cardPadSingle,
),
child: _buildRealServerCard(srv),
),
),
Expand All @@ -300,7 +307,7 @@ class _ServerPageState extends State<ServerPage>
/// The child's width mat not equal to 1/4 of the screen width,
/// so we need to wrap it with a SizedBox.
Widget _wrapWithSizedbox(Widget child, [bool circle = false]) {
var width = (_media.size.width - 74) / (circle ? 4 : 4.3);
var width = (_media.size.width - _cardPad) / (circle ? 4 : 4.3);
if (_useDoubleColumn) width /= 2;
return SizedBox(
width: width,
Expand Down Expand Up @@ -341,66 +348,72 @@ class _ServerPageState extends State<ServerPage>
}

List<Widget> _buildFlippedCard(Server srv) {
final children = [
IconTextBtn(
onPressed: () => _askFor(
func: () async {
if (Stores.setting.showSuspendTip.fetch()) {
await context.showRoundDialog(
title: l10n.attention,
child: Text(l10n.suspendTip),
);
Stores.setting.showSuspendTip.put(false);
}
srv.client?.execWithPwd(
ShellFunc.suspend.exec,
context: context,
id: srv.id,
);
},
typ: l10n.suspend,
name: srv.spi.name,
),
icon: Icons.stop,
text: l10n.suspend,
),
IconTextBtn(
onPressed: () => _askFor(
func: () => srv.client?.execWithPwd(
ShellFunc.shutdown.exec,
context: context,
id: srv.id,
),
typ: l10n.shutdown,
name: srv.spi.name,
),
icon: Icons.power_off,
text: l10n.shutdown,
),
IconTextBtn(
onPressed: () => _askFor(
func: () => srv.client?.execWithPwd(
ShellFunc.reboot.exec,
context: context,
id: srv.id,
),
typ: l10n.reboot,
name: srv.spi.name,
),
icon: Icons.restart_alt,
text: l10n.reboot,
),
IconTextBtn(
onPressed: () => AppRoutes.serverEdit(spi: srv.spi).go(context),
icon: Icons.edit,
text: l10n.edit,
)
];

final width = (_media.size.width - _cardPad) / children.length;
return [
UIs.height13,
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
IconTextBtn(
onPressed: () => _askFor(
func: () async {
if (Stores.setting.showSuspendTip.fetch()) {
await context.showRoundDialog(
title: l10n.attention,
child: Text(l10n.suspendTip),
);
Stores.setting.showSuspendTip.put(false);
}
srv.client?.execWithPwd(
ShellFunc.suspend.exec,
context: context,
id: srv.id,
);
},
typ: l10n.suspend,
name: srv.spi.name,
),
icon: Icons.stop,
text: l10n.suspend,
),
IconTextBtn(
onPressed: () => _askFor(
func: () => srv.client?.execWithPwd(
ShellFunc.shutdown.exec,
context: context,
id: srv.id,
),
typ: l10n.shutdown,
name: srv.spi.name,
),
icon: Icons.power_off,
text: l10n.shutdown,
),
IconTextBtn(
onPressed: () => _askFor(
func: () => srv.client?.execWithPwd(
ShellFunc.reboot.exec,
context: context,
id: srv.id,
),
typ: l10n.reboot,
name: srv.spi.name,
),
icon: Icons.restart_alt,
text: l10n.reboot,
),
IconTextBtn(
onPressed: () => AppRoutes.serverEdit(spi: srv.spi).go(context),
icon: Icons.edit,
text: l10n.edit,
)
],
)
children: children.map((e) {
if (width == 0) return e;
return SizedBox(width: width, child: e);
}).toList(),
),
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/view/page/setting/seq/srv_func_seq.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _ServerDetailOrderPageState extends State<ServerFuncBtnsOrderPage> {
text: TextSpan(
children: [
WidgetSpan(child: Icon(funcBtn.icon)),
const WidgetSpan(child: UIs.width7),
const WidgetSpan(child: UIs.width13),
TextSpan(text: funcBtn.toStr, style: UIs.textGrey),
],
),
Expand Down
Loading

0 comments on commit ceedd86

Please sign in to comment.