revert(app): X 게시글 해시태그 하이라이트 제거
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1f3c2f3d9b
commit
fc38678fbd
1 changed files with 6 additions and 64 deletions
|
|
@ -499,8 +499,13 @@ class _ScheduleDetailViewState extends ConsumerState<ScheduleDetailView> {
|
|||
// 본문
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: _buildLinkedText(
|
||||
child: Text(
|
||||
decodeHtmlEntities(schedule.content ?? schedule.title),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 이미지
|
||||
|
|
@ -686,69 +691,6 @@ class _ScheduleDetailViewState extends ConsumerState<ScheduleDetailView> {
|
|||
);
|
||||
}
|
||||
|
||||
/// 해시태그, URL을 감지해서 링크로 만드는 RichText
|
||||
Widget _buildLinkedText(String text) {
|
||||
// 해시태그 (#xxx) 또는 URL (https://...) 매칭
|
||||
final pattern = RegExp(r'(#[^\s#]+)|(https?://[^\s]+)');
|
||||
final spans = <InlineSpan>[];
|
||||
int lastEnd = 0;
|
||||
|
||||
for (final match in pattern.allMatches(text)) {
|
||||
// 매치 앞의 일반 텍스트
|
||||
if (match.start > lastEnd) {
|
||||
spans.add(TextSpan(
|
||||
text: text.substring(lastEnd, match.start),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
final matched = match.group(0)!;
|
||||
final isHashtag = matched.startsWith('#');
|
||||
|
||||
final url = isHashtag
|
||||
? 'https://x.com/hashtag/${Uri.encodeComponent(matched.substring(1))}?src=hashtag_click'
|
||||
: matched;
|
||||
|
||||
spans.add(WidgetSpan(
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
baseline: TextBaseline.alphabetic,
|
||||
child: GestureDetector(
|
||||
onTap: () => _launchUrl(url),
|
||||
child: Text(
|
||||
matched,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: AppColors.primary,
|
||||
decoration: isHashtag ? TextDecoration.none : TextDecoration.underline,
|
||||
decorationColor: AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
lastEnd = match.end;
|
||||
}
|
||||
|
||||
// 남은 텍스트
|
||||
if (lastEnd < text.length) {
|
||||
spans.add(TextSpan(
|
||||
text: text.substring(lastEnd),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return RichText(text: TextSpan(children: spans));
|
||||
}
|
||||
|
||||
/// 인증 배지
|
||||
Widget _buildVerifiedBadge() {
|
||||
return SizedBox(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue