Flutter 为什么这个容器是';s背景透明,仅适用于web?

Flutter 为什么这个容器是';s背景透明,仅适用于web?,flutter,Flutter,我不明白。我有一个容器,它的背景色是(不透明的)蓝色 在手机上,它是不透明的: 在网络上,它是透明的: 我是不是误用了弗利特?(小部件包装在材质小部件中,so应具有有效的默认样式) 看起来真的像个虫子。报告说这是一个问题:是的,我也测试了它,并且能够复制。看起来像个虫子。 import 'package:flutter/material.dart'; // The background color of the badges. const Color DEFAULT_BADGE_COLOR

我不明白。我有一个容器,它的背景色是(不透明的)蓝色

  • 在手机上,它是不透明的:
  • 在网络上,它是透明的:
我是不是误用了弗利特?(小部件包装在材质小部件中,so应具有有效的默认样式)


看起来真的像个虫子。报告说这是一个问题:是的,我也测试了它,并且能够复制。看起来像个虫子。
import 'package:flutter/material.dart';

// The background color of the badges.
const Color DEFAULT_BADGE_COLOR = Color.fromARGB(255, 109, 207, 214);

Text colorText(String text, Color color, {double size: 10}) => Text.rich(
  TextSpan(
      text: text,
      style: TextStyle(
        fontSize: size,
        fontFamily: "Poppins",
        color: color,
      )),
  overflow: TextOverflow.ellipsis,
  maxLines: 1,
  softWrap: false,
);

Widget badge(String text, {Color color: DEFAULT_BADGE_COLOR,
  Color textColor: Colors.white,
  double textSize: 30,
  hInpadding: 0.4,
  vInpadding: 0}) =>
  Container(
        child: colorText(text, textColor, size: textSize),
        padding: EdgeInsets.fromLTRB(
            textSize * hInpadding,
            textSize * vInpadding,
            textSize * hInpadding,
            textSize * vInpadding),
        decoration: new BoxDecoration(
            color: color,
            borderRadius:
            new BorderRadius.all(new Radius.circular(textSize * 10))),
      );

Widget content() =>
    Center(child: SizedBox(width:200, height:200, child:Stack(children:[
      Positioned(top:0, left:0, child:badge("ABCDEFG")),
      Positioned(top:10, left:10, child:badge("ABCDEFG")),
      Positioned(top:20, left:20, child:badge("ABCDEFG")),
])));


class DemoApp extends StatelessWidget {
  WidgetBuilder content;

  DemoApp(this.content);

  @override
  Widget build(BuildContext context) =>
      MaterialApp(title: 'Flutter Playground', home: Material(child:content(context)));
}

main()=>runApp(DemoApp((c)=>content()));