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

[Flutter] What is the new method for the deprecated backgroundColor

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

  1. Stack

    Stack Membro Participativo

    I was following an old flutter tutorial in which backgroundColor was used. Here is what I wrote following the tutorial:

    Widget build(BuildContext context) {
    return MaterialApp(
    debugShowCheckedModeBanner: false,
    title: 'My app',
    theme: ThemeData.dark().copyWith(
    backgroundColor: backgroundColor,
    ),
    home: const Text("My UI page"),
    );
    }
    }


    The myBackgroundColor is a const in another file consiting all the colors for the app. What should I write in theme to apply myBackgroundColor?

    The flutter docs say backgroundColor is deprecated and use colorScheme.background instead. But when using colorScheme.background I get an error sayind undefined name 'colorScheme'.

    Continue reading...

Compartilhe esta Página