forked from eatvio/eatvio_app
feat(other): add max length in textformfield
This commit is contained in:
@@ -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<OtherInfoScreen> {
|
||||
autofocus: true,
|
||||
minLines: 2,
|
||||
maxLines: 8,
|
||||
maxLength: 250,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
@@ -70,6 +70,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
hintText: s.enter_information,
|
||||
autofocus: true,
|
||||
minLines: 2,
|
||||
maxLength: 250,
|
||||
maxLines: 8,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
@@ -82,6 +83,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
|
||||
autofocus: true,
|
||||
maxLines: 8,
|
||||
maxLength: 250,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
@@ -92,6 +94,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
hintText: s.enter_information,
|
||||
maxLines: 7,
|
||||
minLines: 2,
|
||||
maxLength: 250,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
@@ -102,6 +105,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
hintText: s.enter_information,
|
||||
maxLines: 7,
|
||||
minLines: 2,
|
||||
maxLength: 250,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
@@ -114,9 +118,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: additionalInfoController,
|
||||
inputFormatters: [
|
||||
new LengthLimitingTextInputFormatter(250),
|
||||
],
|
||||
maxLength: 250,
|
||||
hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
|
||||
maxLines: 8,
|
||||
onChanged: (newValue) {},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user