如何在 Flutter 中使文本围绕图像浮动?

How can I float text around an image in Flutter?

如何在 Flutter 中实现这种布局?

它非常基本,只是简单的行,里面有数据

 Row(
      mainAxisAlignment: MainAxisAlignment.start,
      children: <Widget>[
      Image.asset('Your image link here'),
      Text('you paragraph here')
    ],)

您可以使用 Stack():https://flutter.io/docs/development/ui/layout#stack

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    var stack = Stack(
      alignment: const Alignment(0.6, 0.6),
      children: [
        CircleAvatar(
          backgroundImage: AssetImage('images/pic.jpg'),
          radius: 100.0,
        ),
        Container(
          decoration: BoxDecoration(
            color: Colors.black45,
          ),
          child: Text(
            'Mia B',
            style: TextStyle(
              fontSize: 20.0,
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
          ),
        ),
      ],
    );
    // ...
  }
}

您可以将 Container() 小部件与 foregroundDecoration 一起使用:

Container(
  child: Text('Hello World'),
  foregroundDecoration: BoxDecoration(
    image: DecorationImage(
      image: NetworkImage('https://www.example.com/images/frame.png'),
      centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
    ),
  ),

我发布了软件包 drop_cap_text 来实现 DropCapText,您也可以将 图像 作为自定义小部件放入 DropCap。