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
73dbca41
Commit
73dbca41
authored
May 21, 2019
by
Mattia Crovero
Committed by
Justin McCandless
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ScrollController to TextField (#32620)
scrollController param on TextField and CupertinoTextField
parent
27d3c2fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+6
-1
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+6
-0
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+14
-1
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
73dbca41
...
...
@@ -187,6 +187,7 @@ class CupertinoTextField extends StatefulWidget {
this
.
scrollPadding
=
const
EdgeInsets
.
all
(
20.0
),
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
enableInteractiveSelection
,
this
.
scrollController
,
this
.
scrollPhysics
,
})
:
assert
(
textAlign
!=
null
),
assert
(
autofocus
!=
null
),
...
...
@@ -430,6 +431,9 @@ class CupertinoTextField extends StatefulWidget {
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
final
DragStartBehavior
dragStartBehavior
;
/// {@macro flutter.widgets.editableText.scrollController}
final
ScrollController
scrollController
;
/// {@macro flutter.widgets.edtiableText.scrollPhysics}
final
ScrollPhysics
scrollPhysics
;
...
...
@@ -444,7 +448,6 @@ class CupertinoTextField extends StatefulWidget {
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DiagnosticsProperty
<
TextEditingController
>(
'controller'
,
controller
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
FocusNode
>(
'focusNode'
,
focusNode
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
BoxDecoration
>(
'decoration'
,
decoration
));
...
...
@@ -466,6 +469,7 @@ class CupertinoTextField extends StatefulWidget {
properties
.
add
(
FlagProperty
(
'maxLengthEnforced'
,
value:
maxLengthEnforced
,
ifTrue:
'max length enforced'
));
properties
.
add
(
DiagnosticsProperty
<
Color
>(
'cursorColor'
,
cursorColor
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'selectionEnabled'
,
value:
selectionEnabled
,
defaultValue:
true
,
ifFalse:
'selection disabled'
));
properties
.
add
(
DiagnosticsProperty
<
ScrollController
>(
'scrollController'
,
scrollController
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ScrollPhysics
>(
'scrollPhysics'
,
scrollPhysics
,
defaultValue:
null
));
}
}
...
...
@@ -820,6 +824,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
scrollPadding:
widget
.
scrollPadding
,
keyboardAppearance:
keyboardAppearance
,
dragStartBehavior:
widget
.
dragStartBehavior
,
scrollController:
widget
.
scrollController
,
scrollPhysics:
widget
.
scrollPhysics
,
enableInteractiveSelection:
widget
.
enableInteractiveSelection
,
),
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
73dbca41
...
...
@@ -165,6 +165,7 @@ class TextField extends StatefulWidget {
this
.
enableInteractiveSelection
,
this
.
onTap
,
this
.
buildCounter
,
this
.
scrollController
,
this
.
scrollPhysics
,
})
:
assert
(
textAlign
!=
null
),
assert
(
autofocus
!=
null
),
...
...
@@ -463,6 +464,9 @@ class TextField extends StatefulWidget {
/// {@macro flutter.widgets.edtiableText.scrollPhysics}
final
ScrollPhysics
scrollPhysics
;
/// {@macro flutter.widgets.editableText.scrollController}
final
ScrollController
scrollController
;
@override
_TextFieldState
createState
()
=>
_TextFieldState
();
...
...
@@ -493,6 +497,7 @@ class TextField extends StatefulWidget {
properties
.
add
(
DiagnosticsProperty
<
Brightness
>(
'keyboardAppearance'
,
keyboardAppearance
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
EdgeInsetsGeometry
>(
'scrollPadding'
,
scrollPadding
,
defaultValue:
const
EdgeInsets
.
all
(
20.0
)));
properties
.
add
(
FlagProperty
(
'selectionEnabled'
,
value:
selectionEnabled
,
defaultValue:
true
,
ifFalse:
'selection disabled'
));
properties
.
add
(
DiagnosticsProperty
<
ScrollController
>(
'scrollController'
,
scrollController
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ScrollPhysics
>(
'scrollPhysics'
,
scrollPhysics
,
defaultValue:
null
));
}
}
...
...
@@ -957,6 +962,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
keyboardAppearance:
keyboardAppearance
,
enableInteractiveSelection:
widget
.
enableInteractiveSelection
,
dragStartBehavior:
widget
.
dragStartBehavior
,
scrollController:
widget
.
scrollController
,
scrollPhysics:
widget
.
scrollPhysics
,
),
);
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
73dbca41
...
...
@@ -302,6 +302,7 @@ class EditableText extends StatefulWidget {
this
.
keyboardAppearance
=
Brightness
.
light
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
enableInteractiveSelection
,
this
.
scrollController
,
this
.
scrollPhysics
,
})
:
assert
(
controller
!=
null
),
assert
(
focusNode
!=
null
),
...
...
@@ -738,6 +739,15 @@ class EditableText extends StatefulWidget {
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
final
DragStartBehavior
dragStartBehavior
;
/// {@template flutter.widgets.editableText.scrollController}
/// The [ScrollController] to use when vertically scrolling the input.
///
/// If null, it will instantiate a new ScrollController.
///
/// See [Scrollable.controller].
/// {@endtemplate}
final
ScrollController
scrollController
;
/// {@template flutter.widgets.editableText.scrollPhysics}
/// The [ScrollPhysics] to use when vertically scrolling the input.
///
...
...
@@ -772,6 +782,7 @@ class EditableText extends StatefulWidget {
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'expands'
,
expands
,
defaultValue:
false
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'autofocus'
,
autofocus
,
defaultValue:
false
));
properties
.
add
(
DiagnosticsProperty
<
TextInputType
>(
'keyboardType'
,
keyboardType
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ScrollController
>(
'scrollController'
,
scrollController
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ScrollPhysics
>(
'scrollPhysics'
,
scrollPhysics
,
defaultValue:
null
));
}
}
...
...
@@ -786,7 +797,8 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
TextInputConnection
_textInputConnection
;
TextSelectionOverlay
_selectionOverlay
;
final
ScrollController
_scrollController
=
ScrollController
();
ScrollController
_scrollController
;
AnimationController
_cursorBlinkOpacityController
;
final
LayerLink
_layerLink
=
LayerLink
();
...
...
@@ -816,6 +828,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
widget
.
controller
.
addListener
(
_didChangeTextEditingValue
);
_focusAttachment
=
widget
.
focusNode
.
attach
(
context
);
widget
.
focusNode
.
addListener
(
_handleFocusChanged
);
_scrollController
=
widget
.
scrollController
??
ScrollController
();
_scrollController
.
addListener
(()
{
_selectionOverlay
?.
updateForScroll
();
});
_cursorBlinkOpacityController
=
AnimationController
(
vsync:
this
,
duration:
_fadeDuration
);
_cursorBlinkOpacityController
.
addListener
(
_onCursorColorTick
);
...
...
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