-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyiOS applications specifically
Description
I am having a strange issue where on adding a content padding property to the textfield gets squeezed to a smaller height the same code works perfectly on android but not on ios.
I had to add it because the hint is not center aligned vertically by default if I add some content padding in any direction it gets vertically aligned.
Also notice that if the suffix icon is provided to textfield it doesnt squeeze or change its height
here is the textfield widget
TextField(
controller: emailController,
style: inputStyle,
// obscureText:hint.contains("Password") ? isHidden : false,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 16),// on removing this line the issue is resolved but the hint is not vertically center aligned by default
hintText:"Enter Password",
hintStyle: TextStyle(
color: Colors.black26,
fontWeight: FontWeight.w400,
fontSize: 14),
suffixIcon: hint.contains("Password")
? IconButton(
onPressed: () {
// setState(() {
// isHidden = isHidden ? false : true;
// });
},
icon: Icon(
Icons.remove_red_eye,
color: Colors.black54,
),
)
: null,
border: OutlineInputBorder(
borderSide: BorderSide(
width: 3.5,
color: Colors.black26,
)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 2.0,
color: Colors.black26,
))),
),this is how both textfields look with and without suffix icon

heres is myflutter doctor -v output
✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.14.6 18G1012, locale en-IN)
• Flutter version 1.9.1+hotfix.6 at /Users/almac03/Documents/flutter
• Framework revision 68587a0916 (3 months ago), 2019-09-13 19:46:58 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/almac03/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.7.5
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.40.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.6.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • B1D782BE-C888-47D1-9BF7-91F523DF5A68 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
• No issues found!
Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyiOS applications specifically