Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e03ccd62
Unverified
Commit
e03ccd62
authored
Mar 25, 2021
by
Mouad Debbar
Committed by
GitHub
Mar 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[web] Fix text field shortcuts when inside a scroll area (#79051)
parent
ef7258d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+20
-2
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+19
-1
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
e03ccd62
...
...
@@ -4,7 +4,7 @@
import
'dart:ui'
as
ui
show
BoxHeightStyle
,
BoxWidthStyle
;
import
'package:flutter/foundation.dart'
show
defaultTargetPlatform
;
import
'package:flutter/foundation.dart'
show
defaultTargetPlatform
,
kIsWeb
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
...
...
@@ -18,6 +18,16 @@ import 'theme.dart';
export
'package:flutter/services.dart'
show
TextInputType
,
TextInputAction
,
TextCapitalization
,
SmartQuotesType
,
SmartDashesType
;
// This is a temporary fix for: https://github.com/flutter/flutter/issues/79012
/// A map used to disable scrolling shortcuts in text fields.
final
Map
<
LogicalKeySet
,
Intent
>
_webScrollShortcutOverrides
=
<
LogicalKeySet
,
Intent
>{
LogicalKeySet
(
LogicalKeyboardKey
.
space
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowUp
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowDown
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowLeft
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowRight
):
DoNothingAndStopPropagationIntent
(),
};
const
TextStyle
_kDefaultPlaceholderStyle
=
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
CupertinoColors
.
placeholderText
,
...
...
@@ -1212,7 +1222,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
),
);
return
Semantics
(
final
Widget
child
=
Semantics
(
enabled:
enabled
,
onTap:
!
enabled
||
widget
.
readOnly
?
null
:
()
{
if
(!
controller
.
selection
.
isValid
)
{
...
...
@@ -1238,5 +1248,13 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
),
),
);
if
(
kIsWeb
)
{
return
Shortcuts
(
shortcuts:
_webScrollShortcutOverrides
,
child:
child
,
);
}
return
child
;
}
}
packages/flutter/lib/src/material/text_field.dart
View file @
e03ccd62
...
...
@@ -24,6 +24,16 @@ import 'theme.dart';
export
'package:flutter/services.dart'
show
TextInputType
,
TextInputAction
,
TextCapitalization
,
SmartQuotesType
,
SmartDashesType
;
// This is a temporary fix for: https://github.com/flutter/flutter/issues/79012
/// A map used to disable scrolling shortcuts in text fields.
final
Map
<
LogicalKeySet
,
Intent
>
_webScrollShortcutOverrides
=
<
LogicalKeySet
,
Intent
>{
LogicalKeySet
(
LogicalKeyboardKey
.
space
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowUp
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowDown
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowLeft
):
DoNothingAndStopPropagationIntent
(),
LogicalKeySet
(
LogicalKeyboardKey
.
arrowRight
):
DoNothingAndStopPropagationIntent
(),
};
/// Signature for the [TextField.buildCounter] callback.
typedef
InputCounterWidgetBuilder
=
Widget
?
Function
(
/// The build context for the TextField.
...
...
@@ -1301,7 +1311,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
semanticsMaxValueLength
=
null
;
}
return
MouseRegion
(
child
=
MouseRegion
(
cursor:
effectiveMouseCursor
,
onEnter:
(
PointerEnterEvent
event
)
=>
_handleHover
(
true
),
onExit:
(
PointerExitEvent
event
)
=>
_handleHover
(
false
),
...
...
@@ -1329,5 +1339,13 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
),
),
);
if
(
kIsWeb
)
{
return
Shortcuts
(
shortcuts:
_webScrollShortcutOverrides
,
child:
child
,
);
}
return
child
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment