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.
34 lines
1.2 KiB
Dart
34 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension ContextUtils on BuildContext {
|
|
double get screenHeight => MediaQuery.of(this).size.height;
|
|
|
|
double get screenWidth => MediaQuery.of(this).size.width;
|
|
|
|
ThemeData get theme => Theme.of(this);
|
|
|
|
TextTheme get textTheme => theme.textTheme;
|
|
// 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,
|
|
);
|
|
}
|
|
}
|