mirrored_repositories/blogclubapp/lib/core
import 'dart:math';

import 'package:flutter/material.dart';

import '../constants/app/app_constants.dart';
import '../init/theme/app_theme.dart';

extension ContextExtension on BuildContext {
  MediaQueryData get mediaQuery => MediaQuery.of(this);
}

extension MediaQueryExtension on BuildContext {
  double get height => mediaQuery.size.height;
  double get width => mediaQuery.size.width;

  double get lowValue => height * 0.01;
  double get normalValue => height * 0.02;
  double get mediumValue => height * 0.04;
  double get highValue => height * 0.1;

  double get borderRadius => 12;
  double get radius => width * 0.06;
}

extension ThemeExtension on BuildContext {
  ThemeData get theme => AppTheme.instance.theme;
  TextTheme get textTheme => theme.textTheme; // Modify this line
  ColorScheme get colors => theme.colorScheme;
  TextStyle get textStyle => const TextStyle(
      fontFamily: ApplicationConstants.FONT_FAMILY,
      fontWeight: FontWeight.w500,
      fontSize: 14);
  TextStyle get textStyleTitle => const TextStyle(
      fontFamily: ApplicationConstants.FONT_FAMILY,
      fontWeight: FontWeight.w500,
      fontSize: 24);
  TextStyle get textStyleBody => const TextStyle(
      fontFamily: ApplicationConstants.FONT_FAMILY,
      fontWeight: FontWeight.w500,
      fontSize: 14);
}

extension PaddingExtensionAll on BuildContext {
  EdgeInsets get paddingLow => EdgeInsets.all(lowValue);
  EdgeInsets get paddingNormal => EdgeInsets.all(normalValue);
  EdgeInsets get paddingMedium => EdgeInsets.all(mediumValue);
  EdgeInsets get paddingHigh => EdgeInsets.all(highValue);
}

extension PaddingExtensionSymetric on BuildContext {
  EdgeInsets get paddingLowVertical => EdgeInsets.symmetric(vertical: lowValue);
  EdgeInsets get paddingNormalVertical =>
      EdgeInsets.symmetric(vertical: normalValue);
  EdgeInsets get paddingMediumVertical =>
      EdgeInsets.symmetric(vertical: mediumValue);
  EdgeInsets get paddingHighVertical =>
      EdgeInsets.symmetric(vertical: highValue);

  EdgeInsets get paddingLowHorizontal =>
      EdgeInsets.symmetric(horizontal: lowValue);
  EdgeInsets get paddingNormalHorizontal =>
      EdgeInsets.symmetric(horizontal: normalValue);
  EdgeInsets get paddingMediumHorizontal =>
      EdgeInsets.symmetric(horizontal: mediumValue);
  EdgeInsets get paddingHighHorizontal =>
      EdgeInsets.symmetric(horizontal: highValue);
}

extension PageExtension on BuildContext {
  Color get randomColor => Colors.primaries[Random().nextInt(17)];
}

extension DurationExtension on BuildContext {
  Duration get lowDuration => const Duration(milliseconds: 500);
  Duration get normalDuration => const Duration(seconds: 1);
}
