Add activity generator maxLength via SuggestionFormField parameter (#3465)

This commit is contained in:
Kelrap 2025-07-15 12:41:28 -04:00 committed by GitHub
parent ab64e09506
commit 480ad320f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -157,6 +157,7 @@ class ActivityGeneratorView extends StatelessWidget {
SuggestionFormField(
suggestions: controller.topicItems,
validator: controller.validateNotNull,
maxLength: 50,
label: l10n.topicLabel,
placeholder: l10n.topicPlaceholder,
controller: controller.topicController,
@ -165,6 +166,7 @@ class ActivityGeneratorView extends StatelessWidget {
SuggestionFormField(
suggestions: controller.objectiveItems,
validator: controller.validateNotNull,
maxLength: 140,
label: l10n.learningObjectiveLabel,
placeholder: l10n.learningObjectivePlaceholder,
controller: controller.objectiveController,
@ -173,6 +175,7 @@ class ActivityGeneratorView extends StatelessWidget {
SuggestionFormField(
suggestions: controller.modeItems,
validator: controller.validateNotNull,
maxLength: 50,
label: l10n.modeLabel,
placeholder: l10n.modePlaceholder,
controller: controller.modeController,

View file

@ -5,6 +5,7 @@ import 'package:fluffychat/pangea/activity_planner/list_request_schema.dart';
class SuggestionFormField extends StatelessWidget {
final Future<List<ActivitySettingResponseSchema>> suggestions;
final String? Function(String?)? validator;
final int? maxLength;
final String label;
final String placeholder;
final TextEditingController controller;
@ -14,6 +15,7 @@ class SuggestionFormField extends StatelessWidget {
required this.suggestions,
required this.placeholder,
this.validator,
this.maxLength,
required this.label,
required this.controller,
});
@ -49,6 +51,7 @@ class SuggestionFormField extends StatelessWidget {
hintText: placeholder,
),
validator: validator,
maxLength: maxLength,
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
);
},