Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] expose group id prop in text field component

Priyanshu Dangare43e06c58d541
diff --git a/mobile/packages/ente_components/lib/components/text_input_component.dart b/mobile/packages/ente_components/lib/components/text_input_component.dart
index 8e2895e906..bf90d32674 100644
--- a/mobile/packages/ente_components/lib/components/text_input_component.dart
+++ b/mobile/packages/ente_components/lib/components/text_input_component.dart
@@ -24,6 +24,7 @@ class TextInputComponent extends StatefulWidget {
super.key,
this.controller,
this.focusNode,
+ this.groupId = EditableText,
this.label,
this.message,
this.hintText,
@@ -60,6 +61,7 @@ class TextInputComponent extends StatefulWidget {
final TextEditingController? controller;
final FocusNode? focusNode;
+ final Object groupId;
final String? label;
final String? message;
final String? hintText;
@@ -233,6 +235,7 @@ class _TextInputComponentState extends State<TextInputComponent> {
const SizedBox(height: Spacing.sm),
],
TextFieldTapRegion(
+ groupId: widget.groupId,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: widget.isDisabled ? null : _focusNode.requestFocus,
@@ -266,6 +269,7 @@ class _TextInputComponentState extends State<TextInputComponent> {
],
Expanded(
child: TextField(
+ groupId: widget.groupId,
controller: _controller,
focusNode: _focusNode,
enabled: !widget.isDisabled,
diff --git a/mobile/packages/ente_components/test/components/text_input_component_test.dart b/mobile/packages/ente_components/test/components/text_input_component_test.dart
index e3cefc44be..33d410173a 100644
--- a/mobile/packages/ente_components/test/components/text_input_component_test.dart
+++ b/mobile/packages/ente_components/test/components/text_input_component_test.dart
@@ -304,6 +304,27 @@ void main() {
expect(isEmptyNotifier.value, isFalse);
});
+ testWidgets("TextInputComponent forwards groupId to text field regions", (
+ tester,
+ ) async {
+ final groupId = Object();
+
+ await tester.pumpWidget(_wrap(TextInputComponent(groupId: groupId)));
+
+ expect(tester.widget<TextField>(find.byType(TextField)).groupId, groupId);
+ expect(
+ tester
+ .widget<TextFieldTapRegion>(
+ find.ancestor(
+ of: _fieldContainers().first,
+ matching: find.byType(TextFieldTapRegion),
+ ),
+ )
+ .groupId,
+ groupId,
+ );
+ });
+
testWidgets(
"TextInputComponent supports clear and password visibility affordances",
(tester) async {