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
6c2ab9d3
Commit
6c2ab9d3
authored
Feb 13, 2016
by
Collin Jackson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1847 from collinjackson/input_key
Don’t require global keys for Input, fixes #1828
parents
ca4d10d3
d4533622
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
stock_home.dart
examples/stocks/lib/stock_home.dart
+0
-5
input.dart
packages/flutter/lib/src/material/input.dart
+7
-6
No files found.
examples/stocks/lib/stock_home.dart
View file @
6c2ab9d3
...
...
@@ -241,9 +241,6 @@ class StockHomeState extends State<StockHome> {
static
const
List
<
String
>
portfolioSymbols
=
const
<
String
>[
"AAPL"
,
"FIZZ"
,
"FIVE"
,
"FLAT"
,
"ZINC"
,
"ZNGA"
];
static
GlobalKey
searchFieldKey
=
new
GlobalKey
();
static
GlobalKey
companyNameKey
=
new
GlobalKey
();
// TODO(abarth): Should we factor this into a SearchBar in the framework?
Widget
buildSearchBar
()
{
return
new
ToolBar
(
...
...
@@ -255,7 +252,6 @@ class StockHomeState extends State<StockHome> {
),
center:
new
Input
(
value:
_searchQuery
,
key:
searchFieldKey
,
autofocus:
true
,
hintText:
'Search stocks'
,
onChanged:
_handleSearchQueryChanged
...
...
@@ -272,7 +268,6 @@ class StockHomeState extends State<StockHome> {
return
new
Column
(
children:
<
Widget
>[
new
Input
(
key:
companyNameKey
,
autofocus:
true
,
hintText:
'Company Name'
),
...
...
packages/flutter/lib/src/material/input.dart
View file @
6c2ab9d3
...
...
@@ -15,7 +15,7 @@ export 'package:sky_services/editing/editing.mojom.dart' show KeyboardType;
/// A material design text input field.
class
Input
extends
StatefulComponent
{
Input
({
Global
Key
key
,
Key
key
,
this
.
value
:
InputValue
.
empty
,
this
.
keyboardType
:
KeyboardType
.
text
,
this
.
icon
,
...
...
@@ -28,9 +28,7 @@ class Input extends StatefulComponent {
this
.
autofocus
:
false
,
this
.
onChanged
,
this
.
onSubmitted
})
:
super
(
key:
key
)
{
assert
(
key
!=
null
);
}
})
:
super
(
key:
key
);
/// The text of the input field.
final
InputValue
value
;
...
...
@@ -77,10 +75,13 @@ const Curve _kTransitionCurve = Curves.ease;
class
_InputState
extends
State
<
Input
>
{
GlobalKey
<
RawInputLineState
>
_rawInputLineKey
=
new
GlobalKey
<
RawInputLineState
>();
GlobalKey
get
focusKey
=>
config
.
key
is
GlobalKey
?
config
.
key
:
_rawInputLineKey
;
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
ThemeData
themeData
=
Theme
.
of
(
context
);
bool
focused
=
Focus
.
at
(
context
,
autofocus:
config
.
autofocus
);
BuildContext
focusContext
=
focusKey
.
currentContext
;
bool
focused
=
focusContext
!=
null
&&
Focus
.
at
(
focusContext
,
autofocus:
config
.
autofocus
);
TextStyle
textStyle
=
config
.
style
??
themeData
.
text
.
subhead
;
Color
focusHighlightColor
=
themeData
.
accentColor
;
...
...
@@ -156,7 +157,7 @@ class _InputState extends State<Input> {
child:
new
RawInputLine
(
key:
_rawInputLineKey
,
value:
config
.
value
,
focusKey:
config
.
k
ey
,
focusKey:
focusK
ey
,
style:
textStyle
,
hideText:
config
.
hideText
,
cursorColor:
cursorColor
,
...
...
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