init
This commit is contained in:
16
lib/core/extensions/context_extensions.dart
Normal file
16
lib/core/extensions/context_extensions.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user