mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-31 13:25:10 +01:00
opt
- optimize TextField - opt apt pwd req times - use logger in update.dart
This commit is contained in:
@@ -59,16 +59,17 @@ class _AptManagePageState extends State<AptManagePage>
|
||||
}
|
||||
|
||||
// ignore: prefer_function_declarations_over_variables
|
||||
PwdRequestFunc onPwdRequest = (user) async {
|
||||
PwdRequestFunc onPwdRequest = (lastTime, user) async {
|
||||
if (!mounted) return '';
|
||||
final textController = TextEditingController();
|
||||
await showRoundDialog(
|
||||
context,
|
||||
s.pwdForUser(user ?? s.unknown),
|
||||
lastTime ? s.lastTry : (user ?? s.unknown),
|
||||
TextField(
|
||||
controller: textController,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
obscureText: true,
|
||||
onSubmitted: (_) => textController.text.trim(),
|
||||
decoration: InputDecoration(
|
||||
labelText: s.pwd,
|
||||
),
|
||||
|
||||
@@ -89,7 +89,8 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
Widget _buildInputTop() {
|
||||
return SizedBox(
|
||||
height: _media.size.height * 0.33,
|
||||
child: buildInput(context, _textEditingController),
|
||||
child: buildInput(context, _textEditingController,
|
||||
onSubmitted: (_) => _textEditingControllerResult.text = doConvert()),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,8 @@ class _PingPageState extends State<PingPage>
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
child: Column(children: [
|
||||
const SizedBox(height: 13),
|
||||
buildInput(context, _textEditingController, maxLines: 1),
|
||||
buildInput(context, _textEditingController,
|
||||
maxLines: 1, onSubmitted: (_) => doPing()),
|
||||
_buildControl(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -209,7 +209,8 @@ class _ServerPageState extends State<ServerPage>
|
||||
_buildExplainText('Net'),
|
||||
_buildExplainText('Disk'),
|
||||
],
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -218,7 +219,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
return DropdownButtonHideUnderline(
|
||||
child: DropdownButton2(
|
||||
customButton: const Padding(
|
||||
padding: EdgeInsets.only(left: 7),
|
||||
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 1.7),
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
size: 17,
|
||||
|
||||
@@ -2,16 +2,21 @@ import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
Widget buildInput(BuildContext context, TextEditingController controller,
|
||||
{int maxLines = 20, String? hint}) {
|
||||
{int maxLines = 20,
|
||||
String? hint,
|
||||
Function(String)? onSubmitted,
|
||||
bool? obscureText}) {
|
||||
return RoundRectCard(
|
||||
TextField(
|
||||
maxLines: maxLines,
|
||||
onSubmitted: onSubmitted,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Theme.of(context).cardColor,
|
||||
hintText: hint,
|
||||
filled: true,
|
||||
border: InputBorder.none),
|
||||
controller: controller,
|
||||
obscureText: obscureText ?? false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user