I have a black background when using flutter_tex, how do I set a white background?



It sounds like a very simple question, but the code just doesn’t work. I say "white", the app says "black", don’t know why.

I’m using Flutter 2.5.1 with flutter_tex 4.0.3 (I want to display equations).

Here is my code :

class Maths extends StatelessWidget {
  const Maths({
    Key? key,
  }) : super(key: key);

  Widget build(BuildContext context) {
    // this is the example from the documentation on pub.dev (simplified)
    return TeXView(
      child: const TeXViewDocument(
          When \(a \ne 0 \), there are two solutions to \(ax^2 + bx + c = 0\) and they are
          $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$""",
        style: TeXViewStyle(
          backgroundColor: Colors.red, // works, except for Colors.white.
          contentColor: Colors.blue, // works perfectly fine
      style: const TeXViewStyle(
        backgroundColor: Colors.red, // works, except for Colors.white

The only problem is the black blackground behind the equation, I just want it white ;(

Please help me, I don’t understand a thing with flutter_tex


Ok, I fixed my problem. This was clearly the oddest bug I’ve ever seen in my life. The problem came from the dark mode of my android phone…….

I’ll have to find how we force the white mode now…

Answered By – ThomasG2201

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More