Skip to content

Commit 88f2b74

Browse files
committed
[TextField] utilize input decoration if outline input border, convert for ios as well.
1 parent 9ab86b4 commit 88f2b74

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

example/lib/text_field_page.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ class TextFieldPage extends StatelessWidget {
5353
Flexible(
5454
child: PTheme.ios(
5555
PTextField(
56-
iosDecoration: BoxDecoration(
57-
border: Border.all(color: Colors.red),
58-
borderRadius: BorderRadius.all(Radius.circular(8.0)),
59-
),
6056
decoration: getInputDecoration("iOS"),
6157
),
6258
),

lib/src/widgets/text_field.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,20 @@ class PTextField extends PlatformAdaptingWidget {
161161
/// directly support it.
162162
final hintStyle = decoration.hintStyle ??
163163
TextStyle(color: Theme.of(context)?.hintColor);
164+
final decorationBorder = decoration.border;
165+
final iosDecoration = this.iosDecoration ??
166+
// map the outline input border to the iosDecoration by default.
167+
(decorationBorder is OutlineInputBorder
168+
? BoxDecoration(
169+
border: Border.fromBorderSide(decorationBorder.borderSide),
170+
color: decoration.fillColor,
171+
borderRadius: decorationBorder.borderRadius,
172+
)
173+
: null);
164174
return CupertinoTextField(
165175
controller: this.controller,
166176
focusNode: this.focusNode,
167-
decoration: this.iosDecoration,
177+
decoration: iosDecoration,
168178
padding: decoration.contentPadding ?? const EdgeInsets.all(6.0),
169179
placeholder: decoration.hintText,
170180
placeholderStyle: hintStyle,

0 commit comments

Comments
 (0)