Skip to content
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

TextField causing assertion errors on hot reload #26714

Closed
mdebbar opened this issue Jan 17, 2019 · 3 comments
Closed

TextField causing assertion errors on hot reload #26714

mdebbar opened this issue Jan 17, 2019 · 3 comments
Labels
framework flutter/packages/flutter repository. See also f: labels. t: hot reload Reloading code during "flutter run"

Comments

@mdebbar
Copy link
Contributor

mdebbar commented Jan 17, 2019

Steps to Reproduce

import 'package:flutter/material.dart';

void main() => runApp(HelloWorld());

Widget field(String placeholder) {
  return Theme(
    data: ThemeData(textSelectionColor: Colors.orange.shade200),
    child: TextField(
      textAlign: TextAlign.center,
      controller: TextEditingController(text: placeholder),
    ),
  );
}

class HelloWorld extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: DefaultTextStyle.merge(
          style: const TextStyle(fontSize: 10),
          child: ListView(
            children: <Widget>[
              field('Cyan'),
              field('Orange'),
              field('Thick Rounded Cursor'),
            ],
          ),
        ),
      ),
    );
  }
}
  1. Run the above app.
  2. Change textAlign to TextAlign.start.
  3. Hot reload will throw assertions.

Logs

I/flutter ( 4166): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 4166): The following assertion was thrown during performLayout():
I/flutter ( 4166): 'package:flutter/src/painting/text_painter.dart': Failed assertion: line 300 pos 12:
I/flutter ( 4166): '!_needsLayout': is not true.

Info

  • This is from flutter master (currently at 7e22b5f).
  • I'm running the app using VS Code (which does hot reload on save).
@jonahwilliams jonahwilliams added framework flutter/packages/flutter repository. See also f: labels. t: hot reload Reloading code during "flutter run" labels Jan 18, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 18, 2019

Duplicate of #20611

@zoechi zoechi marked this as a duplicate of #20611 Jan 18, 2019
@zoechi zoechi closed this as completed Jan 18, 2019
@kkacquah
Copy link

The error here #36640 seems to be related to this.

@github-actions
Copy link

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
framework flutter/packages/flutter repository. See also f: labels. t: hot reload Reloading code during "flutter run"
Projects
None yet
Development

No branches or pull requests

4 participants