|
|
|
@ -62,7 +62,7 @@ class AppText extends StatefulWidget {
|
|
|
|
this.textOverflow,
|
|
|
|
this.textOverflow,
|
|
|
|
this.textDecoration,
|
|
|
|
this.textDecoration,
|
|
|
|
this.letterSpacing,
|
|
|
|
this.letterSpacing,
|
|
|
|
this.isCopyable = true,
|
|
|
|
this.isCopyable = false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -103,10 +103,7 @@ class _AppTextState extends State<AppText> {
|
|
|
|
margin: widget.margin != null
|
|
|
|
margin: widget.margin != null
|
|
|
|
? EdgeInsets.all(widget.margin)
|
|
|
|
? EdgeInsets.all(widget.margin)
|
|
|
|
: EdgeInsets.only(
|
|
|
|
: EdgeInsets.only(
|
|
|
|
top: widget.marginTop,
|
|
|
|
top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft),
|
|
|
|
right: widget.marginRight,
|
|
|
|
|
|
|
|
bottom: widget.marginBottom,
|
|
|
|
|
|
|
|
left: widget.marginLeft),
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
@ -121,21 +118,16 @@ class _AppTextState extends State<AppText> {
|
|
|
|
right: 0,
|
|
|
|
right: 0,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
colors: [
|
|
|
|
Theme.of(context).backgroundColor,
|
|
|
|
Theme.of(context).backgroundColor,
|
|
|
|
Theme.of(context).backgroundColor.withOpacity(0),
|
|
|
|
Theme.of(context).backgroundColor.withOpacity(0),
|
|
|
|
], begin: Alignment.bottomCenter, end: Alignment.topCenter)),
|
|
|
|
],
|
|
|
|
|
|
|
|
begin: Alignment.bottomCenter,
|
|
|
|
|
|
|
|
end: Alignment.topCenter)),
|
|
|
|
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.allowExpand &&
|
|
|
|
if (widget.allowExpand && widget.readMore && text.length > widget.maxLength)
|
|
|
|
widget.readMore &&
|
|
|
|
|
|
|
|
text.length > widget.maxLength)
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0),
|
|
|
|
padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0),
|
|
|
|
child: InkWell(
|
|
|
|
child: InkWell(
|
|
|
|
@ -172,13 +164,7 @@ class _AppTextState extends State<AppText> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
child: SelectableText(
|
|
|
|
child: SelectableText(
|
|
|
|
!hidden
|
|
|
|
!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)),
|
|
|
|
? text
|
|
|
|
|
|
|
|
: (text.substring(
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
text.length > widget.maxLength
|
|
|
|
|
|
|
|
? widget.maxLength
|
|
|
|
|
|
|
|
: text.length)),
|
|
|
|
|
|
|
|
textAlign: widget.textAlign,
|
|
|
|
textAlign: widget.textAlign,
|
|
|
|
// overflow: widget.maxLines != null
|
|
|
|
// overflow: widget.maxLines != null
|
|
|
|
// ? ((widget.maxLines > 1)
|
|
|
|
// ? ((widget.maxLines > 1)
|
|
|
|
@ -196,8 +182,7 @@ class _AppTextState extends State<AppText> {
|
|
|
|
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
|
|
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
|
|
color: widget.color != null ? widget.color : Colors.black,
|
|
|
|
color: widget.color != null ? widget.color : Colors.black,
|
|
|
|
fontSize: widget.fontSize ?? _getFontSize(),
|
|
|
|
fontSize: widget.fontSize ?? _getFontSize(),
|
|
|
|
letterSpacing: widget.letterSpacing ??
|
|
|
|
letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null),
|
|
|
|
(widget.variant == "overline" ? 1.5 : null),
|
|
|
|
|
|
|
|
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
|
|
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
|
|
fontFamily: widget.fontFamily ?? 'Poppins',
|
|
|
|
fontFamily: widget.fontFamily ?? 'Poppins',
|
|
|
|
decoration: widget.textDecoration,
|
|
|
|
decoration: widget.textDecoration,
|
|
|
|
@ -207,19 +192,9 @@ class _AppTextState extends State<AppText> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return Text(
|
|
|
|
return Text(
|
|
|
|
!hidden
|
|
|
|
!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)),
|
|
|
|
? text
|
|
|
|
|
|
|
|
: (text.substring(
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
text.length > widget.maxLength
|
|
|
|
|
|
|
|
? widget.maxLength
|
|
|
|
|
|
|
|
: text.length)),
|
|
|
|
|
|
|
|
textAlign: widget.textAlign,
|
|
|
|
textAlign: widget.textAlign,
|
|
|
|
overflow: widget.maxLines != null
|
|
|
|
overflow: widget.maxLines != null ? ((widget.maxLines > 1) ? TextOverflow.fade : TextOverflow.ellipsis) : null,
|
|
|
|
? ((widget.maxLines > 1)
|
|
|
|
|
|
|
|
? TextOverflow.fade
|
|
|
|
|
|
|
|
: TextOverflow.ellipsis)
|
|
|
|
|
|
|
|
: null,
|
|
|
|
|
|
|
|
maxLines: widget.maxLines ?? null,
|
|
|
|
maxLines: widget.maxLines ?? null,
|
|
|
|
style: widget.style != null
|
|
|
|
style: widget.style != null
|
|
|
|
? _getFontStyle().copyWith(
|
|
|
|
? _getFontStyle().copyWith(
|
|
|
|
@ -231,8 +206,7 @@ class _AppTextState extends State<AppText> {
|
|
|
|
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
|
|
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
|
|
color: widget.color != null ? widget.color : Colors.black,
|
|
|
|
color: widget.color != null ? widget.color : Colors.black,
|
|
|
|
fontSize: widget.fontSize ?? _getFontSize(),
|
|
|
|
fontSize: widget.fontSize ?? _getFontSize(),
|
|
|
|
letterSpacing: widget.letterSpacing ??
|
|
|
|
letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null),
|
|
|
|
(widget.variant == "overline" ? 1.5 : null),
|
|
|
|
|
|
|
|
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
|
|
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
|
|
fontFamily: widget.fontFamily ?? 'Poppins',
|
|
|
|
fontFamily: widget.fontFamily ?? 'Poppins',
|
|
|
|
decoration: widget.textDecoration,
|
|
|
|
decoration: widget.textDecoration,
|
|
|
|
|