remove literalInput

This commit is contained in:
rustdesk
2026-06-17 21:34:59 +08:00
parent 32bcbbdb2d
commit 9ca99183bf
2 changed files with 1 additions and 48 deletions

View File

@@ -393,7 +393,6 @@ class DialogTextField extends StatelessWidget {
final TextInputType? keyboardType;
final List<TextInputFormatter>? inputFormatters;
final int? maxLength;
final bool literalInput;
static const kUsernameTitle = 'Username';
static const kUsernameIcon = Icon(Icons.account_circle_outlined);
@@ -412,7 +411,6 @@ class DialogTextField extends StatelessWidget {
this.keyboardType,
this.inputFormatters,
this.maxLength,
this.literalInput = false,
required this.title,
required this.controller})
: super(key: key);
@@ -437,17 +435,7 @@ class DialogTextField extends StatelessWidget {
focusNode: focusNode,
autofocus: true,
obscureText: obscureText,
keyboardType: keyboardType ??
(literalInput ? TextInputType.visiblePassword : null),
textCapitalization: TextCapitalization.none,
autocorrect: !literalInput,
enableSuggestions: !literalInput,
smartDashesType: literalInput ? SmartDashesType.disabled : null,
smartQuotesType: literalInput ? SmartQuotesType.disabled : null,
enableIMEPersonalizedLearning: !literalInput,
spellCheckConfiguration: literalInput
? const SpellCheckConfiguration.disabled()
: null,
keyboardType: keyboardType,
inputFormatters: inputFormatters,
maxLength: maxLength,
),

View File

@@ -1,35 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_hbb/common/widgets/dialog.dart';
void main() {
testWidgets('DialogTextField can preserve literal input', (tester) async {
final controller = TextEditingController(text: 'P@ss1c1E=');
addTearDown(controller.dispose);
await tester.pumpWidget(MaterialApp(
home: Scaffold(
body: DialogTextField(
title: 'Password',
controller: controller,
literalInput: true,
),
),
));
final textField = tester.widget<TextField>(find.byType(TextField));
expect(textField.controller, controller);
expect(textField.keyboardType, TextInputType.visiblePassword);
expect(textField.textCapitalization, TextCapitalization.none);
expect(textField.autocorrect, isFalse);
expect(textField.enableSuggestions, isFalse);
expect(textField.smartDashesType, SmartDashesType.disabled);
expect(textField.smartQuotesType, SmartQuotesType.disabled);
expect(textField.enableIMEPersonalizedLearning, isFalse);
expect(
textField.spellCheckConfiguration,
const SpellCheckConfiguration.disabled(),
);
});
}