flutter_ime
A Flutter plugin for controlling IME (Input Method Editor) state. This plugin helps you manage keyboard input modes in Windows and macOS applications, particularly useful for login forms and password fields where English input is preferred.
Features
- Switch to English keyboard mode programmatically on Windows and macOS
- Check current keyboard input mode
- Automatic IME mode switching for password fields
- Native API implementation (Windows IMM32, macOS Carbon)
Getting started
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_ime: ^2.0.0
Usage
import 'package:flutter_ime/flutter_ime.dart';
// Switch to English keyboard
await setEnglishKeyboard();
// Check if current keyboard is English
bool isEnglish = await isEnglishKeyboard();
Automatic Password Field Example
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final _passwordFocusNode = FocusNode();
@override
void initState() {
super.initState();
// Switch to English keyboard when password field gets focus
_passwordFocusNode.addListener(() {
if (_passwordFocusNode.hasFocus) {
setEnglishKeyboard();
}
});
}
@override
Widget build(BuildContext context) {
return TextField(
focusNode: _passwordFocusNode,
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
),
);
}
}
Additional information
Platform Support
- Windows - ✅ Fully supported
- macOS - ✅ Fully supported
- Other platforms - ❌ Not supported
Requirements
- Windows 7 or later (for Windows)
- macOS 10.10 or later (for macOS)
- Flutter SDK 3.0.0 or later
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Issues and Feedback
Please file issues and feedback using the GitHub Issues.