[英]How can I float Text Widget around an Image Widget in Flutter
You could use drop_cap_text library to get this behavior.您可以使用drop_cap_text库来获得此行为。 Usage is something like this:用法是这样的:
DropCapText(
loremIpsumText,
dropCap: DropCap(
width: 100,
height: 100,
child: Image.network(
'https://www.codemate.com/wp-content/uploads/2017/09/flutter-logo.png')
),
),
Or you could try it yourself by mixing and matching SizedBox with RichText as they did in the library.或者,您可以像在库中一样,通过将SizedBox与RichText混合和匹配来自己尝试。
Very simple and you do not need to use the library.非常简单,您不需要使用该库。
// Replace IconSVG with image of you.
RichText(
text: TextSpan(
children: [
WidgetSpan(
child: IconSVG(
IconSVGPath.ic_suggest, 30, 30, null),
),
TextSpan(text: " Tùy chọn các nội dung dưới đây để thay đổi giao diện CV phù hợp với bản thân bạn.",
style: TextStyle(color: HexColor(
StringColors.color_orange_primary),
fontSize: 16,
fontWeight: FontWeight.w400,
fontFamily: NUNITO_SANS),
),
],
style: TextStyle(color: Colors.red,)
),
There's a new float_column library for flutter that supports this:有一个新的用于颤振的float_column库支持此功能:
With code like this:用这样的代码:
FloatColumn(
children: [
const Floatable(float: FCFloat.start, child: DropCap('“T', size: 3)),
Floatable(
float: FCFloat.end,
clear: FCClear.start,
clearMinSpacing: 12,
maxWidthPercentage: 0.333,
padding: EdgeInsetsDirectional.only(start: 8),
child: Img(
assetName: _name('jeremy-bishop-EwKXn5CapA4-unsplash.jpg'),
title: 'Photo by Jeremy Bishop on Unsplash',
),
),
Floatable(
float: FCFloat.start,
clear: FCClear.start,
clearMinSpacing: 175,
maxWidthPercentage: 0.25,
padding: EdgeInsetsDirectional.only(end: 12),
child: Img(
assetName: _name('walt_whitman.jpg'),
title: 'Walt Whitman',
),
),
WrappableText(text: _text),
],
)
You can see the full example code here: basic_ltr.dart您可以在此处查看完整的示例代码: basic_ltr.dart
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.