Want to enable night mode in whole app

Suppose I added night mode option on screen 1 but I have 3 or more screens in my app and want to enable night mode in whole app so how can I do it plz if anyone know about this then plz tell me.

You can store the colours in a tinyDB, and set them to darker variants when you enable night mode.
When initialising the screen, set the colours of each component from the tinyDB value.

3 Likes

Can you or anyone show me by providing blocks images.

Try it yourself. It’ll be a good exercise for you.

I tried a lot but unable to find any solution and its very urgent to complete my app before 15th July because I am making that app for my CA students plz help me so that I will learn those blocks this time.

As Vishwas said, store the colours in TinyDB, and set components to that color on Screenn.Initialize.

It sshould be very easy.

1 Like

It’s more simple than you think, you only have to add a variable in the TinyDB , for example you make that the DB store a variable called night and the value 0 , then you have to add in each screen “when screen … inicialites” and then check the value of the variable night , if it is 0 set each component to the colors you want , the when you turn on the dark theme you must change the variable value from 0 to 1 and check if it is 1 you set colors to the main colors.

Why not just use boolean true, false instead for 0 or 1

/Boban

1 Like

do you mean 15 Aug ?