-
-
Save mortezanazari-hub/df05a20910a6953e407adfe3bd9315ca to your computer and use it in GitHub Desktop.
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
| /// {@template theme_scope} | |
| /// InheritedWidget که [AppTheme] را برای برنامه فراهم میکند. | |
| /// InheritedWidget provides [AppTheme] for app | |
| /// {@endtemplate} | |
| class ThemeScope extends InheritedWidget { | |
| /// {@macro theme_scope} | |
| const ThemeScope({ | |
| super.key, | |
| required Widget child, | |
| required this.themeMode, | |
| required this.appTheme, | |
| }) : super(child: child); | |
| /// حالت تم فعلی. | |
| /// The current theme mode. | |
| final ThemeMode themeMode; | |
| /// تم فعلی برنامه. | |
| /// The current app theme. | |
| final AppTheme appTheme; | |
| /// تم فعلی. | |
| /// The current theme. | |
| static ThemeScope of(BuildContext context) { | |
| final result = context.dependOnInheritedWidgetOfExactType<ThemeScope>(); | |
| assert(result != null, 'No ThemeScope found in context'); | |
| return result!; | |
| } | |
| @override | |
| bool updateShouldNotify(ThemeScope oldWidget) => true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment