Merge pull request #253 from opxdelwin/issue-252-updated

[feat] Implement Press Enter to Send Request in URL Input Field
This commit is contained in:
Ankit Mahato
2024-03-09 10:30:35 +05:30
committed by GitHub
3 changed files with 45 additions and 0 deletions

View File

@ -81,6 +81,11 @@ class URLTextField extends ConsumerWidget {
.read(collectionStateNotifierProvider.notifier)
.update(selectedId, url: value);
},
onFieldSubmitted: (value) {
ref
.read(collectionStateNotifierProvider.notifier)
.sendRequest(selectedId);
},
);
}
}

View File

@ -7,11 +7,13 @@ class URLField extends StatelessWidget {
required this.selectedId,
this.initialValue,
this.onChanged,
this.onFieldSubmitted,
});
final String selectedId;
final String? initialValue;
final void Function(String)? onChanged;
final void Function(String)? onFieldSubmitted;
@override
Widget build(BuildContext context) {
@ -29,6 +31,7 @@ class URLField extends StatelessWidget {
border: InputBorder.none,
),
onChanged: onChanged,
onFieldSubmitted: onFieldSubmitted,
);
}
}