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 74c7edaecd
commit ec56819fbf
19 changed files with 375 additions and 12 deletions

View file

@ -1,4 +1,10 @@
{
"avatar": {
"title": "La to semeya o avatar",
"fromPhoto": "Facer o escoyer una semeya",
"illustration": "O escueyi un dibuxu",
"remove": "Quitar"
},
"seedSaving": {
"title": "Guardar la so semiente",
"subtitle": "Lo que fai falta pa caltener la variedá fiel",

View file

@ -1,4 +1,10 @@
{
"avatar": {
"title": "Your photo or avatar",
"fromPhoto": "Take or choose a photo",
"illustration": "Or pick an illustration",
"remove": "Remove"
},
"seedSaving": {
"title": "Saving its seed",
"subtitle": "What it takes to keep the variety true",

View file

@ -1,4 +1,10 @@
{
"avatar": {
"title": "Tu foto o avatar",
"fromPhoto": "Hacer o elegir una foto",
"illustration": "O elige un dibujo",
"remove": "Quitar"
},
"seedSaving": {
"title": "Conservar su semilla",
"subtitle": "Lo que hace falta para mantener la variedad fiel",

View file

@ -1,4 +1,10 @@
{
"avatar": {
"title": "A tua foto ou avatar",
"fromPhoto": "Tirar ou escolher uma foto",
"illustration": "Ou escolhe um desenho",
"remove": "Remover"
},
"seedSaving": {
"title": "Guardar a sua semente",
"subtitle": "O que é preciso para manter a variedade fiel",

View file

@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 4
/// Strings: 2016 (504 per locale)
/// Strings: 2032 (508 per locale)
///
/// Built on 2026-07-11 at 12:07 UTC
/// Built on 2026-07-11 at 20:16 UTC
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import

View file

@ -39,6 +39,7 @@ class TranslationsAst extends Translations with BaseTranslations<AppLocale, Tran
TranslationsAst $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => TranslationsAst(meta: meta ?? this.$meta);
// Translations
@override late final _Translations$avatar$ast avatar = _Translations$avatar$ast._(_root);
@override late final _Translations$seedSaving$ast seedSaving = _Translations$seedSaving$ast._(_root);
@override late final _Translations$calendar$ast calendar = _Translations$calendar$ast._(_root);
@override late final _Translations$app$ast app = _Translations$app$ast._(_root);
@ -85,6 +86,19 @@ class TranslationsAst extends Translations with BaseTranslations<AppLocale, Tran
@override late final _Translations$sale$ast sale = _Translations$sale$ast._(_root);
}
// Path: avatar
class _Translations$avatar$ast extends Translations$avatar$en {
_Translations$avatar$ast._(TranslationsAst root) : this._root = root, super.internal(root);
final TranslationsAst _root; // ignore: unused_field
// Translations
@override String get title => 'La to semeya o avatar';
@override String get fromPhoto => 'Facer o escoyer una semeya';
@override String get illustration => 'O escueyi un dibuxu';
@override String get remove => 'Quitar';
}
// Path: seedSaving
class _Translations$seedSaving$ast extends Translations$seedSaving$en {
_Translations$seedSaving$ast._(TranslationsAst root) : this._root = root, super.internal(root);
@ -1294,6 +1308,10 @@ class _Translations$intro$slides$plantare$ast extends Translations$intro$slides$
extension on TranslationsAst {
dynamic _flatMapFunction(String path) {
return switch (path) {
'avatar.title' => 'La to semeya o avatar',
'avatar.fromPhoto' => 'Facer o escoyer una semeya',
'avatar.illustration' => 'O escueyi un dibuxu',
'avatar.remove' => 'Quitar',
'seedSaving.title' => 'Guardar la so semiente',
'seedSaving.subtitle' => 'Lo que fai falta pa caltener la variedá fiel',
'seedSaving.lifeCycle' => 'Ciclu',

View file

@ -40,6 +40,7 @@ class Translations with BaseTranslations<AppLocale, Translations> {
Translations $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => Translations(meta: meta ?? this.$meta);
// Translations
late final Translations$avatar$en avatar = Translations$avatar$en.internal(_root);
late final Translations$seedSaving$en seedSaving = Translations$seedSaving$en.internal(_root);
late final Translations$calendar$en calendar = Translations$calendar$en.internal(_root);
late final Translations$app$en app = Translations$app$en.internal(_root);
@ -86,6 +87,27 @@ class Translations with BaseTranslations<AppLocale, Translations> {
late final Translations$sale$en sale = Translations$sale$en.internal(_root);
}
// Path: avatar
class Translations$avatar$en {
Translations$avatar$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'Your photo or avatar'
String get title => 'Your photo or avatar';
/// en: 'Take or choose a photo'
String get fromPhoto => 'Take or choose a photo';
/// en: 'Or pick an illustration'
String get illustration => 'Or pick an illustration';
/// en: 'Remove'
String get remove => 'Remove';
}
// Path: seedSaving
class Translations$seedSaving$en {
Translations$seedSaving$en.internal(this._root);
@ -2289,6 +2311,10 @@ class Translations$intro$slides$plantare$en {
extension on Translations {
dynamic _flatMapFunction(String path) {
return switch (path) {
'avatar.title' => 'Your photo or avatar',
'avatar.fromPhoto' => 'Take or choose a photo',
'avatar.illustration' => 'Or pick an illustration',
'avatar.remove' => 'Remove',
'seedSaving.title' => 'Saving its seed',
'seedSaving.subtitle' => 'What it takes to keep the variety true',
'seedSaving.lifeCycle' => 'Cycle',

View file

@ -39,6 +39,7 @@ class TranslationsEs extends Translations with BaseTranslations<AppLocale, Trans
TranslationsEs $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => TranslationsEs(meta: meta ?? this.$meta);
// Translations
@override late final _Translations$avatar$es avatar = _Translations$avatar$es._(_root);
@override late final _Translations$seedSaving$es seedSaving = _Translations$seedSaving$es._(_root);
@override late final _Translations$calendar$es calendar = _Translations$calendar$es._(_root);
@override late final _Translations$app$es app = _Translations$app$es._(_root);
@ -85,6 +86,19 @@ class TranslationsEs extends Translations with BaseTranslations<AppLocale, Trans
@override late final _Translations$sale$es sale = _Translations$sale$es._(_root);
}
// Path: avatar
class _Translations$avatar$es extends Translations$avatar$en {
_Translations$avatar$es._(TranslationsEs root) : this._root = root, super.internal(root);
final TranslationsEs _root; // ignore: unused_field
// Translations
@override String get title => 'Tu foto o avatar';
@override String get fromPhoto => 'Hacer o elegir una foto';
@override String get illustration => 'O elige un dibujo';
@override String get remove => 'Quitar';
}
// Path: seedSaving
class _Translations$seedSaving$es extends Translations$seedSaving$en {
_Translations$seedSaving$es._(TranslationsEs root) : this._root = root, super.internal(root);
@ -1296,6 +1310,10 @@ class _Translations$intro$slides$plantare$es extends Translations$intro$slides$p
extension on TranslationsEs {
dynamic _flatMapFunction(String path) {
return switch (path) {
'avatar.title' => 'Tu foto o avatar',
'avatar.fromPhoto' => 'Hacer o elegir una foto',
'avatar.illustration' => 'O elige un dibujo',
'avatar.remove' => 'Quitar',
'seedSaving.title' => 'Conservar su semilla',
'seedSaving.subtitle' => 'Lo que hace falta para mantener la variedad fiel',
'seedSaving.lifeCycle' => 'Ciclo',

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',