feat(profile): profile photo or seed-illustration avatar

Profiles had only a coloured-initial disc. Now each person can set an
avatar — a real photo OR one of our own seed illustrations (so
pseudonymity stays the default; no photo required).

- ui/avatar.dart: the one-string value scheme carried in the kind:0
  'picture' — a 'data:' photo thumbnail, a 'tane:seed:<glyph>' token, or
  empty. The Nostr ProfileTransport already published 'picture'.
- Photos ride inline as a tiny thumbnail (reuses offerThumbnailDataUri,
  24 KB cap) — no media server, like offer photos.
- avatar_edit.dart: pick/take a photo, choose a seed illustration, or
  remove; ProfileStore stores it; ProfileScreen shows a big editable
  avatar and publishes it.
- PeerAvatar renders photo / illustration / initial fallback.
- ProfileCache gains picture/setPicture; the inbox caches peers' avatars
  alongside their names.
- i18n avatar block (en/es/pt/ast). Tests: value scheme + PeerAvatar
  render modes, store + cache round-trips.

Follow-up: render peers' avatars in chat/market/your-people (thread the
cached picture into PeerAvatar at each call site).
This commit is contained in:
vjrj 2026-07-11 22:21:52 +02:00
parent d28454b010
commit 461bc3cb36
19 changed files with 375 additions and 12 deletions

View file

@ -39,6 +39,7 @@ class TranslationsPt extends Translations with BaseTranslations<AppLocale, Trans
TranslationsPt $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => TranslationsPt(meta: meta ?? this.$meta);
// Translations
@override late final _Translations$avatar$pt avatar = _Translations$avatar$pt._(_root);
@override late final _Translations$seedSaving$pt seedSaving = _Translations$seedSaving$pt._(_root);
@override late final _Translations$calendar$pt calendar = _Translations$calendar$pt._(_root);
@override late final _Translations$app$pt app = _Translations$app$pt._(_root);
@ -85,6 +86,19 @@ class TranslationsPt extends Translations with BaseTranslations<AppLocale, Trans
@override late final _Translations$sale$pt sale = _Translations$sale$pt._(_root);
}
// Path: avatar
class _Translations$avatar$pt extends Translations$avatar$en {
_Translations$avatar$pt._(TranslationsPt root) : this._root = root, super.internal(root);
final TranslationsPt _root; // ignore: unused_field
// Translations
@override String get title => 'A tua foto ou avatar';
@override String get fromPhoto => 'Tirar ou escolher uma foto';
@override String get illustration => 'Ou escolhe um desenho';
@override String get remove => 'Remover';
}
// Path: seedSaving
class _Translations$seedSaving$pt extends Translations$seedSaving$en {
_Translations$seedSaving$pt._(TranslationsPt root) : this._root = root, super.internal(root);
@ -1293,6 +1307,10 @@ class _Translations$intro$slides$plantare$pt extends Translations$intro$slides$p
extension on TranslationsPt {
dynamic _flatMapFunction(String path) {
return switch (path) {
'avatar.title' => 'A tua foto ou avatar',
'avatar.fromPhoto' => 'Tirar ou escolher uma foto',
'avatar.illustration' => 'Ou escolhe um desenho',
'avatar.remove' => 'Remover',
'seedSaving.title' => 'Guardar a sua semente',
'seedSaving.subtitle' => 'O que é preciso para manter a variedade fiel',
'seedSaving.lifeCycle' => 'Ciclo',