Merge branch 'main' into flutter/design-templates
This commit is contained in:
@@ -21,6 +21,7 @@ class SettingsTextField extends StatelessWidget {
|
||||
required this.helper,
|
||||
required this.onChanged,
|
||||
this.error = '',
|
||||
this.maxLines = 1,
|
||||
});
|
||||
|
||||
final TextEditingController controller;
|
||||
@@ -29,6 +30,7 @@ class SettingsTextField extends StatelessWidget {
|
||||
final String helper;
|
||||
final ValueChanged<String> onChanged;
|
||||
final String error;
|
||||
final int maxLines;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -61,6 +63,7 @@ class SettingsTextField extends StatelessWidget {
|
||||
controller: controller,
|
||||
onChanged: onChanged,
|
||||
keyboardType: TextInputType.url,
|
||||
maxLines: maxLines,
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
textInputAction: TextInputAction.done,
|
||||
@@ -104,6 +107,7 @@ class SettingsTextField extends StatelessWidget {
|
||||
onChanged: onChanged,
|
||||
placeholder: placeholder,
|
||||
keyboardType: TextInputType.url,
|
||||
maxLines: maxLines,
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
clearButtonMode: OverlayVisibilityMode.editing,
|
||||
|
||||
@@ -37,6 +37,7 @@ class SettingsConnectionSection extends StatelessWidget {
|
||||
helper: serverUrlHelper,
|
||||
error: controller.urlError,
|
||||
onChanged: controller.updateServerUrl,
|
||||
maxLines: 2,
|
||||
),
|
||||
const SizedBox(height: settingsTitleGap),
|
||||
SettingsActions(
|
||||
|
||||
@@ -44,6 +44,33 @@ void main() {
|
||||
expect(factory.channels, isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('long server URLs can wrap in a narrow settings viewport', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final client = transport.PipelinesClient(
|
||||
channelFactory: FakeChannelFactory().call,
|
||||
);
|
||||
addTearDown(client.dispose);
|
||||
await _pump(
|
||||
tester,
|
||||
client,
|
||||
store: MemorySettingsStore(
|
||||
serverUrl:
|
||||
'wss://a-very-long-server-hostname-that-exceeds-a-mobile-field.test:8123/connect',
|
||||
),
|
||||
);
|
||||
|
||||
final field = tester.widget<TextField>(find.byType(TextField).first);
|
||||
expect(field.maxLines, 2);
|
||||
expect(field.controller?.text, contains('/connect'));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('an invalid URL shows the field error and opens no socket', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user