fix: unfocus keyboard on click outside in activity planner page, add done button to final text field (#1732)

pull/1605/head
ggurdin 9 months ago committed by GitHub
parent f9e2b3d9c0
commit 65149bb1fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -300,7 +300,7 @@ class ActivityPlannerPageState extends State<ActivityPlannerPage> {
decoration: InputDecoration(
labelText: l10n.numberOfLearners,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
validator: (value) {
if (value == null || value.isEmpty) {
return l10n.mustBeInteger;
@ -314,6 +314,13 @@ class ActivityPlannerPageState extends State<ActivityPlannerPage> {
onChanged: (val) =>
_selectedNumberOfParticipants = int.tryParse(val),
initialValue: _selectedNumberOfParticipants?.toString(),
onTapOutside: (_) =>
FocusManager.instance.primaryFocus?.unfocus(),
onFieldSubmitted: (_) {
if (_formKey.currentState?.validate() ?? false) {
_generateActivities();
}
},
),
const SizedBox(height: 24),
ElevatedButton(

@ -49,6 +49,7 @@ class SuggestionFormField extends StatelessWidget {
hintText: placeholder,
),
validator: validator,
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
);
},
);

Loading…
Cancel
Save