New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing TextField.textAlign crashes during hot reload #20611
Comments
@zoechi Any update on this? |
@pushangupta what exactly are the steps to reproduce? |
Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.white))),
height: 35.0,
width: double.infinity,
margin: EdgeInsets.only(left: 15.0, right: 15.0, bottom: 40.0),
child: TextFormField(
controller: _nameController,
textInputAction: TextInputAction.done,
textAlign: TextAlign.center,
keyboardType: TextInputType.text,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 15.0),
decoration: InputDecoration(
icon: Icon(
Icons.edit,
color: Colors.black,
),
hintText: widget.group_name,
hintStyle: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
border: InputBorder.none),
),
) Apologies for bad indentation |
@pushangupta import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'foo text',
),
Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.white))),
height: 35.0,
width: double.infinity,
margin: EdgeInsets.only(left: 15.0, right: 15.0, bottom: 40.0),
child: TextFormField(
// controller: _nameController,
textInputAction: TextInputAction.done,
textAlign: TextAlign.center,
keyboardType: TextInputType.text,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 15.0),
decoration: InputDecoration(
icon: Icon(
Icons.edit,
color: Colors.black,
),
hintText: 'foo',
hintStyle: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
border: InputBorder.none),
),
)
],
),
),
);
}
}
|
@pushangupta can you provide a complete code sample to reproduce that we can just copy and paste to investigate the issue? |
@goderbauer @zoechi import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final TextEditingController _username_email_controller =
new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Stack(children: <Widget>[
Center(
child: ListView(
shrinkWrap: true,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.black))),
height: 50.0,
width: double.infinity,
margin: EdgeInsets.only(left: 15.0, right: 15.0),
child: TextField(
controller: _username_email_controller,
textAlign: TextAlign.start,//=======> This Line
keyboardType: TextInputType.emailAddress,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 17.0),
decoration: InputDecoration(
icon: Icon(
Icons.account_box,
color: Colors.black,
),
hintText: "Username/Email Id",
hintStyle: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
border: InputBorder.none),
),
),
],
),
],
),
),
]), // This trailing comma makes auto-formatting nicer for build methods.
);
}
} Now change the textAlign to TextAlign.center and on hot reloading my logs are:
But if I hot restart the app... it resolves |
Flutter v1.1.5 version can not be reproduced |
This bug still happens to me on Flutter 1.7.8+hotfix.3 |
Still happening to me |
The error here #36640 seems to be related to this. |
Still happening to me ... on Flutter 1.7.8+hotfix.4 |
This is still happening in 1.9.1+hotfix.2. Cloud someone please look at this issue? |
Same here with 1.9.1+hotfix.2 |
Confirmed as well. Debug build on iOS. Happens each time. |
So how do we slove the error? |
Same here 1.9.1+hotfix.5 |
Same Here its just when change to TextAlign.center |
Happens to me as well... Can it be re-opened? |
Happens to me too. Fresh flutter installation: v1.9.1+hotfix.6 Starting with
and adding or removing the following line
causes
|
Same problem happens when you dynamically change Based on that idea there is a simple workaround which works quite well and no notable performance issue at all. If you use the
|
@ianpark the issue should be fixed on |
Sure but not everyone can simply upgrade to the latest beta. I had to stick to a stable version 1.7.8 for quite long time due to the dependency / stability issue and now I am on 1.11.0 beta. I put my comment for those who are in the same situation. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
textAlign: TextAlign.center
Delete can runThe text was updated successfully, but these errors were encountered: