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,输入文字后不能删除 #112

Open
Zhaoiii opened this issue Mar 28, 2023 · 3 comments
Open

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

Zhaoiii opened this issue Mar 28, 2023 · 3 comments

Comments

@Zhaoiii
Copy link

Zhaoiii commented Mar 28, 2023

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

@talisk
Copy link
Member

talisk commented Mar 30, 2023

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

@Zhaoiii
Copy link
Author

Zhaoiii commented Apr 3, 2023

------版本信息-------
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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants