You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

三星Galaxy设备Flutter登录表单自动填充输入首字符后键盘消失

Flutter自动填充在三星Galaxy设备(Samsung Pass)上的键盘收起问题

问题描述

在搭载Samsung Pass作为自动填充服务的三星Galaxy设备上,运行包含Form与AutofillGroup的Flutter示例应用时,输入首个字符且Samsung Pass无匹配前缀建议的情况下,键盘会突然收起。

复现代码

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Auto Fill Issue'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Form(
              child: AutofillGroup(
                child: Column(
                  children: [
                    TextFormField(
                      autocorrect: false,
                      keyboardType: TextInputType.emailAddress,
                      autofillHints: const [AutofillHints.email],
                      autovalidateMode: AutovalidateMode.onUserInteraction,
                    ),
                    TextFormField(
                      autocorrect: false,
                      keyboardType: TextInputType.text,
                      autofillHints: const [AutofillHints.password],
                      autovalidateMode: AutovalidateMode.onUserInteraction,
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: const FloatingActionButton(
        onPressed: TextInput.finishAutofillContext,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

环境信息

[✓] Flutter (Channel stable, 3.19.1, on macOS 14.3 23D56 darwin-arm64)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 15.2)
    ✗ Unable to get list of installed Simulator runtimes.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.86.0)
[✓] Connected device (3 available)            
[✓] Network resources

补充说明

  • 在Pixel模拟器中使用Google作为自动填充服务时无此问题;
  • 将Samsung Pass更新至最新版本后问题仍存在;
  • 三星Galaxy设备无法禁用Samsung Pass,所有用户都会遭遇该问题。

内容的提问来源于stack exchange,提问作者Ali Bakhtiyari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 06:27:06