-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Description
When I have textAlign: TextAlign.center, and TextField is in SizedBox and when I enter first character the blinking line gets bugged and moves from center to the beginning of the TextField. As soon as I enter second character, line is okay once again.

Example:
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appTitle = 'Test';
return new MaterialApp(
title: appTitle,
home: new Scaffold(
appBar: new AppBar(
title: new Text(appTitle),
),
body: new Test(),
),
);
}
}
class Test extends StatefulWidget {
@override
TestState createState() {
return new TestState();
}
}
// Create a corresponding State class. This class will hold the data related to
// the form.
class TestState extends State<Test> {
// Create a global key that will uniquely identify the `Form` widget
@override
Widget build(BuildContext context) {
// Build a Form widget using the _formKey we created above
return new Stack(
children:[
new Positioned(
left: 100.0,
right: 100.0,
top: 200.0,
height: 20.0,
child: Row(
children: <Widget>[
new SizedBox(
width: 50.0,
child: new TextField(
textAlign: TextAlign.center,
style: new TextStyle(
color: Colors.blue,
),
),
),
],
),
),
],
);
}
}
I think this issue is the same with all text input widgets.
A lil off topic - I didn't see how can we align, lets say, error text. If I use validation in TextFormField which covers whole width of the screen, and I use TextAlign.center for input, it's very ugly that error is on the left, and entered text in center of the widget.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.5-pre.10, on Mac OS X 10.13.4 17E202, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4)
[✓] Android Studio (version 3.1)
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected devices (2 available)
Metadata
Metadata
Assignees
Labels
No labels