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
13d14f18
Unverified
Commit
13d14f18
authored
Oct 27, 2021
by
Taha Tesser
Committed by
GitHub
Oct 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[doc] Update `suffixIcon`/`prefixIcon` for alignment with code snippet (#91998)
parent
816403f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
0 deletions
+140
-0
input_decoration.prefix_icon.0.dart
...erial/input_decorator/input_decoration.prefix_icon.0.dart
+42
-0
input_decoration.suffix_icon.0.dart
...erial/input_decorator/input_decoration.suffix_icon.0.dart
+42
-0
input_decoration.prefix_icon.0_test.dart
.../input_decorator/input_decoration.prefix_icon.0_test.dart
+16
-0
input_decoration.suffix_icon.0_test.dart
.../input_decorator/input_decoration.suffix_icon.0_test.dart
+16
-0
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+24
-0
No files found.
examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart
0 → 100644
View file @
13d14f18
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for InputDecorator
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
MaterialApp
(
title:
'Input Decorator Sample'
,
home:
Scaffold
(
body:
InputDecoratorExample
()),
);
}
}
class
InputDecoratorExample
extends
StatelessWidget
{
const
InputDecoratorExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
TextField
(
decoration:
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'Enter name'
,
prefixIcon:
Align
(
widthFactor:
1.0
,
heightFactor:
1.0
,
child:
Icon
(
Icons
.
person
,
),
),
),
);
}
}
examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart
0 → 100644
View file @
13d14f18
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for InputDecorator
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
MaterialApp
(
title:
'Input Decorator Sample'
,
home:
Scaffold
(
body:
InputDecoratorExample
()),
);
}
}
class
InputDecoratorExample
extends
StatelessWidget
{
const
InputDecoratorExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
TextField
(
decoration:
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'Enter password'
,
suffixIcon:
Align
(
widthFactor:
1.0
,
heightFactor:
1.0
,
child:
Icon
(
Icons
.
remove_red_eye
,
),
),
),
);
}
}
examples/api/test/material/input_decorator/input_decoration.prefix_icon.0_test.dart
0 → 100644
View file @
13d14f18
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_api_samples/material/input_decorator/input_decoration.prefix_icon.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'InputDecorator prefixIcon alignment'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
MyApp
(),
);
expect
(
tester
.
getCenter
(
find
.
byIcon
(
Icons
.
person
)).
dy
,
28.0
);
});
}
examples/api/test/material/input_decorator/input_decoration.suffix_icon.0_test.dart
0 → 100644
View file @
13d14f18
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_api_samples/material/input_decorator/input_decoration.suffix_icon.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'InputDecorator suffixIcon alignment'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
MyApp
(),
);
expect
(
tester
.
getCenter
(
find
.
byIcon
(
Icons
.
remove_red_eye
)).
dy
,
28.0
);
});
}
packages/flutter/lib/src/material/input_decorator.dart
View file @
13d14f18
...
@@ -2945,12 +2945,24 @@ class InputDecoration {
...
@@ -2945,12 +2945,24 @@ class InputDecoration {
/// [icon] and above the widgets that contain [helperText],
/// [icon] and above the widgets that contain [helperText],
/// [errorText], and [counterText].
/// [errorText], and [counterText].
///
///
/// The prefix icon aligment can be changed using [Align] with a fixed `widthFactor` and
/// `heightFactor`.
///
/// {@tool dartpad}
/// This example shows how the prefix icon alignment can be changed using [Align] with
/// a fixed `widthFactor` and `heightFactor`.
///
/// ** See code in examples/api/lib/material/input_decorator/input_decoration.prefix_icon.0.dart **
/// {@end-tool}
///
/// See also:
/// See also:
///
///
/// * [Icon] and [ImageIcon], which are typically used to show icons.
/// * [Icon] and [ImageIcon], which are typically used to show icons.
/// * [prefix] and [prefixText], which are other ways to show content
/// * [prefix] and [prefixText], which are other ways to show content
/// before the text field (but after the icon).
/// before the text field (but after the icon).
/// * [suffixIcon], which is the same but on the trailing edge.
/// * [suffixIcon], which is the same but on the trailing edge.
/// * [Align] A widget that aligns its child within itself and optionally
/// sizes itself based on the child's size.
final
Widget
?
prefixIcon
;
final
Widget
?
prefixIcon
;
/// The constraints for the prefix icon.
/// The constraints for the prefix icon.
...
@@ -3055,12 +3067,24 @@ class InputDecoration {
...
@@ -3055,12 +3067,24 @@ class InputDecoration {
/// [icon] and above the widgets that contain [helperText],
/// [icon] and above the widgets that contain [helperText],
/// [errorText], and [counterText].
/// [errorText], and [counterText].
///
///
/// The suffix icon aligment can be changed using [Align] with a fixed `widthFactor` and
/// `heightFactor`.
///
/// {@tool dartpad}
/// This example shows how the suffix icon alignment can be changed using [Align] with
/// a fixed `widthFactor` and `heightFactor`.
///
/// ** See code in examples/api/lib/material/input_decorator/input_decoration.suffix_icon.0.dart **
/// {@end-tool}
///
/// See also:
/// See also:
///
///
/// * [Icon] and [ImageIcon], which are typically used to show icons.
/// * [Icon] and [ImageIcon], which are typically used to show icons.
/// * [suffix] and [suffixText], which are other ways to show content
/// * [suffix] and [suffixText], which are other ways to show content
/// after the text field (but before the icon).
/// after the text field (but before the icon).
/// * [prefixIcon], which is the same but on the leading edge.
/// * [prefixIcon], which is the same but on the leading edge.
/// * [Align] A widget that aligns its child within itself and optionally
/// sizes itself based on the child's size.
final
Widget
?
suffixIcon
;
final
Widget
?
suffixIcon
;
/// Optional widget to place on the line after the input.
/// Optional widget to place on the line after the input.
...
...
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