You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App_New/lib/extensions/context_extensions.dart

34 lines
1.2 KiB
Dart

2 months ago
import 'package:flutter/material.dart';
extension ContextUtils on BuildContext {
double get screenHeight => MediaQuery.of(this).size.height;
2 months ago
2 months ago
double get screenWidth => MediaQuery.of(this).size.width;
2 months ago
2 months ago
ThemeData get theme => Theme.of(this);
2 months ago
2 months ago
TextTheme get textTheme => theme.textTheme;
2 months ago
// TextStyle get headline1 => textTheme.headline1!;
// TextStyle get headline2 => textTheme.headline2!;
// TextStyle get headline3 => textTheme.headline3!;
// TextStyle get headline4 => textTheme.headline4!;
// TextStyle get headline5 => textTheme.headline5!;
// TextStyle get headline6 => textTheme.headline6!;
// TextStyle get bodyText1 => textTheme.bodyText1!;
// TextStyle get bodyText2 => textTheme.bodyText2!;
}
extension ShowBottomSheet on BuildContext {
Future<T?> showBottomSheet<T>({isScrollControlled = true, isDismissible = false, required Widget child, Color? backgroundColor, enableDra = false, useSafeArea = false}) {
return showModalBottomSheet<T>(
context: this,
isScrollControlled: isScrollControlled,
isDismissible: isDismissible,
enableDrag: enableDra,
useSafeArea: useSafeArea,
backgroundColor: backgroundColor ?? Colors.transparent,
builder: (_) => child,
);
}
2 months ago
}