bytedance / flutter_ume

UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance
MIT License
2.05k stars 222 forks source link

自定义插件中使用TextField,输入文字后不能删除 #112

Open Zhaoiii opened 1 year ago

Zhaoiii commented 1 year ago

自定义插件中使用TextField,输入文字后不能删除 flutter_ume: ^1.1.2

talisk commented 1 year ago

请提供下包括Flutter版本的更多信息。并附上一个能复现问题的代码。

Zhaoiii commented 1 year ago

------版本信息------- Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2ad6cd72c0 (4 weeks ago) • 2023-03-08 09:41:59 -0800 Engine • revision 1837b5be5f Tools • Dart 2.19.4 • DevTools 2.20.1

------自定义插件------

class FlutterUmeKitProxy extends StatefulWidget implements Pluggable {
  FlutterUmeKitProxy({Key? key, required this.appKey, required this.setProxy});
  GlobalKey appKey;
  Function setProxy;

  @override
  _FlutterUmeKitProxyState createState() => _FlutterUmeKitProxyState();
  @override
  Widget? buildWidget(BuildContext? context) => this; // 返回插件面板

  @override
  String get name => 'Proxy'; // 插件名称

  @override
  String get displayName => 'Proxy';

  @override
  void onTrigger() {} // 点击插件面板图标时调用

  @override
  ImageProvider<Object> get iconImageProvider => const NetworkImage(
      'xxx'); // 插件图标
}

class _FlutterUmeKitProxyState extends State<FlutterUmeKitProxy> {
  String proxyAddress = '';

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      alignment: Alignment.bottomCenter,
      child: Container(
          color: Colors.white,
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height / 2.0,
          alignment: Alignment.topCenter,
          padding: const EdgeInsets.all(10),
          child: Column(
            children: [
              TextField(
                onChanged: (text) {
                  print('=========change=======');
                  setState(() {
                    proxyAddress = text;
                  });
                },
                cursorColor: const Color(0xff000000),
                style: TextStyle(color: Color(0xff000000)),
              ),
              ElevatedButton(
                child: const Text("确认代理"),
                onPressed: () {
                  widget.setProxy(proxyAddress);
                  // (widget.appKey.currentState as dynamic).reStart();
                },
              ),
            ],
          )),
    );
  }
}

然后输入框能够输入,但是不能删除输入的字符

Iridescentangle commented 5 months ago

我也碰到了,请问有解决此问题吗? @Zhaoiii