diff --git a/lib/features/settings/presentation/pages/other_info_screen.dart b/lib/features/settings/presentation/pages/other_info_screen.dart index b786a746..4cb62dc4 100644 --- a/lib/features/settings/presentation/pages/other_info_screen.dart +++ b/lib/features/settings/presentation/pages/other_info_screen.dart @@ -4,7 +4,6 @@ import 'package:eatvio_app/generated/l10n.dart'; import 'package:eatvio_app/theme/theme_helper.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:go_router/go_router.dart'; class OtherInfoScreen extends StatefulWidget { @@ -60,6 +59,7 @@ class _OtherInfoScreenState extends State { autofocus: true, minLines: 2, maxLines: 8, + maxLength: 250, onChanged: (newValue) {}, ), SizedBox(height: 16), @@ -70,6 +70,7 @@ class _OtherInfoScreenState extends State { hintText: s.enter_information, autofocus: true, minLines: 2, + maxLength: 250, maxLines: 8, onChanged: (newValue) {}, ), @@ -82,6 +83,7 @@ class _OtherInfoScreenState extends State { "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!", autofocus: true, maxLines: 8, + maxLength: 250, onChanged: (newValue) {}, ), SizedBox(height: 16), @@ -92,6 +94,7 @@ class _OtherInfoScreenState extends State { hintText: s.enter_information, maxLines: 7, minLines: 2, + maxLength: 250, onChanged: (newValue) {}, ), SizedBox(height: 16), @@ -102,6 +105,7 @@ class _OtherInfoScreenState extends State { hintText: s.enter_information, maxLines: 7, minLines: 2, + maxLength: 250, onChanged: (newValue) {}, ), SizedBox(height: 16), @@ -114,9 +118,7 @@ class _OtherInfoScreenState extends State { SizedBox(height: 4), CustomTextFormField( controller: additionalInfoController, - inputFormatters: [ - new LengthLimitingTextInputFormatter(250), - ], + maxLength: 250, hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни", maxLines: 8, onChanged: (newValue) {}, diff --git a/lib/widgets/custom_text_form_field.dart b/lib/widgets/custom_text_form_field.dart index b493f9c9..6054079f 100644 --- a/lib/widgets/custom_text_form_field.dart +++ b/lib/widgets/custom_text_form_field.dart @@ -34,6 +34,7 @@ class CustomTextFormField extends StatelessWidget { this.onChanged, this.onEditingComplete, this.minLines = 1, + this.maxLength, super.key, }); @@ -67,6 +68,7 @@ class CustomTextFormField extends StatelessWidget { final Function()? onEditingComplete; final void Function(String?)? onSaved; final void Function(String)? onChanged; + final int? maxLength; @override Widget build(BuildContext context) { @@ -74,6 +76,7 @@ class CustomTextFormField extends StatelessWidget { alignment: alignment ?? Alignment.center, child: TextFormField( minLines: minLines, + maxLength: maxLength, onChanged: onChanged, controller: controller, focusNode: focusNode ?? null,