Skip to content

Instantly share code, notes, and snippets.

@c4urself
Created May 21, 2020 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4urself/36a0e25b47ba34899f78e5e22a01be2a to your computer and use it in GitHub Desktop.
Save c4urself/36a0e25b47ba34899f78e5e22a01be2a to your computer and use it in GitHub Desktop.
theme_override.dart
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