mirror of
https://github.com/git-touch/git-touch
synced 2024-12-19 03:33:42 +01:00
refactor: text with organization
This commit is contained in:
parent
cdd8876657
commit
9f4df079a2
@ -95,7 +95,7 @@ class MeScreen extends StatelessWidget {
|
||||
text: TextContainsOrganization(
|
||||
user.company,
|
||||
style: TextStyle(fontSize: 16, color: theme.palette.text),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
oneLine: true,
|
||||
),
|
||||
),
|
||||
if (isNotNullOrEmpty(user.location))
|
||||
|
@ -143,7 +143,7 @@ class UserScreen extends StatelessWidget {
|
||||
text: TextContainsOrganization(
|
||||
user.company,
|
||||
style: TextStyle(fontSize: 16, color: theme.palette.text),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
oneLine: true,
|
||||
),
|
||||
),
|
||||
if (isNotNullOrEmpty(user.location))
|
||||
|
@ -105,7 +105,6 @@ class UsersScreen extends StatelessWidget {
|
||||
name: payload.name,
|
||||
avatarUrl: payload.avatarUrl,
|
||||
bio: payload.bio,
|
||||
inUserScreen: true,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -4,10 +4,9 @@ import 'package:git_touch/utils/utils.dart';
|
||||
class TextContainsOrganization extends StatelessWidget {
|
||||
final String text;
|
||||
final TextStyle style;
|
||||
final TextOverflow overflow;
|
||||
final bool oneLine;
|
||||
|
||||
TextContainsOrganization(this.text,
|
||||
{this.style, this.overflow = TextOverflow.clip});
|
||||
TextContainsOrganization(this.text, {this.style, this.oneLine = false});
|
||||
|
||||
static final _reg = RegExp(r'@[A-Za-z-]+');
|
||||
|
||||
@ -29,6 +28,9 @@ class TextContainsOrganization extends StatelessWidget {
|
||||
}
|
||||
|
||||
return RichText(
|
||||
text: TextSpan(children: spans, style: style), overflow: overflow);
|
||||
text: TextSpan(children: spans, style: style),
|
||||
overflow: oneLine ? TextOverflow.ellipsis : null,
|
||||
maxLines: oneLine ? 1 : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class UserItem extends StatelessWidget {
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: 15,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
oneLine: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user