Created
October 20, 2025 13:51
-
-
Save shafayathossain/c4e74986f01677a7d81df8882f5af2fc 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
| Widget materialAppWrapper(Widget child) { | |
| return Builder( // <-- Wrap with Builder | |
| builder: (context) { | |
| final locale = Localizations.maybeLocaleOf(context); // <-- Access localizations | |
| return MaterialApp( | |
| theme: ThemeData( | |
| colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | |
| useMaterial3: true, | |
| ), | |
| darkTheme: ThemeData( | |
| colorScheme: ColorScheme.fromSeed( | |
| seedColor: Colors.deepPurple, | |
| brightness: Brightness.dark, | |
| ), | |
| useMaterial3: true, | |
| ), | |
| locale: locale, | |
| supportedLocales: AppLocalizations.supportedLocales, | |
| localizationsDelegates: const [ | |
| AppLocalizations.delegate, | |
| GlobalMaterialLocalizations.delegate, | |
| GlobalWidgetsLocalizations.delegate, | |
| GlobalCupertinoLocalizations.delegate, | |
| ], | |
| home: Scaffold( | |
| body: child, | |
| ), | |
| ); | |
| }, | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment