Created
December 16, 2025 18:31
-
-
Save fredgrott/ddfa77633518c00735b6261285053ba4 to your computer and use it in GitHub Desktop.
BuildContextExt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| import 'dart:math'; | |
| import 'dart:ui'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:universal_platform/universal_platform.dart'; | |
| /// BuildContextExt is the extensions that | |
| /// are not MediaQuery based. | |
| /// | |
| /// @author Fredrick Allan Grott | |
| extension BuildContextExt on BuildContext { | |
| ThemeData get theme => Theme.of(this); | |
| TextTheme get textTheme => theme.textTheme; | |
| TextTheme get primaryTextTheme => theme.primaryTextTheme; | |
| ColorScheme get colorScheme => theme.colorScheme; | |
| DefaultTextStyle get defaultTextStyle => DefaultTextStyle.of(this); | |
| NavigatorState get navigator => Navigator.of(this); | |
| FocusScopeNode get focusScope => FocusScope.of(this); | |
| ScaffoldMessengerState get scaffoldMessenger => ScaffoldMessenger.of(this); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment