Files
record-tool/lib/core/extensions/context_extensions.dart
2026-06-03 14:07:10 +08:00

17 lines
546 B
Dart

import 'package:flutter/material.dart';
extension BuildContextX on BuildContext {
ThemeData get theme => Theme.of(this);
ColorScheme get colors => theme.colorScheme;
TextTheme get textTheme => theme.textTheme;
Size get screenSize => MediaQuery.sizeOf(this);
EdgeInsets get safePadding => MediaQuery.paddingOf(this);
bool get isDarkMode => theme.brightness == Brightness.dark;
bool get isKeyboardVisible => MediaQuery.viewInsetsOf(this).bottom > 0;
void hideKeyboard() {
FocusManager.instance.primaryFocus?.unfocus();
}
}