AppFlowy/frontend/appflowy_flutter/integration_test/shared/keyboard.dart
Lucas.Xu 9a5dbbb3ce
chore: upgrade to Flutter 3.22.0 (#5395)
* chore: upgrade flutter to 3.22.0

* chore: upgrade editor version

* chore: upgrade CI files

* fix: failed tests
2024-05-23 11:07:09 +08:00

23 lines
627 B
Dart

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart' as flutter_test;
class FlowyTestKeyboard {
static Future<void> simulateKeyDownEvent(
List<LogicalKeyboardKey> keys, {
required flutter_test.WidgetTester tester,
bool withKeyUp = false,
}) async {
for (final LogicalKeyboardKey key in keys) {
await flutter_test.simulateKeyDownEvent(key);
await tester.pumpAndSettle();
}
if (withKeyUp) {
for (final LogicalKeyboardKey key in keys) {
await flutter_test.simulateKeyUpEvent(key);
await tester.pumpAndSettle();
}
}
}
}