fix: server card height
This commit is contained in:
@@ -57,7 +57,12 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
_docker.init(client, widget.spi.user, onPwdRequest, widget.spi.id);
|
||||
_docker.init(
|
||||
client,
|
||||
widget.spi.user,
|
||||
(user) async => await showPwdDialog(context, user),
|
||||
widget.spi.id,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -183,53 +188,6 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
return 'docker run -itd --name $name $suffix';
|
||||
}
|
||||
|
||||
void onSubmitted() {
|
||||
context.pop();
|
||||
if (_textController.text == '') {
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.fieldMustNotEmpty),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.ok),
|
||||
),
|
||||
],
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> onPwdRequest() async {
|
||||
if (!mounted) return '';
|
||||
await showRoundDialog(
|
||||
context: context,
|
||||
title: Text(widget.spi.user),
|
||||
child: Input(
|
||||
controller: _textController,
|
||||
type: TextInputType.visiblePassword,
|
||||
obscureText: true,
|
||||
onSubmitted: (_) => onSubmitted(),
|
||||
label: _s.pwd,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
context.pop();
|
||||
},
|
||||
child: Text(_s.cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: onSubmitted,
|
||||
child: Text(_s.ok, style: textRed),
|
||||
),
|
||||
],
|
||||
);
|
||||
return _textController.text.trim();
|
||||
}
|
||||
|
||||
Widget _buildMain() {
|
||||
if (_docker.error != null && _docker.items == null) {
|
||||
return SizedBox.expand(
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/extension/context.dart';
|
||||
import 'package:toolbox/view/widget/input_field.dart';
|
||||
|
||||
import '../../data/model/pkg/upgrade_info.dart';
|
||||
import '../../data/model/server/dist.dart';
|
||||
@@ -63,7 +61,7 @@ class _PkgManagePageState extends State<PkgPage>
|
||||
_scrollController.jumpTo(_scrollController.position.maxScrollExtent),
|
||||
() => _scrollControllerUpdate
|
||||
.jumpTo(_scrollController.position.maxScrollExtent),
|
||||
onPwdRequest,
|
||||
(user) async => await showPwdDialog(context, user),
|
||||
widget.spi.user,
|
||||
);
|
||||
_pkgProvider.refresh();
|
||||
@@ -83,53 +81,6 @@ class _PkgManagePageState extends State<PkgPage>
|
||||
});
|
||||
}
|
||||
|
||||
void onSubmitted() {
|
||||
if (_textController.text == '') {
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.fieldMustNotEmpty),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.ok),
|
||||
),
|
||||
],
|
||||
);
|
||||
return;
|
||||
}
|
||||
context.pop();
|
||||
}
|
||||
|
||||
Future<String> onPwdRequest() async {
|
||||
if (!mounted) return '';
|
||||
await showRoundDialog(
|
||||
context: context,
|
||||
title: Text(widget.spi.user),
|
||||
child: Input(
|
||||
autoFocus: true,
|
||||
controller: _textController,
|
||||
type: TextInputType.visiblePassword,
|
||||
obscureText: true,
|
||||
onSubmitted: (_) => onSubmitted(),
|
||||
label: _s.pwd,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
context.pop();
|
||||
},
|
||||
child: Text(_s.cancel)),
|
||||
TextButton(
|
||||
onPressed: () => onSubmitted(),
|
||||
child: Text(_s.ok, style: textRed),
|
||||
),
|
||||
],
|
||||
);
|
||||
return _textController.text.trim();
|
||||
}
|
||||
|
||||
Widget? _buildFAB(PkgProvider pkg) {
|
||||
if (pkg.upgradeable?.isEmpty ?? true) {
|
||||
return null;
|
||||
|
||||
@@ -218,11 +218,10 @@ class _ServerPageState extends State<ServerPage>
|
||||
Widget _buildRealServerCard(Server srv) {
|
||||
final title = _buildServerCardTitle(srv.status, srv.state, srv.spi);
|
||||
final List<Widget> children = [title];
|
||||
if (srv.state != ServerState.finished) {
|
||||
// Do nothing
|
||||
} else if (_flipedCardIds.contains(srv.spi.id)) {
|
||||
|
||||
if (_flipedCardIds.contains(srv.spi.id)) {
|
||||
children.addAll(_buildFlipedCard(srv));
|
||||
} else {
|
||||
} else if (srv.state == ServerState.finished) {
|
||||
children.addAll(_buildNormalCard(srv.status, srv.spi));
|
||||
}
|
||||
|
||||
@@ -245,6 +244,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// TODO: sudo | on pwd request
|
||||
IconButton(
|
||||
onPressed: () => srv.client?.run('shutdown -h now'),
|
||||
icon: const Icon(Icons.power_off),
|
||||
@@ -482,12 +482,12 @@ class _ServerPageState extends State<ServerPage>
|
||||
}
|
||||
|
||||
double _calcCardHeight(ServerState cs, String id) {
|
||||
if (cs != ServerState.finished) {
|
||||
return 23.0;
|
||||
}
|
||||
if (_flipedCardIds.contains(id)) {
|
||||
return 77.0;
|
||||
}
|
||||
if (cs != ServerState.finished) {
|
||||
return 23.0;
|
||||
}
|
||||
if (_settingStore.moveOutServerTabFuncBtns.fetch() &&
|
||||
// Discussion #146
|
||||
!_settingStore.serverTabUseOldUI.fetch()) {
|
||||
|
||||
Reference in New Issue
Block a user