Skip to content

Instantly share code, notes, and snippets.

@vovaklh
Created October 3, 2022 11:00
Show Gist options
  • Save vovaklh/0c67dc8cf8d84b2bd041c69bff16ea75 to your computer and use it in GitHub Desktop.
Save vovaklh/0c67dc8cf8d84b2bd041c69bff16ea75 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:meta_app/presentation/themes/theme.dart';
extension BuildContextExt on BuildContext {
AppLocalizations get localizations => AppLocalizations.of(this)!;
ThemeTextStyles get text => Theme.of(this).extension<ThemeTextStyles>()!;
ThemeColors get color => Theme.of(this).extension<ThemeColors>()!;
ThemeGradients get gradient => Theme.of(this).extension<ThemeGradients>()!;
bool get isDarkMode => Theme.of(this).brightness == Brightness.dark;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment