import 'package:material_ui/material_ui.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; List threadViewPostReplies(List? replies) { return replies?.whereType().toList(growable: false) ?? const []; } bool scrollToHighlightedThreadReply({ required ScrollController scrollController, required List replies, required String highlightedReplyUri, }) { final highlightedIndex = replies.indexWhere( (reply) => reply.post.uri.toString() == highlightedReplyUri, ); if (highlightedIndex < 0 || !scrollController.hasClients) return false; const estimatedReplyExtent = 100.0; final estimatedOffset = highlightedIndex * estimatedReplyExtent; scrollController.animateTo( estimatedOffset.clamp(0, scrollController.position.maxScrollExtent), duration: const Duration(milliseconds: 400), curve: Curves.easeOut, ); return true; }