Auto unfocus to hide IME

This commit is contained in:
Junyuan Feng
2022-01-31 16:26:01 +08:00
parent 86be556a22
commit 5d9b19407f
8 changed files with 45 additions and 50 deletions

View File

@@ -44,7 +44,15 @@ class _MyHomePageState extends State<MyHomePage>
super.initState();
_serverProvider = locator<ServerProvider>();
WidgetsBinding.instance?.addObserver(this);
_tabController = TabController(initialIndex: locator<SettingStore>().launchPage.fetch()!, length: tabs.length, vsync: this);
_tabController = TabController(
initialIndex: locator<SettingStore>().launchPage.fetch()!,
length: tabs.length,
vsync: this);
_tabController.addListener(() {
if (_tabController.index == 0) {
FocusScope.of(context).unfocus();
}
});
}
@override