Files
buzz/mobile/lib/features/channels/composer_send_origin.dart
klopez4212 8cc7e94392 Refine mobile Messages sections, Duo navigation, and chat typography (#9885)
## Summary

- Organize mobile Messages into configurable flat sections. See All
keeps the list and its search position when opening a conversation, and
supports side-by-side browsing on an unfolded Duo.
- Use the same 16-point Messages gutter in booklet and open Duo layouts.
The regular iPhone uses 20 points. Align navigation actions and use
native inline titles on See All.
- Update mobile typography and spacing across chat rows, message
bubbles, drafts, and the composer. Render code proportionally to the
17-point message body.

## Device review

Compare the leading edges of the section headings and channel icons in
Messages on the open Duo and in booklet mode. Open See All and check
that its rows follow the same column.

---------

Signed-off-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-23 13:14:05 -08:00

34 lines
1.1 KiB
Dart

import 'dart:async';
import 'package:flutter/widgets.dart';
/// Carries submitted composer geometry through asynchronous send preparation.
class ComposerSendOrigin {
static final _zoneKey = Object();
static final _insertionKey = Object();
static Future<void> uponLocalInsertion(
VoidCallback inserted,
Future<void> Function() send,
) => runZoned(send, zoneValues: {_insertionKey: inserted});
static void didInsertLocalMessage() =>
(Zone.current[_insertionKey] as VoidCallback?)?.call();
/// Captures only geometry; no draft or identity data is retained.
static Rect? capture(GlobalKey key) {
final box = key.currentContext?.findRenderObject();
return box is RenderBox && box.hasSize && box.attached
? box.localToGlobal(Offset.zero) & box.size
: null;
}
/// Geometry for this send, isolated from other concurrent submissions.
static Rect? get current => Zone.current[_zoneKey] as Rect?;
/// Retains the submitted surface until this send creates its local claim.
static Future<void> run(Rect? origin, Future<void> Function() send) =>
runZoned(send, zoneValues: {_zoneKey: origin});
}