android - 如何在灯光模式下使用flutter_tex(Flutter)?
问题描述
我正在使用这个包flutter_tex 4.0.3
,但我遇到了一个问题:如果我理解正确的话,flutter_tex 使用了一个 webview,显然当启用了 Android 的暗模式时,flutter webview 会强制使用暗模式。
更清楚地说,我如何在 light 模式下使用 flutter_tex ?如何在我使用的 Android 设备上启用 Flutter 中的暗模式?
这是我的代码:
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 ;(
),
);
}
}
设置为“Colors.white”的“backgroundColor”属性不起作用,而它适用于任何其他颜色......
我尝试了以下“解决方案”:
- 此外,这在 AndroidManifest.xml 文件中也不起作用:
<item name="android:forceDarkAllowed">false</item>
- 小部件“主题”
Theme(
data: ThemeData.light(),
child: TeXView(...),
),
SystemChrome
颤振包中的类services
:
void main() {
// ...
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarBrightness: Brightness.light),
);
}
themeMode
&theme
属性来自MaterialApp
:
MaterialApp(
themeMode: ThemeMode.light,
theme: ThemeData.light(),
// ...
);
我完全迷路了。我的目标是在白色背景上显示一个方程,仅此而已,我想痛苦地尖叫......
注意:由于 null 安全性,flutter_tex 是我唯一可以使用的包。
请帮我
解决方案
推荐阅读
- haskell - Haskell:从“类型”转移到“数据”
- c++ - 仅在 c++ 不起作用的情况下从具有整数类型的结构中读取和写入
- xamarin - Azure.Identity 在 Xamarin.iOS 平台上引发未实现的异常
- javascript - JavaScript 从对象中选择一部分变量
- ios - 构建应用程序后未显示 Xcode13 应用程序图标
- r - scales = "free" 对 facet_grid 没有影响
- javascript - 如何使用 NodeJS 在 Mongodb 中使用 updateOne
- c++ - 从返回不完整输出的未排序链表中删除重复项
- tensorflow - 验证集和测试集的结果不同
- python - 如何在 Python 中的每个循环周期后获取下一个 n[0:1] 字母?