feat(species): derived verified reference links (GBIF/Wikipedia/Wikispecies)
Add a read-only "Learn more" section on the variety detail that surfaces verified external references for the linked species, built deterministically from bundled identifiers — no titles bundled, no network, offline-first: - GBIF taxon page from the backbone key - Wikipedia via Wikidata Special:GoToLinkedPage (locale-aware, RTL-safe, falls back to the Wikidata item when a language lacks the article) - Wikispecies from the scientific name Enrich the bundled catalog (species.json v3) with gbif_key + wikidata_qid for all 14 species, cross-checked (each QID carries GBIF ID P846 = the key). Schema already had the columns; seedBundled now persists and backfills them. The grower's own manual links stay but are demoted (progressive disclosure): the section only shows when links exist and "Add link" is a low-emphasis button, since hand-adding a link is the rarer power move. Pure-Dart link builder is unit-tested; repo persistence/backfill and the detail-screen section are covered too.
This commit is contained in:
parent
ba87bf2719
commit
fde0ea6eab
14 changed files with 484 additions and 46 deletions
|
|
@ -301,6 +301,8 @@ class VarietyDetail extends Equatable {
|
|||
this.notes,
|
||||
this.speciesId,
|
||||
this.scientificName,
|
||||
this.gbifKey,
|
||||
this.wikidataQid,
|
||||
this.viabilityYears,
|
||||
this.isOrganic = false,
|
||||
this.needsReproduction = false,
|
||||
|
|
@ -322,6 +324,12 @@ class VarietyDetail extends Equatable {
|
|||
final String? speciesId;
|
||||
final String? scientificName;
|
||||
|
||||
/// Bundled identifiers of the linked species, used to derive verified
|
||||
/// "learn more" reference links (GBIF/Wikipedia/Wikispecies); null when no
|
||||
/// species is linked or the catalog entry lacks the id.
|
||||
final int? gbifKey;
|
||||
final String? wikidataQid;
|
||||
|
||||
/// Grower-declared organic ("eco") provenance.
|
||||
final bool isOrganic;
|
||||
|
||||
|
|
@ -363,6 +371,8 @@ class VarietyDetail extends Equatable {
|
|||
notes,
|
||||
speciesId,
|
||||
scientificName,
|
||||
gbifKey,
|
||||
wikidataQid,
|
||||
viabilityYears,
|
||||
isOrganic,
|
||||
needsReproduction,
|
||||
|
|
@ -804,12 +814,16 @@ class VarietyRepository {
|
|||
|
||||
String? scientificName;
|
||||
int? viabilityYears;
|
||||
int? gbifKey;
|
||||
String? wikidataQid;
|
||||
if (v.speciesId != null) {
|
||||
final species = await (_db.select(
|
||||
_db.species,
|
||||
)..where((s) => s.id.equals(v.speciesId!))).getSingleOrNull();
|
||||
scientificName = species?.scientificName;
|
||||
viabilityYears = species?.viabilityYears;
|
||||
gbifKey = species?.gbifKey;
|
||||
wikidataQid = species?.wikidataQid;
|
||||
}
|
||||
|
||||
final lots =
|
||||
|
|
@ -896,6 +910,8 @@ class VarietyRepository {
|
|||
notes: v.notes,
|
||||
speciesId: v.speciesId,
|
||||
scientificName: scientificName,
|
||||
gbifKey: gbifKey,
|
||||
wikidataQid: wikidataQid,
|
||||
viabilityYears: viabilityYears,
|
||||
isOrganic: v.isOrganic,
|
||||
needsReproduction: v.needsReproduction,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue