Thread
#compose
    Florian

    Florian

    1 year ago
    I'm not really getting the point of this default surface in a new Compose Activity. What's it's purpose? And why does it set the background color?
    s

    Se7eN

    1 year ago
    Well I guess this is just an example
    You don't have to include it if your root composable is a
    Scaffold
    or some other composable that includes
    Surface
    Florian

    Florian

    1 year ago
    Oh interesting, I didn't know Scaffold includes Surface
    s

    Se7eN

    1 year ago
    Yep many other material components include Surface
    Florian

    Florian

    1 year ago
    thank you
    yea I've tried to read that but it didn't say much to me
    I also didn't notice a difference removing it, probably because all my screens use Scaffold
    s

    Se7eN

    1 year ago
    Yeah if you remove it in the Greetings example and run the app in dark mode, you can see your
    Text
    won't pick up the white color automatically so it will show black text on a black background
    Florian

    Florian

    1 year ago
    ah this makes sense, thank you very much!
    Colton Idle

    Colton Idle

    1 year ago
    @Florian I also asked something similar to this a while back. And one thing I learned (from Nick Butcher I think) is that a surface also clips it's children which compose doesn't clip children by default, so you could run into some issues in that.
    Florian

    Florian

    1 year ago
    @Colton Idle what do you mean by "clip"?
    Colton Idle

    Colton Idle

    1 year ago
    In xml land the equivallent is
    android:clipChildren
    which is set to true by default. In compose, clipping is set to false by default.
    Florian

    Florian

    1 year ago
    interesting, thank you