Custom virtual keyboard for Flutter applications.
Designed for cases where application UI theme must fully control keyboard appearance.
Add the following to your pubspec.yaml:
dependencies:
flutter_virtual_keyboard:
git:
url: https://github.com/itschillipill/flutter-virtual-keyboard.gitThen run:
flutter pub getimport 'package:flutter_virtual_keyboard/flutter_virtual_keyboard.dart';Wrap your home screen with VirtualKeyboardScope inside MaterialApp:
import 'package:flutter/material.dart';
import 'package:flutter_virtual_keyboard/flutter_virtual_keyboard.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Virtual Keyboard Demo',
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: ThemeMode.system, // or your custom theme controller
home: VirtualKeyboardScope(
// Optional: custom theme
themeData: VirtualKeyboardThemeData.light(), // or .dark()
child: const KeyboardTestPage(),
),
);
}
}
class KeyboardTestPage extends StatelessWidget {
const KeyboardTestPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: VirtualKeyboardTextField(
controller: TextEditingController(),
decoration: const InputDecoration(
hintText: 'Tap to open keyboard',
),
),
),
);
}
}You can provide custom theme data:
VirtualKeyboardScope(
themeData: VirtualKeyboardThemeData(
// your theme
),
child: YourApp(),
)Built-in themes:
VirtualKeyboardThemeData.light()VirtualKeyboardThemeData.dark()VirtualKeyboardThemeData.material(ColorScheme colorScheme)
| Component | Description |
|---|---|
VirtualKeyboardScope |
Required. Wraps your app and provides keyboard functionality |
VirtualKeyboardTextField |
Text field that triggers the virtual keyboard |
VirtualKeyboardController |
Programmatically control keyboard visibility |
VirtualKeyboardThemeData |
Custom theme configuration |
final controller = VirtualKeyboardController();
// Show keyboard
controller.show();
// Hide keyboard
controller.hide();
// Check if keyboard is open
bool isOpen = controller.isOpen;
// Get keyboard height
double height = controller.keyboardHeight;Access controller anywhere:
final controller = VirtualKeyboardScope.of(context);✅ Do's:
- Always wrap your app with
VirtualKeyboardScope - Place
VirtualKeyboardScopeinsideMaterialApp(not inbuilder) - Use
VirtualKeyboardTextFieldinstead of defaultTextFieldfor Virtual Keyboard - U can still use native keyboard by using default
TextField
❌ Don'ts:
- Don't place
VirtualKeyboardScopeoutsideMaterialApp - Don't use multiple
VirtualKeyboardScopeinstances - Don't expect system keyboard features (autocorrect, IME, etc.)
This package does NOT replace system keyboard due to OS limitations:
- ❌ No native autocorrect
- ❌ No IME features
- ❌ No system language handling
- ❌ No OS-level prediction
- ❌ No third-party keyboard support
Keyboard works only inside the application.
- Alphabetic keyboard layout
- Numeric keyboard layout
- App-based theming
- Custom controller
- Keyboard scope
- Animated show / hide
- Long-press additional characters
- Accessibility improvements
- Performance optimizations
- Suggestions builder
✅ Recommended for:
- Numeric / PIN input
- Calculators
- Terminals and POS systems
- Kiosk applications
- Controlled enterprise apps
- Custom branded keyboards
❌ Not recommended for:
- Full text input replacement
- Messaging apps
- Editors and word processors
- IME-like behavior
- Multilingual heavy input
| Platform | Status |
|---|---|
| Android | ✅ Tested |
| iOS | |
| Web | ✅ Tested |
| Windows | ✅ Tested |
| macOS | |
| Linux |
Technically in all platforms shoud work.
MIT
This package is under active development.
Feel free to open issues or submit PRs on GitHub.
Made with ❤️ by itschillipill