I got this warning 'background' is deprecated and shouldn't be used. Use surface instead. This feature was deprecated after v3.18.0-0.1.pre. Try replacing the use of the deprecated member with the replacement with the following code: import 'package:flutter/material.dart'; // light mode ThemeData lightMode = ThemeData( brightness: Brightness.light, colorScheme: ColorScheme.light( background: Colors.grey.shade300, primary: Colors.grey.shade200, secondary: Colors.grey.shade400, inversePrimary: Colors.grey.shade800, ) ); In code I call the background in the following way backgroundColor: Theme.of(context).colorScheme.background. How to fix it? Continue reading...