最近在用flutter開發(fā)web界面,出現(xiàn)了這個(gè)問題夭拌。
Overflow on channel: flutter/platform. Messages on this channel are being discarded in FIFO fashion. The engine may not be running or you need to adjust the buffer size if of the channel.
image.png
看了github上的42880 issues不翩,說是channel的問題盟戏,會在將來更改咖杂,但是我仔細(xì)觀察了一下之后肛循,發(fā)現(xiàn)并不是铭腕,而是跟狀態(tài)欄屬性更改
有關(guān)。
解決方案
一多糠、brightness
找到項(xiàng)目中AppBar有使用到更改狀態(tài)欄字體顏色的地方累舷,如下
AppBar(
brightness: Brightness.light,
);
改成
AppBar(
brightness: kIsWeb ? null : Brightness.light,
);
二、AnnotatedRegion<SystemUiOverlayStyle>
as we know
這玩意也是用來改狀態(tài)欄顏色的地方
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark,
)
當(dāng)在web中夹孔,就不用就完事了被盈。
比如這樣。
Widget build(BuildContext context) {
return kIsWeb
? mainWidgets
: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark, child: mainWidgets);
}