1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter 'background' is deprecated

Discussão em 'Mobile' iniciado por Stack, Outubro 10, 2024 às 03:42.

  1. Stack

    Stack Membro Participativo

    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...

Compartilhe esta Página