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.helper,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
this.error = '',
|
this.error = '',
|
||||||
|
this.maxLines = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
final TextEditingController controller;
|
final TextEditingController controller;
|
||||||
@@ -29,6 +30,7 @@ class SettingsTextField extends StatelessWidget {
|
|||||||
final String helper;
|
final String helper;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
final String error;
|
final String error;
|
||||||
|
final int maxLines;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -61,6 +63,7 @@ class SettingsTextField extends StatelessWidget {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
|
maxLines: maxLines,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
@@ -104,6 +107,7 @@ class SettingsTextField extends StatelessWidget {
|
|||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
placeholder: placeholder,
|
placeholder: placeholder,
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
|
maxLines: maxLines,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
clearButtonMode: OverlayVisibilityMode.editing,
|
clearButtonMode: OverlayVisibilityMode.editing,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class SettingsConnectionSection extends StatelessWidget {
|
|||||||
helper: serverUrlHelper,
|
helper: serverUrlHelper,
|
||||||
error: controller.urlError,
|
error: controller.urlError,
|
||||||
onChanged: controller.updateServerUrl,
|
onChanged: controller.updateServerUrl,
|
||||||
|
maxLines: 2,
|
||||||
),
|
),
|
||||||
const SizedBox(height: settingsTitleGap),
|
const SizedBox(height: settingsTitleGap),
|
||||||
SettingsActions(
|
SettingsActions(
|
||||||
|
|||||||
@@ -44,6 +44,33 @@ void main() {
|
|||||||
expect(factory.channels, isEmpty);
|
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', (
|
testWidgets('an invalid URL shows the field error and opens no socket', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user