#flutter #flutter-layout
#прерывание #Трепещущий макет
Вопрос:
У меня есть длинный текст, который не прерывает строку. Я подозреваю, что виджет переноса создает эту проблему.
Вот мой код
SafeArea(
child: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
child: ColumnSuper(
innerDistance: -0.5,
alignment: Alignment.topCenter,
children: [
Container(
width: MediaQuery.of(buildContext).size.width,
child: Wrap(children: [
GestureDetector(
onTap: () => checkNav(buildContext, linkProtection),
child: Container(
alignment: ali,
margin: margin,
padding: padding,
decoration: BoxDecoration(
border: border,
color: backgroundColor,
borderRadius: BorderRadius.circular(borderRadius),
),
child: Text(
"""$text""",
maxLines: 5,
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: titleColor,
fontSize: titleSize * 1.2,
height: titleLineHeight,
letterSpacing: titleSpa,
fontStyle: titleStyle,
decoration: titleDecoration,
fontWeight: titleWeight),
),
),
),
]),
),
]),
)),
);
Я пытался также поместить расширенный перед текстовым виджетом, но ничего не происходит.
Комментарии:
1. Какой у вас виджет ColumnSuper?
2. @Akif Я использовал эту библиотеку pub.dev/packages/assorted_layout_widgets , но это не имеет значения, я удалил этот виджет, и он все еще встречается
Ответ №1:
попробуйте установить softWrap
свойство текстового виджета true:
Text(
"""$text""",
maxLines: 5,
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
softWrap: true,
style: TextStyle(
color: Colors.green,
),
),