fix: Prevent URLs and GIF links from being displayed as text content below media messages.

This commit is contained in:
pradeepkumar
2026-03-15 01:06:56 +05:30
parent f659be07ae
commit 8884038842
2 changed files with 123 additions and 116 deletions

View File

@@ -312,135 +312,138 @@ class _MenuDrawer extends ConsumerWidget {
), ),
// Bottom section: Log Out or Login buttons // Bottom section: Log Out or Login buttons
Padding( SafeArea(
padding: top: false,
const EdgeInsets.symmetric(horizontal: 24, vertical: 16), child: Padding(
child: isAuthenticated padding:
? // Log Out button - filled orange const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
SizedBox( child: Column(
width: double.infinity, mainAxisSize: MainAxisSize.min,
height: 54, children: [
child: ElevatedButton.icon( if (isAuthenticated) ...[
onPressed: () { // Log Out button - filled orange
Navigator.pop(context); SizedBox(
ref.read(authProvider.notifier).logout(); width: double.infinity,
}, height: 54,
icon: const Icon( child: ElevatedButton.icon(
Icons.logout_rounded, onPressed: () {
color: AppColors.primaryDark, Navigator.pop(context);
size: 24, ref.read(authProvider.notifier).logout();
), },
label: const Text( icon: const Icon(
'Log Out', Icons.logout_rounded,
style: TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w700,
color: AppColors.primaryDark, color: AppColors.primaryDark,
size: 24,
), ),
), label: const Text(
style: ElevatedButton.styleFrom( 'Log Out',
backgroundColor: AppColors.accentOrange, style: TextStyle(
elevation: 0, fontFamily: 'Fractul',
shape: RoundedRectangleBorder( fontSize: 14,
borderRadius: BorderRadius.circular(15), fontWeight: FontWeight.w700,
color: AppColors.primaryDark,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.accentOrange,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
), ),
), ),
), ),
) ] else ...[
: // Login / Sign Up buttons // Login button
Column( SizedBox(
mainAxisSize: MainAxisSize.min, width: double.infinity,
children: [ height: 54,
SizedBox( child: ElevatedButton.icon(
width: double.infinity, onPressed: () {
height: 54, Navigator.pop(context);
child: ElevatedButton.icon( context.push('/login');
onPressed: () { },
Navigator.pop(context); icon: const Icon(
context.push('/login'); Icons.login,
}, color: Colors.white,
icon: const Icon( size: 20,
Icons.login, ),
label: const Text(
'Log In',
style: TextStyle(
fontFamily: 'Fractul',
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.white, color: Colors.white,
size: 20,
), ),
label: const Text( ),
'Log In', style: ElevatedButton.styleFrom(
style: TextStyle( backgroundColor: AppColors.accentOrange,
fontFamily: 'Fractul', elevation: 0,
fontSize: 16, shape: RoundedRectangleBorder(
fontWeight: FontWeight.w700, borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.accentOrange,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
), ),
), ),
), ),
const SizedBox(height: 12), ),
SizedBox( const SizedBox(height: 12),
width: double.infinity, // Sign Up button
height: 54, SizedBox(
child: OutlinedButton.icon( width: double.infinity,
onPressed: () { height: 54,
Navigator.pop(context); child: OutlinedButton.icon(
context.push('/signup'); onPressed: () {
}, Navigator.pop(context);
icon: const Icon( context.push('/signup');
Icons.person_add_outlined, },
icon: const Icon(
Icons.person_add_outlined,
color: AppColors.accentOrange,
size: 20,
),
label: const Text(
'Sign Up',
style: TextStyle(
fontFamily: 'Fractul',
fontSize: 16,
fontWeight: FontWeight.w700,
color: AppColors.accentOrange, color: AppColors.accentOrange,
size: 20,
), ),
label: const Text( ),
'Sign Up', style: OutlinedButton.styleFrom(
style: TextStyle( side: const BorderSide(
fontFamily: 'Fractul', color: AppColors.accentOrange,
fontSize: 16, width: 1.5,
fontWeight: FontWeight.w700,
color: AppColors.accentOrange,
),
), ),
style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder(
side: const BorderSide( borderRadius: BorderRadius.circular(15),
color: AppColors.accentOrange,
width: 1.5,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
), ),
), ),
), ),
], ),
],
// Version number
const SizedBox(height: 12),
FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
final version = snapshot.hasData
? 'v${snapshot.data!.version} (${snapshot.data!.buildNumber})'
: '';
return Text(
version,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.hintText,
),
);
},
), ),
), ],
),
// Version number ),
FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
final version = snapshot.hasData
? 'v${snapshot.data!.version} (${snapshot.data!.buildNumber})'
: '';
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
version,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.hintText,
),
),
);
},
), ),
], ],
), ),

View File

@@ -985,8 +985,10 @@ class _ChatScreenState extends ConsumerState<ChatScreen> {
const SizedBox(height: 6), const SizedBox(height: 6),
// Message content // Message content
_buildMessageContent(message, isMine: true), _buildMessageContent(message, isMine: true),
// Show text content below media if present // Show text content below media if present (but not URLs/GIF links)
if (isMediaMessage && message.content.isNotEmpty) if (isMediaMessage &&
message.content.isNotEmpty &&
!message.content.trim().startsWith('http'))
Padding( Padding(
padding: const EdgeInsets.only(top: 4), padding: const EdgeInsets.only(top: 4),
child: Text( child: Text(
@@ -1071,8 +1073,10 @@ class _ChatScreenState extends ConsumerState<ChatScreen> {
const SizedBox(height: 6), const SizedBox(height: 6),
// Message content // Message content
_buildMessageContent(message, isMine: false), _buildMessageContent(message, isMine: false),
// Show text content below media if present // Show text content below media if present (but not URLs/GIF links)
if (isMediaMessage && message.content.isNotEmpty) if (isMediaMessage &&
message.content.isNotEmpty &&
!message.content.trim().startsWith('http'))
Padding( Padding(
padding: const EdgeInsets.only(top: 4), padding: const EdgeInsets.only(top: 4),
child: Text( child: Text(