Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
a9a8d979
Commit
a9a8d979
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Not allow Return in comment text field
parent
0d84d8db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ui/screens/pay_form.dart
+17
-1
17 additions, 1 deletion
lib/ui/screens/pay_form.dart
with
17 additions
and
1 deletion
lib/ui/screens/pay_form.dart
+
17
−
1
View file @
a9a8d979
import
'package:easy_localization/easy_localization.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../data/models/payment_cubit.dart'
;
...
...
@@ -39,6 +40,7 @@ class _PayFormState extends State<PayForm> {
const
G1PayAmountField
(),
const
SizedBox
(
height:
10.0
),
TextFormField
(
inputFormatters:
[
NoNewLineTextInputFormatter
()],
controller:
_commentController
,
onChanged:
(
String
?
value
)
{
final
bool
validate
=
_commentValidate
();
...
...
@@ -60,7 +62,6 @@ class _PayFormState extends State<PayForm> {
}
return
null
;
},
maxLines:
null
,
),
const
SizedBox
(
height:
10.0
),
ElevatedButton
(
...
...
@@ -161,3 +162,18 @@ class _PayFormState extends State<PayForm> {
);
}
}
class
NoNewLineTextInputFormatter
extends
TextInputFormatter
{
@override
TextEditingValue
formatEditUpdate
(
TextEditingValue
oldValue
,
TextEditingValue
newValue
)
{
final
String
newText
=
newValue
.
text
.
replaceAll
(
'
\n
'
,
''
);
return
TextEditingValue
(
text:
newText
,
selection:
newValue
.
selection
.
copyWith
(
baseOffset:
newText
.
length
,
extentOffset:
newText
.
length
,
),
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment