**Major Features Added:** - **Inline Reply System**: Replace compose screen with inline reply boxes - **Thread Navigation**: Parent/child navigation with jump functionality - **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy - **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions **Frontend Changes:** - **ThreadedCommentWidget**: Complete rewrite with animations and navigation - **ThreadNode Model**: Added parent references and descendant counting - **ThreadedConversationScreen**: Integrated navigation handlers - **PostDetailScreen**: Replaced with threaded conversation view - **ComposeScreen**: Added reply indicators and context - **PostActions**: Fixed visibility checks for chain buttons **Backend Changes:** - **API Route**: Added /posts/:id/thread endpoint - **Post Repository**: Include allow_chain and visibility fields in feed - **Thread Handler**: Support for fetching post chains **UI/UX Improvements:** - **Reply Context**: Clear indication when replying to specific posts - **Character Counting**: 500 character limit with live counter - **Visual Hierarchy**: Depth-based indentation and styling - **Smooth Animations**: SizeTransition, FadeTransition, hover states - **Chain Navigation**: Parent/child buttons with visual feedback **Technical Enhancements:** - **Animation Controllers**: Proper lifecycle management - **State Management**: Clean separation of concerns - **Navigation Callbacks**: Reusable navigation system - **Error Handling**: Graceful fallbacks and user feedback This creates a Reddit-style threaded conversation experience with smooth animations, inline replies, and intuitive navigation between posts in a chain.
94 lines
2.9 KiB
Dart
94 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../models/post.dart';
|
|
import '../../theme/app_theme.dart';
|
|
import '../media/signed_media_image.dart';
|
|
import 'post_view_mode.dart';
|
|
|
|
/// Post media widget with view-mode-aware sizing.
|
|
///
|
|
/// Logic:
|
|
/// - feed: BoxFit.cover with fixed height (300)
|
|
/// - detail: Full height (unconstrained)
|
|
/// - compact: Smaller height (200)
|
|
class PostMedia extends StatelessWidget {
|
|
final Post? post;
|
|
final Widget? child;
|
|
final PostViewMode mode;
|
|
|
|
const PostMedia({
|
|
super.key,
|
|
this.post,
|
|
this.child,
|
|
this.mode = PostViewMode.feed,
|
|
});
|
|
|
|
/// Get image height based on view mode
|
|
double get _imageHeight {
|
|
switch (mode) {
|
|
case PostViewMode.feed:
|
|
return 300.0;
|
|
case PostViewMode.detail:
|
|
return 500.0; // Full height for detail view
|
|
case PostViewMode.compact:
|
|
return 200.0; // Smaller for profile lists
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (post != null && post!.imageUrl != null && post!.imageUrl!.isNotEmpty) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: AppTheme.spacingSm),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: _imageHeight,
|
|
width: double.infinity,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
|
|
child: SignedMediaImage(
|
|
url: post!.imageUrl!,
|
|
fit: mode == PostViewMode.feed ? BoxFit.cover : BoxFit.contain,
|
|
loadingBuilder: (context) => Container(
|
|
color: AppTheme.queenPink.withValues(alpha: 0.3),
|
|
child: const Center(child: CircularProgressIndicator()),
|
|
),
|
|
errorBuilder: (context, error, stackTrace) => Container(
|
|
color: Colors.red.withValues(alpha: 0.3),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(Icons.broken_image,
|
|
size: 48, color: Colors.white),
|
|
const SizedBox(height: 8),
|
|
Text('Error: $error',
|
|
style: const TextStyle(
|
|
color: Colors.white, fontSize: 10)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
if (child == null) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: AppTheme.spacingSm),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|
|
}
|