I'm using the package flutter_tex 4.0.3
and I have a problem: if I understood correctly, flutter_tex uses a webview, and apparently the flutter webview forces the dark mode when the dark mode of Android is enabled.
More clearly, how do I use flutter_tex with the light mode ? How do I disable the dark mode in Flutter when it's enabled on the Android device that I use ?
Here is my code :
class _Maths extends StatelessWidget {
const _Maths({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return const TeXView(
renderingEngine: TeXViewRenderingEngine.katex(),
child: TeXViewDocument(
r"""<h3>$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$</h3>""",
style: TeXViewStyle(
textAlign: TeXViewTextAlign.Center,
backgroundColor: Colors.white, // still dark ;(
),
),
style: TeXViewStyle(
margin: TeXViewMargin.all(5),
padding: TeXViewPadding.all(10),
border: TeXViewBorder.all(
TeXViewBorderDecoration(
borderColor: Colors.blue,
borderStyle: TeXViewBorderStyle.Solid,
borderWidth: 1,
),
),
backgroundColor: Colors.white, // still dark ;(
),
);
}
}
The "backgroundColor" property set to "Colors.white" doesn't work, whereas it works for any other color...
I tried the following "solutions":
- Besides, this doesn't work either in the AndroidManifest.xml file:
<item name="android:forceDarkAllowed">false</item>
- The widget "Theme"
Theme(
data: ThemeData.light(),
child: TeXView(...),
),
- The
SystemChrome
class from flutter packageservices
:
void main() {
// ...
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarBrightness: Brightness.light),
);
}
themeMode
&theme
properties fromMaterialApp
:
MaterialApp(
themeMode: ThemeMode.light,
theme: ThemeData.light(),
// ...
);
I'm completely lost. My goal is to display an equation on a white background, that's all and I wanna scream with pain...
Note: flutter_tex is the only package I can use because of the null safety.
Please, help me