part of '../chat_screen.dart'; class _DateSeparatorItem { final DateTime date; final GlobalKey key; _DateSeparatorItem(this.date, this.key); } class _MessageItem { final CachedMessage message; final int index; const _MessageItem(this.message, this.index); } class _UnreadSeparatorItem { const _UnreadSeparatorItem(); } class _FrostedPanel extends StatelessWidget { final Color tint; final Border? border; final double sigma; final BackdropKey? backdropKey; final Widget child; const _FrostedPanel({ required this.tint, this.border, this.sigma = AppFrost.panelSigma, this.backdropKey, required this.child, }); @override Widget build(BuildContext context) { return Stack( fit: StackFit.passthrough, clipBehavior: Clip.none, children: [ Positioned.fill( child: GlassSurface( frostTint: tint, frostSigma: sigma, border: border, backdropKey: backdropKey, child: const SizedBox.expand(), ), ), child, ], ); } } class _MeasureSize extends StatefulWidget { final Widget child; final ValueChanged onHeight; const _MeasureSize({required this.onHeight, required this.child}); @override State<_MeasureSize> createState() => _MeasureSizeState(); } class _MeasureSizeState extends State<_MeasureSize> { final GlobalKey _key = GlobalKey(); double _last = -1; void _report() { if (!mounted) return; final height = _key.currentContext?.size?.height; if (height == null) return; if ((height - _last).abs() > 0.5) { _last = height; widget.onHeight(height); } } void _scheduleReport() { WidgetsBinding.instance.addPostFrameCallback((_) => _report()); } @override Widget build(BuildContext context) { _scheduleReport(); return NotificationListener( onNotification: (_) { _scheduleReport(); return true; }, child: SizeChangedLayoutNotifier( child: SizedBox(key: _key, child: widget.child), ), ); } } class ForwardRequest { final int sourceChatId; final String sourceChatName; final String sourceChatIconUrl; final String sourceChatType; final List messages; ForwardRequest({ required this.sourceChatId, required this.sourceChatName, required this.sourceChatIconUrl, required this.sourceChatType, required List messages, }) : messages = List.unmodifiable(messages); ForwardRequest withMessages(List value) => ForwardRequest( sourceChatId: sourceChatId, sourceChatName: sourceChatName, sourceChatIconUrl: sourceChatIconUrl, sourceChatType: sourceChatType, messages: value, ); } class ReplyRequest { final int sourceChatId; final CachedMessage message; const ReplyRequest({required this.sourceChatId, required this.message}); }