Created
May 21, 2020 17:16
-
-
Save c4urself/36a0e25b47ba34899f78e5e22a01be2a to your computer and use it in GitHub Desktop.
theme_override.dart
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
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
/// Overrides the default Theme to force a light app bar | |
class LightAppBarOverride extends StatelessWidget | |
implements PreferredSizeWidget { | |
const LightAppBarOverride({this.child}); | |
final AppBar child; | |
@override | |
Widget build(BuildContext context) { | |
final themeData = Theme.of(context); | |
return Theme( | |
child: child, | |
data: themeData.copyWith( | |
appBarTheme: AppBarTheme( | |
color: Colors.transparent, | |
), | |
), | |
); | |
} | |
@override | |
Size get preferredSize => this.child.preferredSize; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment