Skip to content

Figure out why renderEditable can be null in EditableTextState userUpdateTextEditingValue #79818

@chunhtai

Description

@chunhtai

repro

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    const title = 'code sample';
    return MaterialApp(
      title: title,
      home: Scaffold(
        body: HomeWidget(),
      ),
    );
  }
}

class HomeWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return Home();
  }
}

class Home extends State<StatefulWidget> {
  UniqueKey key;
  void onPressed() {
    setState(() {
      key = UniqueKey();
    });
  }
  FocusNode node = FocusNode();
  TextEditingController controller = TextEditingController();
  @override
  Widget build(BuildContext context) {
    node.requestFocus();
    return Scaffold(
      appBar: AppBar(actions: [IconButton(onPressed: onPressed, icon: Icon(Icons.add))],),
      body:ListView(
        children: [
          TextField(key:key,focusNode: node, controller: controller),
        ],
      ));
  }
}
  1. click + icon multiple time
  2. type something into the textfield using raw keyboard
  3. type delete

b/184470009
b/183416650

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consolecustomer: money (g3)frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions