Unverified Commit 87c40326 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed accentColor and accentTextTheme dependencies from flutter_gallery (#78378)

parent 2834f44d
...@@ -43,10 +43,11 @@ class NavigationIconView { ...@@ -43,10 +43,11 @@ class NavigationIconView {
if (type == BottomNavigationBarType.shifting) { if (type == BottomNavigationBarType.shifting) {
iconColor = _color; iconColor = _color;
} else { } else {
final ThemeData themeData = Theme.of(context); final ThemeData theme = Theme.of(context);
iconColor = themeData.brightness == Brightness.light final ColorScheme colorScheme = theme.colorScheme;
? themeData.primaryColor iconColor = theme.brightness == Brightness.light
: themeData.accentColor; ? colorScheme.primary
: colorScheme.secondary;
} }
return FadeTransition( return FadeTransition(
......
...@@ -24,7 +24,7 @@ class ExpansionTileListDemo extends StatelessWidget { ...@@ -24,7 +24,7 @@ class ExpansionTileListDemo extends StatelessWidget {
const ListTile(title: Text('Top')), const ListTile(title: Text('Top')),
ExpansionTile( ExpansionTile(
title: const Text('Sublist'), title: const Text('Sublist'),
backgroundColor: Theme.of(context).accentColor.withOpacity(0.025), backgroundColor: Theme.of(context).colorScheme.secondary.withOpacity(0.025),
children: const <Widget>[ children: const <Widget>[
ListTile(title: Text('One')), ListTile(title: Text('One')),
ListTile(title: Text('Two')), ListTile(title: Text('Two')),
......
...@@ -28,7 +28,7 @@ class ModalBottomSheetDemo extends StatelessWidget { ...@@ -28,7 +28,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
child: Text('This is the modal bottom sheet. Slide down to dismiss.', child: Text('This is the modal bottom sheet. Slide down to dismiss.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).colorScheme.secondary,
fontSize: 24.0, fontSize: 24.0,
), ),
), ),
......
...@@ -20,7 +20,7 @@ class _PageSelector extends StatelessWidget { ...@@ -20,7 +20,7 @@ class _PageSelector extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final TabController? controller = DefaultTabController.of(context); final TabController? controller = DefaultTabController.of(context);
final Color color = Theme.of(context).accentColor; final Color color = Theme.of(context).colorScheme.secondary;
return SafeArea( return SafeArea(
top: false, top: false,
bottom: false, bottom: false,
......
...@@ -41,7 +41,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> { ...@@ -41,7 +41,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.', child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: themeData.accentColor, color: themeData.colorScheme.secondary,
fontSize: 24.0, fontSize: 24.0,
), ),
), ),
......
...@@ -123,7 +123,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke ...@@ -123,7 +123,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color iconColor = Theme.of(context).accentColor; final Color iconColor = Theme.of(context).colorScheme.secondary;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Scrollable tabs'), title: const Text('Scrollable tabs'),
......
...@@ -334,7 +334,7 @@ class _SlidersState extends State<_Sliders> { ...@@ -334,7 +334,7 @@ class _SlidersState extends State<_Sliders> {
valueIndicatorColor: Colors.deepPurpleAccent, valueIndicatorColor: Colors.deepPurpleAccent,
thumbShape: _CustomThumbShape(), thumbShape: _CustomThumbShape(),
valueIndicatorShape: _CustomValueIndicatorShape(), valueIndicatorShape: _CustomValueIndicatorShape(),
valueIndicatorTextStyle: theme.accentTextTheme.bodyText1!.copyWith(color: theme.colorScheme.onSurface), valueIndicatorTextStyle: theme.textTheme.bodyText1!.copyWith(color: theme.colorScheme.onSurface),
), ),
child: Slider( child: Slider(
value: _discreteCustomValue, value: _discreteCustomValue,
......
...@@ -25,7 +25,6 @@ final Set<Recipe?> _favoriteRecipes = <Recipe?>{}; ...@@ -25,7 +25,6 @@ final Set<Recipe?> _favoriteRecipes = <Recipe?>{};
final ThemeData _kTheme = ThemeData( final ThemeData _kTheme = ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
primarySwatch: Colors.teal, primarySwatch: Colors.teal,
accentColor: Colors.redAccent,
); );
class PestoHome extends StatelessWidget { class PestoHome extends StatelessWidget {
...@@ -84,12 +83,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -84,12 +83,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
data: _kTheme.copyWith(platform: Theme.of(context).platform), data: _kTheme.copyWith(platform: Theme.of(context).platform),
child: Scaffold( child: Scaffold(
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
child: const Icon(Icons.edit), backgroundColor: Colors.redAccent,
onPressed: () { onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar( ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('Not supported.'), content: Text('Not supported.'),
)); ));
}, },
child: const Icon(Icons.edit),
), ),
body: CustomScrollView( body: CustomScrollView(
semanticChildCount: widget.recipes!.length, semanticChildCount: widget.recipes!.length,
...@@ -392,8 +392,9 @@ class _RecipePageState extends State<RecipePage> { ...@@ -392,8 +392,9 @@ class _RecipePageState extends State<RecipePage> {
Positioned( Positioned(
right: 16.0, right: 16.0,
child: FloatingActionButton( child: FloatingActionButton(
child: Icon(isFavorite ? Icons.favorite : Icons.favorite_border), backgroundColor: Colors.redAccent,
onPressed: _toggleFavorite, onPressed: _toggleFavorite,
child: Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
), ),
), ),
], ],
......
...@@ -79,21 +79,14 @@ ThemeData _buildShrineTheme() { ...@@ -79,21 +79,14 @@ ThemeData _buildShrineTheme() {
final ThemeData base = ThemeData.light(); final ThemeData base = ThemeData.light();
return base.copyWith( return base.copyWith(
colorScheme: kShrineColorScheme, colorScheme: kShrineColorScheme,
accentColor: kShrineBrown900,
primaryColor: kShrinePink100, primaryColor: kShrinePink100,
buttonColor: kShrinePink100,
scaffoldBackgroundColor: kShrineBackgroundWhite, scaffoldBackgroundColor: kShrineBackgroundWhite,
cardColor: kShrineBackgroundWhite, cardColor: kShrineBackgroundWhite,
errorColor: kShrineErrorRed, errorColor: kShrineErrorRed,
buttonTheme: const ButtonThemeData(
colorScheme: kShrineColorScheme,
textTheme: ButtonTextTheme.normal,
),
primaryIconTheme: _customIconTheme(base.iconTheme), primaryIconTheme: _customIconTheme(base.iconTheme),
inputDecorationTheme: const InputDecorationTheme(border: CutCornersBorder()), inputDecorationTheme: const InputDecorationTheme(border: CutCornersBorder()),
textTheme: _buildShrineTextTheme(base.textTheme), textTheme: _buildShrineTextTheme(base.textTheme),
primaryTextTheme: _buildShrineTextTheme(base.primaryTextTheme), primaryTextTheme: _buildShrineTextTheme(base.primaryTextTheme),
accentTextTheme: _buildShrineTextTheme(base.accentTextTheme),
iconTheme: _customIconTheme(base.iconTheme), iconTheme: _customIconTheme(base.iconTheme),
); );
} }
......
...@@ -35,7 +35,7 @@ class _LinkTextSpan extends TextSpan { ...@@ -35,7 +35,7 @@ class _LinkTextSpan extends TextSpan {
void showGalleryAboutDialog(BuildContext context) { void showGalleryAboutDialog(BuildContext context) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final TextStyle? aboutTextStyle = themeData.textTheme.bodyText1; final TextStyle? aboutTextStyle = themeData.textTheme.bodyText1;
final TextStyle linkStyle = themeData.textTheme.bodyText1!.copyWith(color: themeData.accentColor); final TextStyle linkStyle = themeData.textTheme.bodyText1!.copyWith(color: themeData.colorScheme.primary);
showAboutDialog( showAboutDialog(
context: context, context: context,
......
...@@ -25,14 +25,12 @@ ThemeData _buildDarkTheme() { ...@@ -25,14 +25,12 @@ ThemeData _buildDarkTheme() {
); );
final ThemeData base = ThemeData( final ThemeData base = ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
accentColorBrightness: Brightness.dark,
colorScheme: colorScheme, colorScheme: colorScheme,
primaryColor: primaryColor, primaryColor: primaryColor,
primaryColorDark: const Color(0xFF0050a0), primaryColorDark: const Color(0xFF0050a0),
primaryColorLight: secondaryColor, primaryColorLight: secondaryColor,
indicatorColor: Colors.white, indicatorColor: Colors.white,
toggleableActiveColor: const Color(0xFF6997DF), toggleableActiveColor: const Color(0xFF6997DF),
accentColor: secondaryColor,
canvasColor: const Color(0xFF202124), canvasColor: const Color(0xFF202124),
scaffoldBackgroundColor: const Color(0xFF202124), scaffoldBackgroundColor: const Color(0xFF202124),
backgroundColor: const Color(0xFF202124), backgroundColor: const Color(0xFF202124),
...@@ -41,7 +39,6 @@ ThemeData _buildDarkTheme() { ...@@ -41,7 +39,6 @@ ThemeData _buildDarkTheme() {
return base.copyWith( return base.copyWith(
textTheme: _buildTextTheme(base.textTheme), textTheme: _buildTextTheme(base.textTheme),
primaryTextTheme: _buildTextTheme(base.primaryTextTheme), primaryTextTheme: _buildTextTheme(base.primaryTextTheme),
accentTextTheme: _buildTextTheme(base.accentTextTheme),
); );
} }
...@@ -54,14 +51,12 @@ ThemeData _buildLightTheme() { ...@@ -54,14 +51,12 @@ ThemeData _buildLightTheme() {
); );
final ThemeData base = ThemeData( final ThemeData base = ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
accentColorBrightness: Brightness.dark,
colorScheme: colorScheme, colorScheme: colorScheme,
primaryColor: primaryColor, primaryColor: primaryColor,
indicatorColor: Colors.white, indicatorColor: Colors.white,
toggleableActiveColor: const Color(0xFF1E88E5), toggleableActiveColor: const Color(0xFF1E88E5),
splashColor: Colors.white24, splashColor: Colors.white24,
splashFactory: InkRipple.splashFactory, splashFactory: InkRipple.splashFactory,
accentColor: secondaryColor,
canvasColor: Colors.white, canvasColor: Colors.white,
scaffoldBackgroundColor: Colors.white, scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white, backgroundColor: Colors.white,
...@@ -70,6 +65,5 @@ ThemeData _buildLightTheme() { ...@@ -70,6 +65,5 @@ ThemeData _buildLightTheme() {
return base.copyWith( return base.copyWith(
textTheme: _buildTextTheme(base.textTheme), textTheme: _buildTextTheme(base.textTheme),
primaryTextTheme: _buildTextTheme(base.primaryTextTheme), primaryTextTheme: _buildTextTheme(base.primaryTextTheme),
accentTextTheme: _buildTextTheme(base.accentTextTheme),
); );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment