【发布时间】:2019-06-05 09:26:56
【问题描述】:
【问题讨论】:
-
到目前为止你尝试了什么?
-
没什么,真的。我在文档中搜索可以为我指明正确方向的内容,但没有找到。
-
令人失望...
标签: dart flutter mobile-development
【问题讨论】:
标签: dart flutter mobile-development
我发布了包drop_cap_text 来实现DropCapText,你也可以在DropCap里面放一个图像作为自定义小部件。
【讨论】:
它非常基本,只是简单的行,里面有数据
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),
),
),
【讨论】: