V- Modal AI: Visual Video / Image Search - Flutter Video SDK
Dart android-sdkflutterflutter-appflutter-packageflutter-sdkflutter-videoflutter-video-editingflutter-video-playerflutter-video-sdkflutter-videosflutter-videosdkmobile-videomobile-video-editor-sdkmobile-video-sdkvideo-editingvideo-sdkvideo-searchvideo-search-enginevideo-streaming
Release Flutter SDK from c1099511b66087a5958b2c1a0f814f60271c9c42
vmodal-release-app68c1e4615cc4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 17c67bd..77f0736 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,3 +1,11 @@+----------------------------------------------------------+date: 2026-09-05+commit_hash: 0f70f90+title: Restore and validate the Sightline Flutter example+summary:+ - Restored the omitted Sightline application sources in the public SDK export.+ - Added dependency, analysis, formatting, test, and manifest coverage for example 04.+## 1.2.2- Configured the public pub.dev workflow to initialize GitHub Actions OIDCdiff --git a/README.md b/README.mdindex d926864..9d961a6 100644--- a/README.md+++ b/README.md@@ -359,10 +359,15 @@ The offline gate analyzes the package, runs the SDK and example tests, checks ro----<p align="center"><strong>Build video experiences people can search, not just scroll.</strong></p>+------------------------------+## Flutter SDK Goals-The vmodal_sdk_flutter repository provides the official Flutter SDK for integrating V-Modal AI’s advanced multimodal video and image search technology into cross-platform applications. Developed as an open-source tool, the SDK abstracts complex machine learning infrastructure into simple, developer-friendly methods. This allows mobile developers to incorporate deep visual intelligence into their apps without managing raw vector databases or heavy AI pipelines. During its current public beta phase, the SDK enables fast, semantic querying across media libraries using natural language text or visual references.+Developed as an open-source tool, the SDK abstracts complex machine learning infrastructure into simple, developer-friendly methods. This allows mobile developers to incorporate deep visual intelligence into their apps without managing raw vector databases or heavy AI pipelines. During its current public beta phase, the SDK enables fast, semantic querying across media libraries using natural language text or visual references.The framework supports unified cross-platform logic, ensuring identical integration paths for both iOS and Android deployment. By optimizing communication with V-Modal AI’s backend, the SDK minimizes network latency and processing overhead on user devices. This makes it ideal for apps requiring real-time asset tracking, e-commerce visual discovery, or intelligent media organization.++++------------------------------## Understand Core Featuresdiff --git a/RELEASE_METADATA b/RELEASE_METADATAindex 0ccdbac..607d6c3 100644--- a/RELEASE_METADATA+++ b/RELEASE_METADATA@@ -1 +1 @@-Source-vmx-api: 03a9ce8fcf3c19a44e4fcfcf35c8b07320682c14+Source-vmx-api: c1099511b66087a5958b2c1a0f814f60271c9c42diff --git a/SOURCE_MANIFEST.sha256 b/SOURCE_MANIFEST.sha256index d2de675..ac0f572 100644--- a/SOURCE_MANIFEST.sha256+++ b/SOURCE_MANIFEST.sha256@@ -2,12 +2,12 @@ e789cd4d1bed8a78ec8014c5c5913e300f81b63ea56a56aacb0dfec3b5e7ce2b ./.flutter-vera3e3ce18f80b46587bcd529d13e456d10d97dd5e4a3f15e8e1a18894961120b1 ./.github/workflows/publish.ymla98f72526420d47e76b9b4e67ac86acd06b7088ad1f4c35617b11b09e59346ea ./.gitleaks.toml5115d06bd9913f466d50fcbf8ad8890372349060c54a4581f3481ea084cfdec6 ./.pubignore-ca4fd9233bc13ac394c3dbce0ebe1da482cd16626f47fa74f47bfcd30fcb2da4 ./CHANGELOG.md+8029fe59e0b97941b26ac39dd9acb3376b5058ff4699d9799231d4f7a7e7a6e2 ./CHANGELOG.md37b7148216ac6090e36adfb699d642b8dd1e1b8ba99870e65e88733947a59fa6 ./LICENSE-90c73fb8304c3ae696ff15b84b38152cbb64d751de44cdf68d20e2119ae99138 ./README.md-ee2a271ee580f6374b6748a33147eb5e09d8ed69bcd98f7f743a3c5fbde810c2 ./RELEASE_METADATA+7f07eec6fd3d2a7c7cbe73c17e04d98b70befe575701f99ae30bb03e2c6527ef ./README.md+5d409c083d816bc9fd6ae4963b93bc814ed3070d4a48754f993bea605dd18401 ./RELEASE_METADATAdef7e4f643adff5b01b877b6a7fa5b2381612b693c0bf06bd232ee0f7197d342 ./analysis_options.yaml-b3b5b1619725c24005b9f9a64879d0039b1dbebc7bcc48e56df67533ae922aed ./build.sh+f4d01b95ad9f06bea1a40188ce640d8a749fb7d006c4c2202f9556dd727fc846 ./build.sh4f18642680fb433554a5523d00bd99e0d650af340bcaebe628f59f63ac84e458 ./dartdoc_options.yaml75461620cf3a062f4dad10e034952b82cca461b483788de1f46c539aca8b0f0f ./doc/manage_api_key.mda66d39da0983a994474fa516f81fd41bbb131efbd69c955891a41781a76daf24 ./doc/performance.md@@ -130,8 +130,8 @@ e3412fd8ee09b9d13a9218d59ef2d91929c4ff6b2c3fc46a1d911c17ae4b03a6 ./example/04_e488ec790f837f9deafc6249027e2f1b210dcacacc56dfc5f37864c76c48a5ef5 ./example/04_example/assets/queries/bird.jpg16b4146e333cea289bfac8c4b3d4cb367ff980ee3a5782d48f50dd9bdc32f716 ./example/04_example/assets/queries/clouds.jpg27f4ad391467d52327d730968980f9d5ae40632b57aed8fe081b28e4814d7cc3 ./example/04_example/assets/queries/sunset.jpg-88d2f2722c79170c0a82c014c8a03b4c5f91b42d667502841bff42b7abf74001 ./example/04_example/integration_test/archive_walkthrough_test.dart-aef381bad558e1d65c4f63bee407454a09f3e6d3e0d106a55a2964016df5ddfe ./example/04_example/integration_test/demo_archive_test.dart+56b1870e7cc7085315e787ca8dfc5903dffad21a95b02ef27689647133467f9d ./example/04_example/integration_test/archive_walkthrough_test.dart+8e1ef0899e265477b88a25e9185bc9aa7d9ee4ddc5384140d508fc58790e38a9 ./example/04_example/integration_test/demo_archive_test.dart10ee8d5e892989850cda64941d48147110aca3962f08506740bfb5b33c62e2ef ./example/04_example/integration_test/demo_pace.dart5b90b9d932fab97831e01bc8fece71baf459278047dc80cb4ff6233c71786737 ./example/04_example/integration_test/demo_traffic_test.dart6af5f903835fc34083898ce980b7ccbe6039dd2822f27f5071d0295b27d8754b ./example/04_example/integration_test/traffic_walkthrough_test.dart@@ -174,13 +174,21 @@ cc03511a8432e3144069a128282deec13ffd4cb4c55637ffef3146a0e58ee5fd ./example/04_e1a8d11d01d1cc92c650c9c9ed35299240052d4683a15a719a2315ef44185e074 ./example/04_example/ios/Runner/Runner-Bridging-Header.hadd68b905971dedfcc0d0b5b7118030de5925ba8c081ad9815463699e3a444ad ./example/04_example/ios/Runner/SceneDelegate.swift5e8f4908dacea6f29b2a790e4d38bf5fded69096063f9a27a2f21584d62b30c0 ./example/04_example/ios/RunnerTests/RunnerTests.swift-ebc175eea95c02f5716689764777087863d5dbfa57c9d09ed0f4eab2f41b4ee2 ./example/04_example/pubspec.lock-59d751f2338082c3da610bb842ebdac1157135b1dfc2776f96a7cc72eb7c8ed2 ./example/04_example/pubspec.yaml+cb0d6fd845a0ffea43094b027b339e777d217524b33ade5c8b21f426477061a6 ./example/04_example/lib/console_view.dart+1c65b37fb7bdb990c4fafd0588b2a35eecf74548fc15ed5d956b648281828eed ./example/04_example/lib/controller.dart+65b413c81e02dbf98dbbc2e262814bb021058e5d9417a01e98cd5593344777a7 ./example/04_example/lib/gallery_view.dart+8f8db49f2507693a5eba9069ff45b0a15e85c734fc1b6012babb7a3957983a70 ./example/04_example/lib/main.dart+16321daa3ad336334a780766b9694ff6320d4a39efc5c76c9ee5d46949ab0f6f ./example/04_example/lib/scene.dart+fb12dfa3d0aefe97df64955243a9a7d126e76e789644ac433dad431e53912ff8 ./example/04_example/lib/settings.dart+cbe9e32f3338270ff53b3a33f84e9b062bcf860a927f4b227afe846df82a4f0b ./example/04_example/lib/theme.dart+9c7fa46ef347188b0b6782d87c8e4d4f15503899b99ad408dc969ce1691ad96a ./example/04_example/lib/widgets.dart+0e7795efff711d84403d1f4c9a9c6584ba96f0b4439aa81b2d44a59641d95f4c ./example/04_example/pubspec.lock+cd5b582104b7f453d7f1e628f633d3f89a199f52cc6cec0b4c083e5526e8a967 ./example/04_example/pubspec.yaml00988c2faa386c1c100b4713c51bb298c06a21d01395760f63ce3f58ebc606cf ./example/04_example/test/widget_test.dartcb335a6997ddec7208a31edea88cbf7df3a5af67d891116a54ff74fab4bf37b4 ./example/04_example/test_driver/integration_test.dart332c6cf3f7ec27c02ef4217bf01cdacf64e20ad49e03c6024f050c4d6558221d ./example/04_example/tool/dev_run.sh09a4d126420e89e9f407c20a064b9ef9a01fbbb82d24d94c23ccb561b1e5cb8a ./example/04_example/tool/shoot.sh-4fe4d0dd60af829afc49ac288faa42998db09ae714b37b78f858b874c8924d05 ./example/readme.md+705b7e4ed181abc90e877b79299888c17d01a11143fd26f372ba3139071ed966 ./example/readme.md23756b83470b1f25f6a7e6b5a6270f123a5224e49fd8e2eda36001358951b688 ./install.sh7becacd31a8d134fa435b39cd819798d5fbf58f89b9f30c50362e2dcf757aaed ./lib/src/adaptive_upload.dart9464fff0c519a1ce70cddefb3e3eaa95d07b97ccdaf5b8381c01d7c88767ae83 ./lib/src/api_key_provider.dart@@ -220,7 +228,7 @@ d132b6dceb89804a47418245845547a25fcf8f89f56b292ee70a404d63364865 ./test/fakes.d14368b598ece0ce9b2e249148a10a92f2c80e38427c077013a1515826f4365bd ./test/fixtures/routes_contract.json593b356ac3431de80e03e7a0e2f1df0d29589140f44746468213c1cac1c35bbe ./test/multipart_upload_test.dart348b9581f6262acaaf96012a3d57685b0b45c3663c1497f14135663de7a60954 ./test/new_api_surface_test.dart-eda872829e80171c14f6439fd2f65c8bbe2d6d7d2013fd83b46e6247619847a1 ./test/regression_manifest_test.dart+a1cc368fa8cb25576cdc6559520a831e47cadcd1455da2bf5b01c3792fd7165b ./test/regression_manifest_test.dart8c87a4645a2e329477d070277f64b617da14ac90163bb734fbb5326c1a97a5c3 ./test/resources_models_test.dart8619ce113bb8669612f9a2a16b1b334ac68435c5972e84828a789511467fcb77 ./test/shell_scripts_test.dartefe4f1158e7d4b9ca8e57f3538ce296279817292a4356c1399cf5f2cbae4c52d ./test/transcode_upload_test.dartdiff --git a/build.sh b/build.shindex ec45b1b..22b7642 100755--- a/build.sh+++ b/build.sh@@ -42,6 +42,7 @@ sdk_pub_get() {(cd example/01_full_app && sdk_flutter pub get)(cd example/02_users && sdk_flutter pub get)(cd example/03_cctv && sdk_flutter pub get)+ (cd example/04_example && sdk_flutter pub get)}sdk_format() {@@ -49,7 +50,7 @@ sdk_format() {## Usage:bash build.sh format'- sdk_dart format --output=none --set-exit-if-changed lib test tool example/01_full_app/lib example/01_full_app/test example/02_users/lib example/02_users/test example/03_cctv/bin example/03_cctv/lib example/03_cctv/test+ sdk_dart format --output=none --set-exit-if-changed lib test tool example/01_full_app/lib example/01_full_app/test example/02_users/lib example/02_users/test example/03_cctv/bin example/03_cctv/lib example/03_cctv/test example/04_example/lib example/04_example/test example/04_example/integration_test}sdk_analyze() {@@ -61,6 +62,7 @@ sdk_analyze() {(cd example/01_full_app && sdk_flutter analyze)(cd example/02_users && sdk_flutter analyze)(cd example/03_cctv && sdk_flutter analyze)+ (cd example/04_example && sdk_flutter analyze)}sdk_test() {@@ -72,6 +74,7 @@ sdk_test() {(cd example/01_full_app && sdk_flutter test)(cd example/02_users && sdk_flutter test)(cd example/03_cctv && sdk_flutter test)+ (cd example/04_example && sdk_flutter test)}sdk_example_android() {@@ -132,6 +135,8 @@ sdk_clean() {sdk_flutter clean(cd example/01_full_app && sdk_flutter clean)(cd example/02_users && sdk_flutter clean)+ (cd example/03_cctv && sdk_flutter clean)+ (cd example/04_example && sdk_flutter clean)}sdk_help() {diff --git a/example/04_example/integration_test/archive_walkthrough_test.dart b/example/04_example/integration_test/archive_walkthrough_test.dartindex 9e0cf00..6013f88 100644--- a/example/04_example/integration_test/archive_walkthrough_test.dart+++ b/example/04_example/integration_test/archive_walkthrough_test.dart@@ -119,7 +119,10 @@ void main() {await wait(tester, 10);await shot(tester, '11_image_search_result');- await view.controller.searchByAsset(view.scene, 'assets/queries/sunset.jpg');+ await view.controller.searchByAsset(+ view.scene,+ 'assets/queries/sunset.jpg',+ );await wait(tester, 10);await shot(tester, '12_image_search_sunset');diff --git a/example/04_example/integration_test/demo_archive_test.dart b/example/04_example/integration_test/demo_archive_test.dartindex 59ae238..87e85fc 100644--- a/example/04_example/integration_test/demo_archive_test.dart+++ b/example/04_example/integration_test/demo_archive_test.dart@@ -61,7 +61,10 @@ void main() {);await tester.enterText(find.byType(TextField).first, '');await pause(tester, 600);- await view.controller.searchByAsset(view.scene, 'assets/queries/sunset.jpg');+ await view.controller.searchByAsset(+ view.scene,+ 'assets/queries/sunset.jpg',+ );await pause(tester, 5000);await scrollDown(tester, 300);await pause(tester, 3000);diff --git a/example/04_example/lib/console_view.dart b/example/04_example/lib/console_view.dartnew file mode 100644index 0000000..7d69845--- /dev/null+++ b/example/04_example/lib/console_view.dart@@ -0,0 +1,350 @@+import 'dart:io';++import 'package:flutter/material.dart';++import 'controller.dart';+import 'scene.dart';+import 'theme.dart';+import 'widgets.dart';++/// Control-room view: dense, monospaced, one frame per row like a log.+class ConsoleView extends StatefulWidget {+ const ConsoleView({required this.controller, required this.scene, super.key});++ final SightlineController controller;+ final Scene scene;++ @override+ State<ConsoleView> createState() => _ConsoleViewState();+}++class _ConsoleViewState extends State<ConsoleView> {+ final TextEditingController _query = TextEditingController();++ Palette get _p => widget.scene.palette;+ SceneState get _state => widget.controller.stateOf(widget.scene);++ @override+ void dispose() {+ _query.dispose();+ super.dispose();+ }++ void _run(String query) {+ _query.text = query;+ widget.controller.search(widget.scene, query);+ }++ @override+ Widget build(BuildContext context) {+ final Palette p = _p;+ final SceneState s = _state;+ final bool searchable = s.stage == FootageStage.ready;+ return ListView(+ padding: const EdgeInsets.fromLTRB(20, 8, 20, 32),+ children: <Widget>[+ Row(+ children: <Widget>[+ Text('SIGHTLINE', style: p.mono(size: 11, spacing: 3)),+ const Spacer(),+ _KeyState(+ controller: widget.controller,+ scene: widget.scene,+ palette: p,+ ),+ const SizedBox(width: 14),+ IconAction(+ icon: Icons.info_outline,+ palette: p,+ tooltip: 'How it works',+ onTap: () => HowItWorks.open(context, widget.scene),+ ),+ ],+ ),+ const SizedBox(height: 28),+ Text(widget.scene.title, style: p.display(size: 32)),+ const SizedBox(height: 10),+ Text(+ widget.scene.strapline,+ style: TextStyle(color: p.inkMuted, fontSize: 14.5, height: 1.45),+ ),+ const SizedBox(height: 26),+ _FootageCard(controller: widget.controller, scene: widget.scene),+ const SizedBox(height: 22),+ TextField(+ controller: _query,+ enabled: searchable,+ style: TextStyle(color: p.ink, fontSize: 15),+ textInputAction: TextInputAction.search,+ decoration: InputDecoration(+ hintText: searchable+ ? widget.scene.searchHint+ : 'Index some footage first',+ prefixIcon: Icon(Icons.search, color: p.inkMuted, size: 20),+ ),+ onSubmitted: (String value) =>+ widget.controller.search(widget.scene, value),+ ),+ const SizedBox(height: 12),+ Wrap(+ spacing: 8,+ runSpacing: 8,+ children: widget.scene.exampleQueries+ .map(+ (String q) => InkWell(+ onTap: searchable ? () => _run(q) : null,+ child: Container(+ padding: const EdgeInsets.symmetric(+ horizontal: 12,+ vertical: 8,+ ),+ decoration: BoxDecoration(+ border: Border.all(color: p.border),+ borderRadius: p.corner,+ ),+ child: Text(+ q,+ style: p.mono(+ size: 12,+ color: searchable ? p.inkMuted : p.border,+ ),+ ),+ ),+ ),+ )+ .toList(),+ ),+ const SizedBox(height: 26),+ if (s.searching)+ ThinProgress(value: 0, palette: p)+ else if (s.searchMessage.isNotEmpty)+ Text(s.searchMessage, style: p.mono(size: 12, color: p.accent))+ else if (s.hasSearched)+ Text(+ '${s.hits.length > shownPerClip ? shownPerClip : s.hits.length}'+ '/${s.hits.length} FRAMES · '+ '${s.elapsedMs.toStringAsFixed(0)} MS',+ style: p.mono(size: 11, spacing: 1.5, color: p.inkMuted),+ ),+ const SizedBox(height: 14),+ for (int i = 0; i < s.hits.length && i < shownPerClip; i++) ...<Widget>[+ _HitRow(hit: s.hits[i], palette: p),+ const SizedBox(height: 10),+ ],+ ],+ );+ }+}++class _HitRow extends StatelessWidget {+ const _HitRow({required this.hit, required this.palette});++ final SearchHit hit;+ final Palette palette;++ @override+ Widget build(BuildContext context) => InkWell(+ onTap: () => FrameDetail.open(context, hit, palette),+ child: Container(+ decoration: BoxDecoration(+ color: palette.surface,+ border: Border.all(color: palette.border),+ borderRadius: palette.corner,+ ),+ clipBehavior: Clip.antiAlias,+ child: Row(+ children: <Widget>[+ SizedBox(+ width: 132,+ height: 76,+ child: FrameImage(hit: hit, palette: palette),+ ),+ const SizedBox(width: 14),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Text(hit.timeLabel, style: palette.mono(size: 17)),+ const SizedBox(height: 5),+ Text(+ hit.fileName,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: palette.mono(size: 11, color: palette.inkMuted),+ ),+ ],+ ),+ ),+ ],+ ),+ ),+ );+}++/// Camera card: what is loaded, and whether it is searchable yet.+class _FootageCard extends StatelessWidget {+ const _FootageCard({required this.controller, required this.scene});++ final SightlineController controller;+ final Scene scene;++ @override+ Widget build(BuildContext context) {+ final Palette p = scene.palette;+ final SceneState s = controller.stateOf(scene);+ return Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: p.surface,+ border: Border.all(color: p.border),+ borderRadius: p.corner,+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ // Nothing about the feed until there is a key to read it with.+ if (controller.isReady(scene)) ...<Widget>[+ Row(+ children: <Widget>[+ Expanded(+ child: Text(+ controller.bundledFootage(scene).isEmpty+ ? 'NO CLIP BUNDLED'+ : controller.bundledFootage(scene).first.label,+ style: p.mono(size: 12, spacing: 1.2),+ ),+ ),+ _StageBadge(stage: s.stage, palette: p),+ ],+ ),+ const SizedBox(height: 8),+ Text(+ 'Collection: ${controller.collectionFor(scene)}',+ style: p.mono(size: 10, color: p.inkMuted),+ ),+ ],+ if (s.message.isNotEmpty) ...<Widget>[+ const SizedBox(height: 12),+ Text(+ s.message,+ style: TextStyle(color: p.inkMuted, fontSize: 13, height: 1.4),+ ),+ ],+ if (s.stage == FootageStage.uploading) ...<Widget>[+ const SizedBox(height: 12),+ ThinProgress(value: s.uploadFraction, palette: p),+ ],+ if (!controller.isReady(scene)) ...<Widget>[+ const SizedBox(height: 16),+ Align(+ alignment: Alignment.centerLeft,+ child: FilledButton(+ onPressed: () => SetupSheet.show(context, controller, scene),+ child: Text(+ controller.isConnected+ ? 'Set the collection'+ : 'Add your key',+ ),+ ),+ ),+ ] else if (s.stage != FootageStage.uploading &&+ s.stage != FootageStage.indexing) ...<Widget>[+ const SizedBox(height: 16),+ Row(+ children: <Widget>[+ if (controller.uploadedClips(scene).isEmpty) ...<Widget>[+ FilledButton(+ onPressed: () => controller.prepare(scene),+ child: const Text('Upload and index'),+ ),+ const SizedBox(width: 8),+ ],+ TextButton(+ onPressed: () async {+ final ({List<File> files, String? error}) picked =+ await pickVideos();+ if (picked.error != null) {+ controller.reportProblem(scene, picked.error!);+ } else if (picked.files.isNotEmpty) {+ await controller.prepare(scene, files: picked.files);+ }+ },+ style: TextButton.styleFrom(foregroundColor: p.accent),+ child: const Text('Choose a video'),+ ),+ ],+ ),+ ],+ ],+ ),+ );+ }+}++class _StageBadge extends StatelessWidget {+ const _StageBadge({required this.stage, required this.palette});++ final FootageStage stage;+ final Palette palette;++ @override+ Widget build(BuildContext context) {+ final (String text, Color color) = switch (stage) {+ FootageStage.idle => ('NOT INDEXED', palette.inkMuted),+ FootageStage.uploading => ('UPLOADING', palette.accent),+ FootageStage.indexing => ('INDEXING', palette.accent),+ FootageStage.ready => ('SEARCHABLE', readyGreen),+ FootageStage.failed => ('FAILED', const Color(0xFFF87171)),+ };+ final bool working =+ stage == FootageStage.uploading || stage == FootageStage.indexing;+ return Row(+ children: <Widget>[+ if (working)+ SizedBox(+ width: 10,+ height: 10,+ child: CircularProgressIndicator(+ strokeWidth: 1.6,+ valueColor: AlwaysStoppedAnimation<Color>(color),+ ),+ )+ else+ Container(+ width: 6,+ height: 6,+ decoration: BoxDecoration(color: color, shape: BoxShape.circle),+ ),+ SizedBox(width: working ? 9 : 7),+ Text(text, style: palette.label(color: color, size: 10)),+ ],+ );+ }+}++class _KeyState extends StatelessWidget {+ const _KeyState({+ required this.controller,+ required this.scene,+ required this.palette,+ });++ final SightlineController controller;+ final Scene scene;+ final Palette palette;++ @override+ Widget build(BuildContext context) => InkWell(+ onTap: () => controller.isConnected+ ? controller.signOut()+ : SetupSheet.show(context, controller, scene),+ child: Text(+ controller.isConnected ? 'KEY ACTIVE' : 'NO KEY',+ style: palette.mono(+ size: 11,+ spacing: 1.5,+ color: controller.isConnected ? readyGreen : palette.accent,+ ),+ ),+ );+}diff --git a/example/04_example/lib/controller.dart b/example/04_example/lib/controller.dartnew file mode 100644index 0000000..1803d4e--- /dev/null+++ b/example/04_example/lib/controller.dart@@ -0,0 +1,839 @@+import 'dart:async';+import 'dart:convert';+import 'dart:io';+import 'dart:ui' as ui;++import 'package:flutter/foundation.dart';+import 'package:flutter/services.dart' show rootBundle;+import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';++import 'scene.dart';+import 'settings.dart';++const String _stream = 'astream';+const String _mode = 'vid_file';+const String _indexType = 'vid_img_emb';++/// How many ranked frames to ask for. Has to be well above the number of+/// frames one clip can contribute, or a collection of several clips gets cut+/// off by this rather than by relevance — 12 made every query return 12.+const int _resultLimit = 50;++/// Frames shown per clip. The heading still reports the true total, so a clip+/// with 39 matching moments says so while showing its best few.+const int shownPerClip = 6;++/// Results are cut two ways, both on the backend's `score`, which is a+/// **distance** — lower is closer. Each scene sets its own numbers, see+/// [Scene.relevanceWindow] and [Scene.relevanceCeiling], because one camera and+/// a whole archive want different answers.+///+/// Neither can be tuned into a presence test. The score does not measure+/// whether the subject is there: `a person` scores 0.875 with dozens of people+/// visible, while `a giraffe` scores 0.877 with none. So the ceiling only+/// rejects the absurd, and an empty result says "nothing close enough" rather+/// than claiming the subject is absent. The SDK's own `textEmbScoreMin` filters+/// nothing at all — 0.9, 0.5 and 0.0 return identical results.++/// Modality the image endpoints expect for video frames.+///+/// The SDK's own Flutter example sends `image` here and resolves nothing; the+/// Android example sends `vid_img`, which is the value that works.+const String _imageModality = 'vid_img';++/// Where a scene's footage has got to.+enum FootageStage { idle, uploading, indexing, ready, failed }++/// One frame the search came back with.+@immutable+class SearchHit {+ const SearchHit({+ required this.fileName,+ required this.stream,+ required this.timestampMs,+ required this.token,+ this.bytes,+ });++ final String fileName;+ final String stream;+ final int timestampMs;++ /// `url_pre_signed`: a gateway token to POST, never a URL to fetch.+ final String token;++ final Uint8List? bytes;++ SearchHit withBytes(Uint8List? value) => SearchHit(+ fileName: fileName,+ stream: stream,+ timestampMs: timestampMs,+ token: token,+ bytes: value,+ );++ /// How far into the clip this frame is. The backend reports frame time as a+ /// millisecond offset from the start, zero-padded to 13 digits.+ String get timeLabel {+ final int total = (timestampMs / 1000).round();+ String two(int v) => v.toString().padLeft(2, '0');+ final int hours = total ~/ 3600;+ final String rest = '${two(total % 3600 ~/ 60)}:${two(total % 60)}';+ return hours > 0 ? '$hours:$rest' : rest;+ }+}++/// Everything one tab needs to know about its own footage and results.+class SceneState {+ FootageStage stage = FootageStage.idle;++ /// Footage progress: uploading, indexing, or what went wrong with it.+ String message = '';++ /// How the last search went, when it found nothing worth showing.+ String searchMessage = '';+ int uploadedBytes = 0;+ int totalBytes = 0;+ String indexStatus = '';+ bool searching = false;+ String query = '';++ /// The picture searched with, when the query was an image rather than words.+ Uint8List? queryImage;++ /// Frames the search returned per clip before the relevance cut, so a result+ /// can say three of twenty-eight rather than just three.+ Map<String, int> framesPerClip = const <String, int>{};+ bool hasSearched = false;+ List<SearchHit> hits = const <SearchHit>[];+ int matchCount = 0;+ double elapsedMs = 0;++ double get uploadFraction =>+ totalBytes <= 0 ? 0 : (uploadedBytes / totalBytes).clamp(0, 1);+}++/// Owns the SDK client and the per-scene state for both tabs.+class SightlineController extends ChangeNotifier {+ VmodalClient? _client;+ MutableApiKeyProvider? _keys;+ bool _connecting = false;+ String? _connectError;+ final Map<String, SceneState> _states = <String, SceneState>{};++ /// Set when a search resolves nothing, so the screen can say why.+ String _diagnostic = '';++ Settings _settings = Settings();++ /// The saved key and collection names, if the user asked to keep them.+ Settings get settings => _settings;++ /// The collection this scene searches: whatever the user typed for it.+ String collectionFor(Scene scene) =>+ _settings.collections[scene.id]?.trim() ?? '';++ /// Whether the scene has both a key and a collection to work with.+ bool isReady(Scene scene) => isConnected && collectionFor(scene).isNotEmpty;++ /// Loads anything saved from a previous run and connects if it can.+ Future<void> restore() async {+ _settings = Settings.load();+ notifyListeners();+ if (_settings.apiKey.isNotEmpty) await connect(_settings.apiKey);+ }++ /// Stores what the user typed in the setup sheet.+ Future<bool> applySetup({+ required Scene scene,+ required String apiKey,+ required String collection,+ required bool remember,+ }) async {+ _settings+ ..apiKey = apiKey.trim()+ ..remember = remember;+ _settings.collections[scene.id] = collection.trim();+ _settings.save();+ return connect(_settings.apiKey);+ }++ /// Drops the saved copy from the device.+ void forgetSaved() {+ _settings+ ..remember = false+ ..forget();+ notifyListeners();+ }++ final Set<String> _bundled = <String>{};+ final Map<String, Set<String>> _uploaded = <String, Set<String>>{};++ /// The clip names the server has actually reported for a scene's collection,+ /// alphabetically. There is no endpoint that lists a collection, so this is+ /// built from names seen in search results plus anything uploaded here.+ List<String> uploadedClips(Scene scene) =>+ (_uploaded[collectionFor(scene)]?.toList() ?? <String>[])..sort();++ /// The clips actually present in this build. A scene can name clips that are+ /// not bundled yet, and the UI must not pretend they exist.+ bool isBundled(FootageClip clip) => _bundled.contains(clip.asset);++ /// Clips from [scene] that this build really carries.+ List<FootageClip> bundledFootage(Scene scene) =>+ scene.footage.where(isBundled).toList();++ bool get isConnected => _client != null;+ bool get isConnecting => _connecting;+ String? get connectError => _connectError;++ SceneState stateOf(Scene scene) =>+ _states.putIfAbsent(scene.id, SceneState.new);++ /// Authenticates by making a call that actually requires the key.+ ///+ /// The key is held in memory by the SDK's own provider and is never written+ /// anywhere by this app.+ Future<bool> connect(String key) async {+ _connecting = true;+ _connectError = null;+ notifyListeners();+ MutableApiKeyProvider? keys;+ VmodalClient? client;+ try {+ keys = MutableApiKeyProvider(key.trim());+ client = VmodalClient(config: SdkConfig(apiKeyProvider: keys));+ final GroupsResponse groups = await client.collections.listGroups(+ mode: _mode,+ );+ _markAlreadyIndexed(groups);+ await _dispose();+ _keys = keys;+ _client = client;+ await _readCollections(client, groups);+ return true;+ } on SdkException catch (error) {+ await client?.close();+ keys?.close();+ _connectError = _readable(error);+ return false;+ } finally {+ _connecting = false;+ notifyListeners();+ }+ }++ /// Asks each collection what it holds. There is no listing endpoint, so this+ /// runs a few unrelated searches over a deep page and keeps every clip name+ /// that comes back. Unrelated queries on purpose: one query only surfaces+ /// what resembles it, and a deep page so nothing is cut off by paging.+ Future<void> _readCollections(+ VmodalClient client,+ GroupsResponse groups,+ ) async {+ for (final Scene scene in scenes) {+ final int? version = groups+ .findGroup(collectionFor(scene), mode: _mode)+ ?.latestLancedbVersion;+ if (version == null) continue;+ final Set<String> found = <String>{};+ for (final String probe in const <String>[+ 'a photo',+ 'an animal',+ 'water',+ 'a street',+ 'food',+ ]) {+ try {+ final SearchResponse response = await client.searches.searchVideo(+ SearchRequest(+ queryText: probe,+ mode: _mode,+ groupName: collectionFor(scene),+ streamName: _stream,+ searchSources: const <String>['image'],+ versionLancedb: version,+ limit: 200,+ ),+ );+ for (final Object? row in response.data) {+ if (row is Map) found.add(_titleOf('${row['title']}'));+ }+ } on SdkException {+ // Try the next probe.+ }+ }+ found.remove('');+ if (found.isNotEmpty) _uploaded[collectionFor(scene)] = found;+ }+ notifyListeners();+ }++ /// The index lives on the server, so footage indexed in an earlier session+ /// is still searchable. Reflect that instead of asking for it again.+ void _markAlreadyIndexed(GroupsResponse groups) {+ for (final Scene scene in scenes) {+ final bool indexed =+ groups+ .findGroup(collectionFor(scene), mode: _mode)+ ?.latestLancedbVersion !=+ null;+ if (!indexed) continue;+ stateOf(scene)+ ..stage = FootageStage.ready+ ..message = '';+ }+ }++ Future<void> signOut() async {+ await _dispose();+ _states.clear();+ notifyListeners();+ }++ /// Copies the bundled clips into the app's Documents folder, which iOS+ /// publishes to the Files app, so they can be picked like any other video.+ /// Anything already there is left alone.+ Future<void> publishBundledFootage() async {+ for (final Scene scene in scenes) {+ for (final FootageClip clip in scene.footage) {+ try {+ await rootBundle.load(clip.asset);+ _bundled.add(clip.asset);+ } on FlutterError {+ // Not in this build.+ }+ }+ }+ notifyListeners();+ if (!Platform.isIOS) return;+ final Directory docs = Directory(+ '${Directory.systemTemp.parent.path}/Documents',+ );+ if (!docs.existsSync()) docs.createSync(recursive: true);+ for (final Scene scene in scenes) {+ for (final FootageClip clip in scene.footage) {+ await _copyToFiles(clip.asset, docs);+ }+ }+ for (final String image in queryImages) {+ await _copyToFiles(image, docs);+ }+ }++ /// Surfaces a problem from outside the controller, so a failure shows on the+ /// card rather than disappearing into the console.+ void reportProblem(Scene scene, String message) {+ stateOf(scene).message = message;+ notifyListeners();+ }++ /// Uploads footage and indexes it for search. Uses [files] when given,+ /// otherwise the clips bundled with the app.+ ///+ /// Footage is added to the collection. Nothing here deletes.+ Future<void> prepare(Scene scene, {List<File>? files}) async {+ final VmodalClient? client = _client;+ if (client == null) return;+ final SceneState state = stateOf(scene);+ state+ ..stage = FootageStage.uploading+ ..message = 'Adding footage'+ ..uploadedBytes = 0+ ..totalBytes = 0+ ..indexStatus = ''+ ..hits = const <SearchHit>[]+ ..hasSearched = false;+ notifyListeners();++ try {+ final List<({File file, String label, bool temporary})> queue =+ <({File file, String label, bool temporary})>[+ if (files != null)+ for (final File chosen in files)+ (+ file: chosen,+ label: chosen.uri.pathSegments.last,+ temporary: false,+ )+ else+ for (final FootageClip clip in scene.footage)+ if (await _materialise(clip.asset) case final File ready)+ (file: ready, label: clip.label, temporary: true),+ ];++ for (final ({File file, String label, bool temporary}) item in queue) {+ final File file = item.file;+ final UploadSource source = UploadSource.fromFile(file);+ final UploadTask<VideoUploadResponse> task = client.collections+ .videoUpload(+ source,+ collectionName: collectionFor(scene),+ subCollectionName: _stream,+ );+ state.totalBytes = source.contentLength;+ final StreamSubscription<UploadProgress> sub = task.progress.listen((+ UploadProgress p,+ ) {+ state+ ..uploadedBytes = p.uploadedBytes+ ..totalBytes = p.totalBytes+ ..message = 'Uploading ${item.label} · ${p.percent}%';+ notifyListeners();+ });+ try {+ await task.result;+ } finally {+ await sub.cancel();+ }+ _uploaded+ .putIfAbsent(collectionFor(scene), () => <String>{})+ .add(_titleOf(file.uri.pathSegments.last));+ if (item.temporary) {+ try {+ await file.parent.delete(recursive: true);+ } on FileSystemException {+ // A leftover temp file is harmless.+ }+ }+ }++ state+ ..stage = FootageStage.indexing+ ..indexStatus = 'queued'+ ..message = 'Indexing footage';+ notifyListeners();++ final IndexationSubmitResponse job = await client.indexes.createIndex(+ IndexationSubmitRequest(+ mode: _mode,+ groupName: collectionFor(scene),+ streamName: _stream,+ indexType: _indexType,+ modality: _indexType,+ reProcess: true,+ ),+ );+ await _awaitIndex(client, state, job.jobId);+ } on SdkException catch (error) {+ state+ ..stage = FootageStage.failed+ ..message = _readable(error);+ notifyListeners();+ }+ }++ Future<void> _awaitIndex(+ VmodalClient client,+ SceneState state,+ String jobId,+ ) async {+ for (int attempt = 0; attempt < 120; attempt++) {+ await Future<void>.delayed(const Duration(seconds: 5));+ final IndexationStatusResponse job = await client.indexes.indexStatus(+ jobId,+ );+ final String status = job.status.trim().toLowerCase();+ state+ ..indexStatus = status.isEmpty ? 'unknown' : status+ ..message = 'Indexing footage · $status';+ notifyListeners();+ if (_indexDone(status)) {+ state+ ..stage = FootageStage.ready+ ..message = 'Footage indexed and searchable';+ notifyListeners();+ return;+ }+ if (status == 'failed' || status == 'error') {+ state+ ..stage = FootageStage.failed+ ..message = 'Indexing failed';+ notifyListeners();+ return;+ }+ }+ state+ ..stage = FootageStage.failed+ ..message = 'Indexing did not finish in time';+ notifyListeners();+ }++ /// Searches with one of the pictures bundled in the app.+ Future<void> searchByAsset(Scene scene, String asset) async {+ final File? file = await _materialise(asset);+ if (file != null) await searchByImage(scene, file);+ }++ /// Searches with a picture instead of words. The SDK exposes this through+ /// `image_query`, which takes base64 image bytes — undocumented, and its own+ /// example never uses it.+ Future<void> searchByImage(Scene scene, File image) async {+ final VmodalClient? client = _client;+ if (client == null) return;+ final SceneState state = stateOf(scene);+ state+ ..searching = true+ ..query = ''+ ..hasSearched = true+ ..hits = const <SearchHit>[]+ ..matchCount = 0+ ..searchMessage = '';+ notifyListeners();++ try {+ final ({String base64, Uint8List preview}) prepared = await _encodeQuery(+ image,+ );+ state.queryImage = prepared.preview;+ await _runSearch(client, scene, state, imageQuery: prepared.base64);+ } on SdkException catch (error) {+ state+ ..searching = false+ ..searchMessage = _readable(error);+ notifyListeners();+ } on Object catch (error) {+ state+ ..searching = false+ ..searchMessage = 'Could not read that picture: $error';+ notifyListeners();+ }+ }++ /// Shrinks the picture before sending it, since a phone photo would be+ /// megabytes of base64.+ Future<({String base64, Uint8List preview})> _encodeQuery(File image) async {+ final Uint8List raw = await image.readAsBytes();+ final ui.Codec codec = await ui.instantiateImageCodec(+ raw,+ targetWidth: 512,+ );+ final ui.FrameInfo frame = await codec.getNextFrame();+ final ByteData? png = await frame.image.toByteData(+ format: ui.ImageByteFormat.png,+ );+ frame.image.dispose();+ codec.dispose();+ final Uint8List bytes = png == null+ ? raw+ : png.buffer.asUint8List(png.offsetInBytes, png.lengthInBytes);+ return (base64: base64Encode(bytes), preview: bytes);+ }++ /// Runs one search and resolves a thumbnail for every hit.+ Future<void> search(Scene scene, String query) async {+ final VmodalClient? client = _client;+ final String clean = query.trim();+ if (client == null || clean.isEmpty) return;+ final SceneState state = stateOf(scene);+ state+ ..searching = true+ ..query = clean+ ..queryImage = null+ ..hasSearched = true+ ..hits = const <SearchHit>[]+ ..matchCount = 0+ ..searchMessage = '';+ notifyListeners();++ try {+ await _runSearch(client, scene, state, queryText: clean);+ } on SdkException catch (error) {+ state+ ..searching = false+ ..searchMessage = _readable(error);+ notifyListeners();+ }+ }++ /// The one request path shared by text and image search.+ Future<void> _runSearch(+ VmodalClient client,+ Scene scene,+ SceneState state, {+ String queryText = '',+ String? imageQuery,+ }) async {+ // Search needs the collection's advertised index version, and only the+ // group listing carries it.+ final GroupsResponse groups = await client.collections.listGroups(+ mode: _mode,+ );+ final int? version = groups+ .findGroup(collectionFor(scene), mode: _mode)+ ?.latestLancedbVersion;+ if (version == null) {+ state+ ..searching = false+ ..searchMessage = 'This collection has no finished index yet.';+ notifyListeners();+ return;+ }++ final SearchResponse response = await client.searches.searchVideo(+ SearchRequest(+ queryText: queryText,+ imageQuery: imageQuery,+ mode: _mode,+ groupName: collectionFor(scene),+ streamName: _stream,+ searchSources: const <String>['image'],+ versionLancedb: version,+ limit: _resultLimit,+ ),+ );++ _diagnostic = '';+ final List<SearchHit> hits = await _resolveHits(client, scene, response);+ state+ ..hits = hits+ ..matchCount = response.cntTotal+ ..elapsedMs = response.executionTimeMs+ ..searching = false+ ..searchMessage = hits.isEmpty ? _diagnostic : '';+ notifyListeners();+ }++ /// Turns raw search rows into frames with pixels.+ Future<List<SearchHit>> _resolveHits(+ VmodalClient client,+ Scene scene,+ SearchResponse response,+ ) async {+ final List<Map<String, Object?>> rows = response.data+ .whereType<Map<Object?, Object?>>()+ .map(+ (Map<Object?, Object?> row) => row.map(+ (Object? k, Object? v) => MapEntry<String, Object?>('$k', v),+ ),+ )+ .toList();++ final Map<String, int> perClip = <String, int>{};+ for (final Map<String, Object?> row in rows) {+ final String name = _fileName(row);+ if (name.isNotEmpty) {+ perClip[name] = (perClip[name] ?? 0) + 1;+ }+ }+ stateOf(scene).framesPerClip = perClip;++ // Ranked already, but the list always runs to the limit, so drop the tail+ // that trails away from this query's best frame.+ final double? best = rows+ .map((Map<String, Object?> row) => row['score'])+ .whereType<num>()+ .where((num s) => s.isFinite)+ .fold<double?>(+ null,+ (double? lowest, num s) =>+ lowest == null || s < lowest ? s.toDouble() : lowest,+ );+ if (best != null) {+ final double cut = (best + scene.relevanceWindow).clamp(+ 0,+ scene.relevanceCeiling,+ );+ rows.retainWhere((Map<String, Object?> row) {+ final Object? score = row['score'];+ return score is num && score.isFinite && score <= cut;+ });+ }++ final List<Map<String, Object?>> records = <Map<String, Object?>>[];+ final List<SearchHit> pending = <SearchHit>[];+ final List<String> dropped = <String>[];+ for (final Map<String, Object?> row in rows) {+ final String name = _fileName(row);+ if (name.isEmpty) {+ dropped.add(row.keys.join(','));+ continue;+ }+ final String stream = _firstText(row, const <String>[+ 'stream',+ 'stream_name',+ ]);+ final String ts = _timestamp13(row);+ records.add(<String, Object?>{+ 'mode': _mode,+ 'group_name': collectionFor(scene),+ 'modality': _imageModality,+ 'stream_name': stream.isEmpty ? _stream : stream,+ 'filename': name,+ // Required for video modes even when the frame time is all zeros.+ 'ts_unix_13digits': ts,+ });+ pending.add(+ SearchHit(+ fileName: name,+ stream: stream.isEmpty ? _stream : stream,+ timestampMs: int.tryParse(ts) ?? 0,+ token: '',+ ),+ );+ }+ if (records.isEmpty) {+ _diagnostic = dropped.isEmpty+ ? 'Nothing close enough in this footage.'+ : 'Rows came back with no filename. Fields present: '+ '${dropped.first}';+ return const <SearchHit>[];+ }++ final ImageUrlBulkResponse urls = await client.images.getUrlBulk(records);+ final List<SearchHit> resolved = <SearchHit>[];+ for (int i = 0; i < pending.length; i++) {+ final String token = i < urls.records.length+ ? '${urls.records[i]['url_pre_signed'] ?? ''}'+ : '';+ if (token.isEmpty) {+ _diagnostic =+ 'Rows parsed, but the image endpoint returned no token. '+ 'Raw reply: ${urls.records.isEmpty ? '(empty)' : urls.records.first}';+ continue;+ }+ resolved.add(+ SearchHit(+ fileName: pending[i].fileName,+ stream: pending[i].stream,+ timestampMs: pending[i].timestampMs,+ token: token,+ ),+ );+ }++ // `url_pre_signed` is a token to POST, not a URL to GET, so the bytes have+ // to come back through the authenticated client.+ return Future.wait(+ resolved.map((SearchHit hit) async {+ try {+ return hit.withBytes(await client.images.getImageFromUrl(hit.token));+ } on SdkException {+ return hit;+ }+ }),+ );+ }++ Future<void> _copyToFiles(String asset, Directory docs) async {+ final File target = File('${docs.path}/${asset.split('/').last}');+ if (target.existsSync()) return;+ final File? source = await _materialise(asset);+ if (source != null) await source.copy(target.path);+ }++ /// Copies a bundled asset to a real file, which is what an upload needs.+ /// Returns null when the clip is not bundled, so an archive can be filled in+ /// one clip at a time.+ Future<File?> _materialise(String asset) async {+ final ByteData data;+ try {+ data = await rootBundle.load(asset);+ } on FlutterError {+ return null;+ }+ final Directory dir = await Directory.systemTemp.createTemp('sightline');+ final File file = File('${dir.path}/${asset.split('/').last}');+ await file.writeAsBytes(data.buffer.asUint8List(), flush: true);+ return file;+ }++ Future<void> _dispose() async {+ await _client?.close();+ _keys?.close();+ _client = null;+ _keys = null;+ }++ @override+ void dispose() {+ _dispose();+ super.dispose();+ }+}++/// Clip names come back without their extension.+String _titleOf(String fileName) =>+ fileName.contains('.') ? fileName.split('.').first : fileName;++bool _indexDone(String status) => const <String>{+ 'success',+ 'succeeded',+ 'done',+ 'completed',+ 'ok',+}.contains(status);++String _firstText(Map<String, Object?> row, List<String> keys) {+ for (final String key in keys) {+ final String value = '${row[key] ?? ''}'.trim();+ if (value.isNotEmpty) return value;+ }+ return '';+}++/// Filename for the frame. Video rows carry no `filename` at all, so this+/// falls back to `title`, and then to a name rebuilt from `item_id`.+///+/// All three are needed. Some uploads come back with an empty `title` too, and+/// then `item_id` is the only thing left — a clip uploaded from the device did+/// exactly that, ranked top for every query, and every one of its rows was+/// being thrown away. `item_id` reads `astream-dog_playing_01-0000000004838`,+/// so stripping the stream prefix and the timestamp gives the name the image+/// endpoint wants.+String _fileName(Map<String, Object?> row) {+ String raw = _firstText(row, const <String>[+ 'filename',+ 'filename_sanitized',+ 'video_filename',+ 'source_filename',+ 'source_path',+ 'path',+ ]);+ raw = raw.isEmpty ? _firstText(row, const <String>['title']) : raw;+ if (raw.isEmpty) raw = _nameFromItemId(row);+ return raw.replaceAll(r'\', '/').split('/').last.trim();+}++String _nameFromItemId(Map<String, Object?> row) {+ final String itemId = _firstText(row, const <String>['item_id']);+ if (itemId.isEmpty) return '';+ final String stream = _firstText(row, const <String>[+ 'stream',+ 'stream_name',+ ]);+ final String ts = _firstText(row, const <String>[+ 'ts_unix_13digits',+ 'ts_unix',+ ]);+ String name = itemId;+ if (stream.isNotEmpty && name.startsWith('$stream-')) {+ name = name.substring(stream.length + 1);+ }+ if (ts.isNotEmpty && name.endsWith('-$ts')) {+ name = name.substring(0, name.length - ts.length - 1);+ }+ return name;+}++/// Frame time as the 13-digit string the image endpoints expect.+String _timestamp13(Map<String, Object?> row) {+ final String digits = _firstText(row, const <String>[+ 'ts_unix_13digits',+ 'ts_unix',+ 'timestamp_ms',+ 'timestamp',+ ]).replaceAll(RegExp(r'[^0-9]'), '');+ if (digits.isEmpty) return '0000000000000';+ if (digits.length >= 13) return digits.substring(0, 13);+ if (digits.length == 10) return '${digits}000';+ return digits.padLeft(13, '0');+}++String _readable(SdkException error) {+ if (error is AuthException) return 'That key was not accepted.';+ if (error is ApiException) {+ return 'Server said ${error.statusCode}. Try again in a moment.';+ }+ return 'Something went wrong talking to VModal.';+}diff --git a/example/04_example/lib/gallery_view.dart b/example/04_example/lib/gallery_view.dartnew file mode 100644index 0000000..2f2da8f--- /dev/null+++ b/example/04_example/lib/gallery_view.dart@@ -0,0 +1,572 @@+import 'dart:io';++import 'package:flutter/material.dart';++import 'controller.dart';+import 'scene.dart';+import 'theme.dart';+import 'widgets.dart';++/// Gallery view: pale ground, serif headings, results as a grid of frames.+class GalleryView extends StatefulWidget {+ const GalleryView({required this.controller, required this.scene, super.key});++ final SightlineController controller;+ final Scene scene;++ @override+ State<GalleryView> createState() => _GalleryViewState();+}++class _GalleryViewState extends State<GalleryView> {+ final TextEditingController _query = TextEditingController();++ Palette get _p => widget.scene.palette;+ SceneState get _state => widget.controller.stateOf(widget.scene);++ @override+ void dispose() {+ _query.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final Palette p = _p;+ final SceneState s = _state;+ final bool searchable = s.stage == FootageStage.ready;+ return ListView(+ padding: const EdgeInsets.fromLTRB(22, 12, 22, 36),+ children: <Widget>[+ Row(+ children: <Widget>[+ Text('SIGHTLINE ARCHIVE', style: p.label()),+ const Spacer(),+ _KeyState(+ controller: widget.controller,+ scene: widget.scene,+ palette: p,+ ),+ const SizedBox(width: 14),+ IconAction(+ icon: Icons.info_outline,+ palette: p,+ tooltip: 'How it works',+ onTap: () => HowItWorks.open(context, widget.scene),+ ),+ ],+ ),+ const SizedBox(height: 22),+ Text(widget.scene.title, style: p.display(size: 31)),+ const SizedBox(height: 14),+ Text(+ widget.scene.strapline,+ style: TextStyle(color: p.inkMuted, fontSize: 16, height: 1.5),+ ),+ const SizedBox(height: 26),+ _ReelRow(+ controller: widget.controller,+ scene: widget.scene,+ collapsed: s.hasSearched,+ ),+ const SizedBox(height: 26),+ _SearchBar(+ controller: _query,+ palette: p,+ enabled: searchable,+ hint: searchable+ ? widget.scene.searchHint+ : 'Index some footage first',+ onSubmit: (String value) =>+ widget.controller.search(widget.scene, value),+ ),+ const SizedBox(height: 14),+ Align(+ alignment: Alignment.centerLeft,+ child: OutlinedButton.icon(+ onPressed: searchable+ ? () async {+ final ({File? file, String? error}) picked =+ await pickImage();+ if (picked.error != null) {+ widget.controller.reportProblem(+ widget.scene,+ picked.error!,+ );+ } else if (picked.file != null) {+ _query.clear();+ await widget.controller.searchByImage(+ widget.scene,+ picked.file!,+ );+ }+ }+ : null,+ icon: const Icon(Icons.image_search_outlined, size: 18),+ label: const Text('Search by image'),+ style: OutlinedButton.styleFrom(+ foregroundColor: p.accent,+ side: BorderSide(color: p.border),+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ shape: RoundedRectangleBorder(borderRadius: p.corner),+ ),+ ),+ ),+ const SizedBox(height: 30),+ if (s.searching)+ ThinProgress(value: 0, palette: p)+ else if (s.searchMessage.isNotEmpty)+ Text(+ s.searchMessage,+ style: TextStyle(color: p.accent, fontSize: 13.5),+ )+ else if (s.hasSearched)+ Row(+ children: <Widget>[+ if (s.queryImage != null) ...<Widget>[+ ClipRRect(+ borderRadius: BorderRadius.circular(8),+ child: Image.memory(+ s.queryImage!,+ width: 46,+ height: 46,+ fit: BoxFit.cover,+ ),+ ),+ const SizedBox(width: 12),+ ],+ Text('${_byClip(s.hits).length}', style: p.display(size: 22)),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ s.queryImage != null+ ? (_byClip(s.hits).length == 1+ ? 'clip matches this picture'+ : 'clips match this picture')+ : (_byClip(s.hits).length == 1+ ? 'clip has "${s.query}"'+ : 'clips have "${s.query}"'),+ style: TextStyle(color: p.inkMuted, fontSize: 14),+ ),+ ),+ Text(+ '${s.elapsedMs.toStringAsFixed(0)} ms',+ style: p.mono(size: 11, color: p.inkMuted),+ ),+ ],+ ),+ const SizedBox(height: 18),+ for (final (String clip, List<SearchHit> hits) in _byClip(s.hits))+ _ClipStrip(+ title: clipNameFor(widget.scene, clip),+ hits: hits,+ palette: p,+ matched: s.framesPerClip[clip] ?? hits.length,+ ),+ ],+ );+ }+}++/// Whether a key is loaded, and a way to enter or drop one.+class _KeyState extends StatelessWidget {+ const _KeyState({+ required this.controller,+ required this.scene,+ required this.palette,+ });++ final SightlineController controller;+ final Scene scene;+ final Palette palette;++ @override+ Widget build(BuildContext context) => InkWell(+ onTap: () => controller.isConnected+ ? controller.signOut()+ : SetupSheet.show(context, controller, scene),+ child: Text(+ controller.isConnected ? 'Key active' : 'No key',+ style: TextStyle(+ color: controller.isConnected ? readyGreen : palette.accent,+ fontSize: 12.5,+ fontWeight: FontWeight.w600,+ ),+ ),+ );+}++/// A clip's friendly name where the app happens to bundle it, otherwise the+/// name the server gave.+String clipNameFor(Scene scene, String title) =>+ scene.footage+ .where((FootageClip c) => c.fileName.startsWith('$title.'))+ .map((FootageClip c) => c.label)+ .firstOrNull ??+ title;++/// One video's matches: a title line, then a row of frames that scrolls+/// sideways. Sideways so several videos fit on screen at once, which is the+/// whole point of this tab.+class _ClipStrip extends StatelessWidget {+ const _ClipStrip({+ required this.title,+ required this.hits,+ required this.palette,+ required this.matched,+ });++ final String title;+ final List<SearchHit> hits;+ final Palette palette;++ /// Frames this clip returned before the relevance cut.+ final int matched;++ @override+ Widget build(BuildContext context) => Padding(+ padding: const EdgeInsets.only(bottom: 22),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Row(+ children: <Widget>[+ Expanded(+ child: Text(+ title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: palette.display(size: 17),+ ),+ ),+ Text(+ '${hits.length}/$matched frames',+ style: palette.mono(size: 11, color: palette.inkMuted),+ ),+ ],+ ),+ const SizedBox(height: 10),+ SizedBox(+ height: 92,+ child: ListView.separated(+ scrollDirection: Axis.horizontal,+ padding: EdgeInsets.zero,+ itemCount: hits.length,+ separatorBuilder: (BuildContext _, int _) =>+ const SizedBox(width: 10),+ itemBuilder: (BuildContext context, int i) =>+ _FrameTile(hit: hits[i], palette: palette),+ ),+ ),+ ],+ ),+ );+}++/// One frame in a strip, with the time it was captured sitting on it.+class _FrameTile extends StatelessWidget {+ const _FrameTile({required this.hit, required this.palette});++ final SearchHit hit;+ final Palette palette;++ @override+ Widget build(BuildContext context) => GestureDetector(+ onTap: () => FrameDetail.open(context, hit, palette),+ child: ClipRRect(+ borderRadius: BorderRadius.circular(10),+ // Two and a half across, so it is obvious the row keeps going.+ child: SizedBox(+ width: 136,+ child: Stack(+ fit: StackFit.expand,+ children: <Widget>[+ FrameImage(hit: hit, palette: palette),+ Positioned(+ left: 0,+ right: 0,+ bottom: 0,+ child: Container(+ padding: const EdgeInsets.fromLTRB(8, 12, 8, 6),+ decoration: const BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ colors: <Color>[Color(0x00000000), Color(0xCC000000)],+ ),+ ),+ child: Text(+ hit.timeLabel,+ style: palette.mono(size: 12, color: Colors.white),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+}++/// Groups hits by the clip they came from, keeping the clips in the order+/// their best frame was ranked. That ordering is the point of this demo: the+/// clip most likely to hold the shot comes first.+List<(String, List<SearchHit>)> _byClip(List<SearchHit> hits) {+ final Map<String, List<SearchHit>> grouped = <String, List<SearchHit>>{};+ for (final SearchHit hit in hits) {+ grouped.putIfAbsent(hit.fileName, () => <SearchHit>[]).add(hit);+ }+ return grouped.entries+ .map((MapEntry<String, List<SearchHit>> e) => (e.key, e.value))+ .toList();+}++class _SearchBar extends StatelessWidget {+ const _SearchBar({+ required this.controller,+ required this.palette,+ required this.hint,+ required this.enabled,+ required this.onSubmit,+ });++ final TextEditingController controller;+ final Palette palette;+ final String hint;+ final bool enabled;+ final ValueChanged<String> onSubmit;++ @override+ Widget build(BuildContext context) => Container(+ decoration: BoxDecoration(+ color: palette.surface,+ borderRadius: BorderRadius.circular(999),+ border: Border.all(color: palette.border),+ ),+ padding: const EdgeInsets.only(left: 20, right: 6),+ child: Row(+ children: <Widget>[+ Expanded(+ child: TextField(+ controller: controller,+ enabled: enabled,+ textInputAction: TextInputAction.search,+ style: TextStyle(color: palette.ink, fontSize: 16),+ decoration: InputDecoration(+ hintText: hint,+ filled: false,+ border: InputBorder.none,+ enabledBorder: InputBorder.none,+ focusedBorder: InputBorder.none,+ contentPadding: const EdgeInsets.symmetric(vertical: 18),+ ),+ onSubmitted: onSubmit,+ ),+ ),+ Padding(+ padding: const EdgeInsets.symmetric(vertical: 6),+ child: Material(+ color: enabled ? palette.accent : palette.border,+ shape: const CircleBorder(),+ child: InkWell(+ customBorder: const CircleBorder(),+ onTap: enabled ? () => onSubmit(controller.text) : null,+ child: Padding(+ padding: const EdgeInsets.all(12),+ child: Icon(+ Icons.arrow_forward,+ color: palette.onAccent,+ size: 20,+ ),+ ),+ ),+ ),+ ),+ ],+ ),+ );+}++class _ReelRow extends StatelessWidget {+ const _ReelRow({+ required this.controller,+ required this.scene,+ this.collapsed = false,+ });++ final SightlineController controller;+ final Scene scene;++ /// After a search the results matter more than the inventory, so the card+ /// shrinks to a line rather than pushing them off the screen.+ final bool collapsed;++ @override+ Widget build(BuildContext context) {+ final Palette p = scene.palette;+ final SceneState s = controller.stateOf(scene);+ final bool ready = s.stage == FootageStage.ready;+ final List<String> uploaded = controller.uploadedClips(scene);+ if (collapsed && uploaded.isNotEmpty) {+ return Row(+ children: <Widget>[+ Icon(Icons.check_circle, size: 15, color: readyGreen),+ const SizedBox(width: 8),+ Text(+ '${uploaded.length} videos uploaded',+ style: TextStyle(+ color: p.ink,+ fontSize: 13,+ fontWeight: FontWeight.w600,+ ),+ ),+ const SizedBox(width: 10),+ Expanded(+ child: Text(+ controller.collectionFor(scene),+ style: p.mono(size: 10, color: p.inkMuted),+ ),+ ),+ ],+ );+ }++ return Container(+ padding: const EdgeInsets.all(18),+ decoration: BoxDecoration(+ color: p.surface,+ borderRadius: p.corner,+ border: Border.all(color: p.border),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Row(+ children: <Widget>[+ Text(+ uploaded.isEmpty+ ? 'NOTHING UPLOADED'+ : '${uploaded.length} '+ '${uploaded.length == 1 ? "VIDEO" : "VIDEOS"} '+ 'UPLOADED',+ style: p.label(),+ ),+ const Spacer(),+ if (s.stage == FootageStage.uploading ||+ s.stage == FootageStage.indexing) ...<Widget>[+ SizedBox(+ width: 11,+ height: 11,+ child: CircularProgressIndicator(+ strokeWidth: 1.8,+ valueColor: AlwaysStoppedAnimation<Color>(p.accent),+ ),+ ),+ const SizedBox(width: 9),+ ],+ Text(+ switch (s.stage) {+ FootageStage.uploading => 'Uploading',+ FootageStage.indexing => 'Indexing',+ FootageStage.ready => 'Indexed',+ FootageStage.failed => 'Failed',+ FootageStage.idle => 'Not indexed',+ },+ style: TextStyle(+ color: ready ? readyGreen : p.inkMuted,+ fontSize: 12,+ fontWeight: FontWeight.w600,+ ),+ ),+ ],+ ),+ const SizedBox(height: 14),+ if (uploaded.isEmpty)+ Text(+ 'Nothing uploaded yet.',+ style: TextStyle(color: p.inkMuted, fontSize: 13),+ )+ else+ Column(+ children: <Widget>[+ for (final String title in uploaded)+ Padding(+ padding: const EdgeInsets.only(bottom: 10),+ child: Row(+ children: <Widget>[+ Icon(Icons.check_circle, size: 16, color: readyGreen),+ const SizedBox(width: 10),+ Expanded(+ child: Text(+ clipNameFor(scene, title),+ style: TextStyle(color: p.ink, fontSize: 14),+ ),+ ),+ Text(title, style: p.mono(size: 10, color: p.inkMuted)),+ ],+ ),+ ),+ ],+ ),+ const SizedBox(height: 8),+ Text(+ 'Collection: ${controller.collectionFor(scene)}',+ style: p.mono(size: 10, color: p.inkMuted),+ ),+ if (s.message.isNotEmpty) ...<Widget>[+ const SizedBox(height: 10),+ Text(+ s.message,+ style: TextStyle(color: p.inkMuted, fontSize: 13, height: 1.4),+ ),+ ],+ if (s.stage == FootageStage.uploading) ...<Widget>[+ const SizedBox(height: 12),+ ThinProgress(value: s.uploadFraction, palette: p),+ ],+ if (!controller.isReady(scene)) ...<Widget>[+ const SizedBox(height: 16),+ Align(+ alignment: Alignment.centerLeft,+ child: FilledButton(+ onPressed: () => SetupSheet.show(context, controller, scene),+ child: Text(+ controller.isConnected+ ? 'Set the collection'+ : 'Add your key',+ ),+ ),+ ),+ ] else if (s.stage != FootageStage.uploading &&+ s.stage != FootageStage.indexing) ...<Widget>[+ const SizedBox(height: 16),+ Row(+ children: <Widget>[+ if (uploaded.isEmpty) ...<Widget>[+ FilledButton(+ onPressed: () => controller.prepare(scene),+ child: const Text('Upload and index'),+ ),+ const SizedBox(width: 8),+ ],+ TextButton(+ onPressed: () async {+ final ({List<File> files, String? error}) picked =+ await pickVideos();+ if (picked.error != null) {+ controller.reportProblem(scene, picked.error!);+ } else if (picked.files.isNotEmpty) {+ await controller.prepare(scene, files: picked.files);+ }+ },+ style: TextButton.styleFrom(foregroundColor: p.accent),+ child: const Text('Choose a video'),+ ),+ ],+ ),+ ],+ ],+ ),+ );+ }+}diff --git a/example/04_example/lib/main.dart b/example/04_example/lib/main.dartnew file mode 100644index 0000000..e430577--- /dev/null+++ b/example/04_example/lib/main.dart@@ -0,0 +1,129 @@+import 'package:flutter/material.dart';++import 'controller.dart';+import 'console_view.dart';+import 'gallery_view.dart';+import 'scene.dart';+import 'theme.dart';++void main() => runApp(const SightlineApp());++/// Two demos of the same VModal search flow, sharing one client and one+/// codebase but deliberately nothing else.+class SightlineApp extends StatefulWidget {+ const SightlineApp({super.key});++ @override+ State<SightlineApp> createState() => _SightlineAppState();+}++class _SightlineAppState extends State<SightlineApp> {+ final SightlineController _controller = SightlineController();+ int _index = 0;++ @override+ void initState() {+ super.initState();+ _controller.publishBundledFootage();+ _controller.restore();+ }++ @override+ void dispose() {+ _controller.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => ListenableBuilder(+ listenable: _controller,+ builder: (BuildContext context, Widget? _) {+ final Scene scene = scenes[_index];+ final Palette p = scene.palette;+ return MaterialApp(+ title: 'Sightline',+ debugShowCheckedModeBanner: false,+ theme: p.theme,+ home: Scaffold(+ body: SafeArea(+ bottom: false,+ child: IndexedStack(+ sizing: StackFit.expand,+ index: _index,+ children: <Widget>[+ ConsoleView(controller: _controller, scene: trafficScene),+ GalleryView(controller: _controller, scene: archiveScene),+ ],+ ),+ ),+ bottomNavigationBar: _TabBar(+ palette: p,+ index: _index,+ onChanged: (int value) => setState(() => _index = value),+ ),+ ),+ );+ },+ );+}++/// Tab bar that takes on the look of whichever demo is showing.+class _TabBar extends StatelessWidget {+ const _TabBar({+ required this.palette,+ required this.index,+ required this.onChanged,+ });++ final Palette palette;+ final int index;+ final ValueChanged<int> onChanged;++ @override+ Widget build(BuildContext context) => Container(+ decoration: BoxDecoration(+ color: palette.surface,+ border: Border(top: BorderSide(color: palette.border)),+ ),+ child: SafeArea(+ top: false,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),+ child: Row(+ children: <Widget>[+ for (int i = 0; i < scenes.length; i++)+ Expanded(+ child: InkWell(+ onTap: () => onChanged(i),+ borderRadius: palette.corner,+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 8),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: <Widget>[+ Icon(+ scenes[i].tabIcon,+ size: 21,+ color: i == index ? palette.accent : palette.inkMuted,+ ),+ const SizedBox(height: 5),+ Text(+ scenes[i].tabLabel,+ style: palette.label(+ color: i == index+ ? palette.accent+ : palette.inkMuted,+ size: 10,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+}diff --git a/example/04_example/lib/scene.dart b/example/04_example/lib/scene.dartnew file mode 100644index 0000000..501ca94--- /dev/null+++ b/example/04_example/lib/scene.dart@@ -0,0 +1,183 @@+import 'package:flutter/material.dart';++import 'theme.dart';++/// One bundled clip, with the attribution it must carry.+@immutable+class FootageClip {+ const FootageClip({+ required this.asset,+ required this.label,+ required this.credit,+ });++ final String asset;++ /// Shown in the UI, e.g. a camera name or a clip title.+ final String label;++ /// Source and licence. Every clip in this app is CC0 stock.+ final String credit;++ String get fileName => asset.split('/').last;+}++/// A complete demo: the story, the footage, the queries and the look.+@immutable+class Scene {+ const Scene({+ required this.id,+ required this.tabLabel,+ required this.tabIcon,+ required this.title,+ required this.strapline,+ required this.sourceLabel,+ required this.suggestedCollection,+ required this.footage,+ this.exampleQueries = const <String>[],+ required this.searchHint,+ this.relevanceWindow = 0.03,+ this.relevanceCeiling = 0.87,+ required this.explainer,+ required this.steps,+ required this.palette,+ });++ final String id;+ final String tabLabel;+ final IconData tabIcon;+ final String title;+ final String strapline;++ /// Label above the footage card: the camera, or the reel.+ final String sourceLabel;++ /// Suggested collection name, offered in the setup sheet. The one actually+ /// used is whatever the user types, since a collection belongs to their key.+ final String suggestedCollection;++ final List<FootageClip> footage;++ /// Tappable queries, where the demo benefits from suggesting a few. Each one+ /// must have an obvious hit in the bundled clips, or the demo undersells the+ /// SDK. Leave empty for a scene that reads better without them.+ final List<String> exampleQueries;++ final String searchHint;++ /// How far past the best frame's distance to keep others. Tight suits one+ /// camera, where the number of moments should mean something. Loose suits an+ /// archive, where the question is which clips hold the shot at all and+ /// cutting to the single best clip answers the wrong question.+ final double relevanceWindow;++ /// Absolute distance past which nothing is shown, whatever the best match+ /// was. Stops an absurd query returning a confident-looking page.+ final double relevanceCeiling;++ /// What this demo is for, in two sentences. Shown in the info panel so a+ /// screenshot of it explains the tab on its own.+ final String explainer;++ /// Three short steps shown before the first search, so the empty screen+ /// explains the demo instead of looking unfinished.+ final List<String> steps;++ final Palette palette;+}++/// Traffic camera: an hour of junction footage, find the moment that matters.+const Scene trafficScene = Scene(+ id: 'traffic',+ tabLabel: 'Traffic',+ tabIcon: Icons.videocam_outlined,+ title: 'Traffic camera',+ strapline: 'Describe the moment. Go straight to the frame.',+ sourceLabel: 'Camera feed',+ suggestedCollection: 'traffic_camera',+ footage: <FootageClip>[+ FootageClip(+ asset: 'assets/footage/traffic_01.mp4',+ label: 'CAM 04 — CITY JUNCTION',+ credit: 'Pexels video 15643210, free to use — see README',+ ),+ ],+ // Verified against the bundled clip: each of these returns frames that+ // visibly contain what was asked for. Short object nouns do not work well —+ // describe the moment, not the object.+ exampleQueries: <String>[+ 'pedestrians on a zebra crossing',+ 'a bus waiting at the junction',+ 'a taxi',+ ],+ searchHint: 'Describe what you are looking for',+ explainer: 'One camera. Hours of footage. Find the moment.',+ steps: <String>['Upload a clip', 'Describe the moment', 'Open the frame'],+ palette: consolePalette,+);++/// Archive: many clips, and no idea which one holds the shot you want.+const Scene archiveScene = Scene(+ id: 'archive',+ tabLabel: 'Archive',+ tabIcon: Icons.video_library_outlined,+ title: 'Find the correct video',+ strapline: 'Which clip has the shot you need?',+ sourceLabel: 'Archive',+ suggestedCollection: 'media_archive',+ // Several clips indexed together. Results say which clip each frame is from,+ // which is the job here: find the clip, not the moment.+ // The junction clip is the same file the traffic tab uses, indexed here as+ // one of several rather than on its own.+ footage: <FootageClip>[+ FootageClip(+ asset: 'assets/footage/traffic_01.mp4',+ label: 'City junction',+ credit: 'Pexels video 15643210, free to use — see README',+ ),+ FootageClip(+ asset: 'assets/footage/ocean_01.mp4',+ label: 'Ocean',+ credit: 'Pexels, free to use — see README',+ ),+ FootageClip(+ asset: 'assets/footage/peppers_01.mp4',+ label: 'Cutting peppers',+ credit: 'Pexels, free to use — see README',+ ),+ FootageClip(+ asset: 'assets/footage/bird_01.mp4',+ label: 'Bird',+ credit: 'Pexels, free to use — see README',+ ),+ FootageClip(+ asset: 'assets/footage/cat_01.mp4',+ label: 'Cat',+ credit: 'Pexels, free to use — see README',+ ),+ ],+ searchHint: 'Describe a shot in the archive',+ // Measured across these five clips. Clips that genuinely hold the subject+ // score 0.70 to 0.87; clips that do not start at 0.885. So the ceiling sits+ // at 0.88: it keeps the ocean clip for "clouds" at 0.870, and drops the+ // junction clip for "animal" at 0.906, which a looser 0.92 let through.+ relevanceWindow: 0.15,+ relevanceCeiling: 0.88,+ explainer: 'Many clips. One search. Find which one.',+ steps: <String>[+ 'Upload your clips',+ 'Describe it, or use a picture',+ 'See which clip has it',+ ],+ palette: galleryPalette,+);++const List<Scene> scenes = <Scene>[trafficScene, archiveScene];++/// Pictures shipped for trying the image search, published to the device's+/// files alongside the footage so the picker can see them.+const List<String> queryImages = <String>[+ 'assets/queries/bird.jpg',+ 'assets/queries/sunset.jpg',+ 'assets/queries/clouds.jpg',+];diff --git a/example/04_example/lib/settings.dart b/example/04_example/lib/settings.dartnew file mode 100644index 0000000..c819886--- /dev/null+++ b/example/04_example/lib/settings.dart@@ -0,0 +1,84 @@+import 'dart:convert';+import 'dart:io';++/// What the app needs from the user: a key, and a collection name per demo.+///+/// Saving is opt in. When it is off nothing touches the disk and the key lives+/// only in memory for the session, which is how the SDK itself treats it.+class Settings {+ Settings({+ this.apiKey = '',+ Map<String, String>? collections,+ this.remember = false,+ }) : collections = collections ?? <String, String>{};++ String apiKey;++ /// Collection name per scene id.+ final Map<String, String> collections;++ /// Whether to keep these on the device between launches.+ bool remember;++ static File get _file =>+ File('${Directory.systemTemp.parent.path}/Documents/sightline.json');++ /// Reads saved settings, or empty ones when nothing was saved.+ static Settings load() {+ try {+ final File file = _file;+ if (!file.existsSync()) return Settings();+ final Object? raw = jsonDecode(file.readAsStringSync());+ if (raw is! Map) return Settings();+ return Settings(+ apiKey: '${raw['apiKey'] ?? ''}',+ collections: <String, String>{+ for (final MapEntry<Object?, Object?> e+ in (raw['collections'] as Map? ?? <Object?, Object?>{}).entries)+ '${e.key}': '${e.value}',+ },+ remember: raw['remember'] == true,+ );+ } on Object {+ return Settings();+ }+ }++ void save() {+ try {+ if (!remember) {+ forget();+ return;+ }+ _file.writeAsStringSync(+ jsonEncode(<String, Object?>{+ 'apiKey': apiKey,+ 'collections': collections,+ 'remember': true,+ }),+ );+ } on FileSystemException {+ // Saving is a convenience; failing to save is not worth an error.+ }+ }++ void forget() {+ try {+ if (_file.existsSync()) _file.deleteSync();+ } on FileSystemException {+ // Nothing to do.+ }+ }+}++/// The SDK's rule for collection and stream names.+String? validateCollection(String value) {+ final String name = value.trim();+ if (name.isEmpty) return 'Give the collection a name.';+ if (name.length > 80) return 'Keep it under 80 characters.';+ if (!RegExp(r'^[A-Za-z0-9_]+$').hasMatch(name)) {+ return 'Letters, digits and underscore only.';+ }+ if (name.contains('__')) return 'Two underscores in a row are reserved.';+ return null;+}diff --git a/example/04_example/lib/theme.dart b/example/04_example/lib/theme.dartnew file mode 100644index 0000000..88a958f--- /dev/null+++ b/example/04_example/lib/theme.dart@@ -0,0 +1,174 @@+import 'package:flutter/material.dart';++/// Visual identity for one demo scene.+///+/// The two scenes deliberately share no colours, corner radii or type. Each one+/// should read as a different product built by a different team.+@immutable+class Palette {+ const Palette({+ required this.brightness,+ required this.background,+ required this.surface,+ required this.raised,+ required this.border,+ required this.ink,+ required this.inkMuted,+ required this.accent,+ required this.onAccent,+ required this.radius,+ required this.displayFamily,+ required this.displayFallback,+ });++ final Brightness brightness;+ final Color background;+ final Color surface;+ final Color raised;+ final Color border;+ final Color ink;+ final Color inkMuted;+ final Color accent;+ final Color onAccent;+ final double radius;+ final String displayFamily;+ final List<String> displayFallback;++ static const List<String> monoFallback = <String>[+ 'Menlo',+ 'DejaVu Sans Mono',+ 'Courier New',+ ];++ BorderRadius get corner => BorderRadius.circular(radius);++ /// Monospaced style for machine-generated values: timestamps, scores, ids.+ TextStyle mono({+ double size = 12,+ Color? color,+ FontWeight weight = FontWeight.w500,+ double spacing = 0,+ }) => TextStyle(+ fontFamily: 'monospace',+ fontFamilyFallback: monoFallback,+ fontSize: size,+ height: 1.2,+ color: color ?? ink,+ fontWeight: weight,+ letterSpacing: spacing,+ );++ /// Small upper-case label used for section headers and metadata.+ TextStyle label({Color? color, double size = 11}) => TextStyle(+ fontSize: size,+ height: 1.2,+ letterSpacing: 1.4,+ fontWeight: FontWeight.w600,+ color: color ?? inkMuted,+ );++ /// Display style for the scene title.+ TextStyle display({double size = 30, Color? color}) => TextStyle(+ fontFamily: displayFamily,+ fontFamilyFallback: displayFallback,+ fontSize: size,+ height: 1.05,+ letterSpacing: -0.4,+ fontWeight: FontWeight.w600,+ color: color ?? ink,+ );++ ThemeData get theme {+ final ColorScheme scheme =+ ColorScheme.fromSeed(+ seedColor: accent,+ brightness: brightness,+ ).copyWith(+ surface: background,+ primary: accent,+ onPrimary: onAccent,+ outline: border,+ );++ return ThemeData(+ useMaterial3: true,+ colorScheme: scheme,+ scaffoldBackgroundColor: background,+ splashFactory: NoSplash.splashFactory,+ textTheme: Typography.material2021().black.apply(+ bodyColor: ink,+ displayColor: ink,+ ),+ inputDecorationTheme: InputDecorationTheme(+ filled: true,+ fillColor: raised,+ hintStyle: TextStyle(color: inkMuted, fontSize: 15),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 14,+ ),+ border: OutlineInputBorder(+ borderRadius: corner,+ borderSide: BorderSide(color: border),+ ),+ enabledBorder: OutlineInputBorder(+ borderRadius: corner,+ borderSide: BorderSide(color: border),+ ),+ focusedBorder: OutlineInputBorder(+ borderRadius: corner,+ borderSide: BorderSide(color: accent, width: 1.6),+ ),+ ),+ filledButtonTheme: FilledButtonThemeData(+ style: FilledButton.styleFrom(+ backgroundColor: accent,+ foregroundColor: onAccent,+ minimumSize: const Size(0, 50),+ shape: RoundedRectangleBorder(borderRadius: corner),+ textStyle: const TextStyle(+ fontSize: 15,+ fontWeight: FontWeight.w600,+ letterSpacing: 0.2,+ ),+ ),+ ),+ );+ }+}++/// Control-room palette: dark, dense, monospaced, amber.+const Palette consolePalette = Palette(+ brightness: Brightness.dark,+ background: Color(0xFF0A0E13),+ surface: Color(0xFF121922),+ raised: Color(0xFF18212C),+ border: Color(0xFF23303D),+ ink: Color(0xFFE6EDF3),+ inkMuted: Color(0xFF8296A8),+ accent: Color(0xFFFFB020),+ onAccent: Color(0xFF1A1206),+ radius: 6,+ displayFamily: 'sans-serif',+ displayFallback: <String>['Helvetica Neue', 'Arial'],+);++/// Studio palette: cool light grey, near-black ink, one electric blue.+/// Gallery palette: pale mint ground, deep forest accent, serif display.+const Palette galleryPalette = Palette(+ brightness: Brightness.light,+ background: Color(0xFFEFF4F0),+ surface: Color(0xFFFFFFFF),+ raised: Color(0xFFFFFFFF),+ border: Color(0xFFDCE7DF),+ ink: Color(0xFF0F1A14),+ inkMuted: Color(0xFF5A6B60),+ accent: Color(0xFF0B6E4F),+ onAccent: Color(0xFFFFFFFF),+ radius: 14,+ displayFamily: 'serif',+ displayFallback: <String>['Georgia', 'Times New Roman'],+);++/// Shown when a scene's footage is indexed, in both palettes.+const Color readyGreen = Color(0xFF0E9F6E);diff --git a/example/04_example/lib/widgets.dart b/example/04_example/lib/widgets.dartnew file mode 100644index 0000000..166df4d--- /dev/null+++ b/example/04_example/lib/widgets.dart@@ -0,0 +1,505 @@+import 'dart:io';++import 'package:file_selector/file_selector.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++import 'controller.dart';+import 'scene.dart';+import 'settings.dart';+import 'theme.dart';++/// Asks for the two things only the user can supply: their API key and the+/// collection to work in. Both are theirs; nothing about either is shipped.+class SetupSheet extends StatefulWidget {+ const SetupSheet({required this.controller, required this.scene, super.key});++ final SightlineController controller;+ final Scene scene;++ static Future<void> show(+ BuildContext context,+ SightlineController controller,+ Scene scene,+ ) => showModalBottomSheet<void>(+ context: context,+ isScrollControlled: true,+ backgroundColor: scene.palette.surface,+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(+ top: Radius.circular(scene.palette.radius * 2),+ ),+ ),+ builder: (BuildContext _) =>+ SetupSheet(controller: controller, scene: scene),+ );++ @override+ State<SetupSheet> createState() => _SetupSheetState();+}++class _SetupSheetState extends State<SetupSheet> {+ final TextEditingController _key = TextEditingController();+ final TextEditingController _collection = TextEditingController();+ bool _remember = false;+ String? _collectionError;++ Palette get _p => widget.scene.palette;++ @override+ void initState() {+ super.initState();+ final Settings saved = widget.controller.settings;+ _key.text = saved.apiKey;+ // Empty on a first run: the collection belongs to the user's account, so+ // the scene's name is only a hint in the field.+ _collection.text = saved.collections[widget.scene.id] ?? '';+ _remember = saved.remember;+ }++ @override+ void dispose() {+ _key.clear();+ _key.dispose();+ _collection.dispose();+ super.dispose();+ }++ Future<void> _paste() async {+ final ClipboardData? data = await Clipboard.getData(Clipboard.kTextPlain);+ final String value = data?.text?.trim() ?? '';+ if (value.isNotEmpty) setState(() => _key.text = value);+ }++ Future<void> _submit() async {+ final String? problem = validateCollection(_collection.text);+ setState(() => _collectionError = problem);+ if (problem != null) return;+ final bool ok = await widget.controller.applySetup(+ scene: widget.scene,+ apiKey: _key.text,+ collection: _collection.text,+ remember: _remember,+ );+ if (ok && mounted) Navigator.of(context).pop();+ }++ @override+ Widget build(BuildContext context) {+ final Palette p = _p;+ return Padding(+ padding: EdgeInsets.fromLTRB(+ 24,+ 24,+ 24,+ 24 + MediaQuery.viewInsetsOf(context).bottom,+ ),+ child: SingleChildScrollView(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: <Widget>[+ Text('VMODAL API KEY', style: p.label(color: p.inkMuted)),+ const SizedBox(height: 10),+ TextField(+ key: const Key('setup-api-key'),+ controller: _key,+ obscureText: true,+ autocorrect: false,+ enableSuggestions: false,+ autofocus: widget.controller.settings.apiKey.isEmpty,+ style: p.mono(size: 14),+ decoration: InputDecoration(+ hintText: 'ak_...',+ suffixIcon: TextButton(+ onPressed: _paste,+ style: TextButton.styleFrom(foregroundColor: p.accent),+ child: const Text('Paste'),+ ),+ ),+ ),+ const SizedBox(height: 8),+ Text(+ 'Masked as you type. Get one at v-modal.com/contact.',+ style: TextStyle(color: p.inkMuted, fontSize: 12.5, height: 1.4),+ ),+ const SizedBox(height: 22),+ Text('COLLECTION', style: p.label(color: p.inkMuted)),+ const SizedBox(height: 10),+ TextField(+ key: const Key('setup-collection'),+ controller: _collection,+ autocorrect: false,+ enableSuggestions: false,+ style: p.mono(size: 14),+ decoration: InputDecoration(+ hintText: widget.scene.suggestedCollection,+ errorText: _collectionError,+ ),+ onSubmitted: (_) => _submit(),+ ),+ const SizedBox(height: 8),+ Text(+ 'Where this tab uploads and searches, inside your own account. '+ 'Letters, digits and underscore.',+ style: TextStyle(color: p.inkMuted, fontSize: 12.5, height: 1.4),+ ),+ const SizedBox(height: 18),+ InkWell(+ onTap: () => setState(() => _remember = !_remember),+ child: Row(+ children: <Widget>[+ Switch.adaptive(+ value: _remember,+ activeThumbColor: p.accent,+ onChanged: (bool value) =>+ setState(() => _remember = value),+ ),+ const SizedBox(width: 6),+ Expanded(+ child: Text(+ 'Remember on this device. Kept in a plain file, so only '+ 'do it on a device you trust.',+ style: TextStyle(+ color: p.inkMuted,+ fontSize: 12.5,+ height: 1.4,+ ),+ ),+ ),+ ],+ ),+ ),+ if (widget.controller.connectError != null) ...<Widget>[+ const SizedBox(height: 12),+ Text(+ widget.controller.connectError!,+ style: TextStyle(color: p.accent, fontSize: 13),+ ),+ ],+ const SizedBox(height: 18),+ FilledButton(+ onPressed: widget.controller.isConnecting ? null : _submit,+ child: Text(+ widget.controller.isConnecting ? 'Connecting' : 'Connect',+ ),+ ),+ if (widget.controller.settings.remember) ...<Widget>[+ const SizedBox(height: 4),+ TextButton(+ onPressed: () {+ widget.controller.forgetSaved();+ Navigator.of(context).pop();+ },+ style: TextButton.styleFrom(foregroundColor: p.inkMuted),+ child: const Text('Forget what is saved'),+ ),+ ],+ ],+ ),+ ),+ );+ }+}++/// Lets the user pick video files to upload.+Future<({List<File> files, String? error})> pickVideos() async {+ try {+ final List<XFile> picked = await openFiles(+ acceptedTypeGroups: <XTypeGroup>[+ const XTypeGroup(+ label: 'video',+ // Apple platforms need the UTIs; the others use extensions or MIME.+ uniformTypeIdentifiers: <String>['public.movie'],+ extensions: <String>['mp4', 'mov', 'm4v'],+ mimeTypes: <String>['video/mp4', 'video/quicktime'],+ ),+ ],+ );+ return (+ files: picked.map((XFile file) => File(file.path)).toList(),+ error: null,+ );+ } on Object catch (error) {+ return (files: const <File>[], error: 'Could not open the picker: $error');+ }+}++/// Picks one picture to search with.+Future<({File? file, String? error})> pickImage() async {+ try {+ final XFile? picked = await openFile(+ acceptedTypeGroups: <XTypeGroup>[+ const XTypeGroup(+ label: 'image',+ uniformTypeIdentifiers: <String>['public.image'],+ extensions: <String>['jpg', 'jpeg', 'png', 'heic', 'webp'],+ mimeTypes: <String>['image/jpeg', 'image/png', 'image/webp'],+ ),+ ],+ );+ return (file: picked == null ? null : File(picked.path), error: null);+ } on Object catch (error) {+ return (file: null, error: 'Could not open the picker: $error');+ }+}++/// Small round icon button that matches whichever scene is showing.+class IconAction extends StatelessWidget {+ const IconAction({+ required this.icon,+ required this.palette,+ required this.onTap,+ this.tooltip,+ super.key,+ });++ final IconData icon;+ final Palette palette;+ final VoidCallback onTap;+ final String? tooltip;++ @override+ Widget build(BuildContext context) => Tooltip(+ message: tooltip ?? '',+ child: InkWell(+ onTap: onTap,+ customBorder: const CircleBorder(),+ child: Container(+ padding: const EdgeInsets.all(7),+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ border: Border.all(color: palette.border),+ ),+ child: Icon(icon, size: 16, color: palette.inkMuted),+ ),+ ),+ );+}++/// Explains the demo on demand, so the screen itself stays quiet.+class HowItWorks extends StatelessWidget {+ const HowItWorks({required this.scene, super.key});++ final Scene scene;++ static void open(BuildContext context, Scene scene) => showDialog<void>(+ context: context,+ barrierColor: Colors.black.withValues(alpha: 0.55),+ builder: (BuildContext _) => HowItWorks(scene: scene),+ );++ @override+ Widget build(BuildContext context) {+ final Palette p = scene.palette;+ return Dialog(+ backgroundColor: p.surface,+ insetPadding: const EdgeInsets.symmetric(horizontal: 24),+ shape: RoundedRectangleBorder(borderRadius: p.corner),+ clipBehavior: Clip.antiAlias,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: <Widget>[+ Container(height: 3, color: p.accent),+ Flexible(+ child: SingleChildScrollView(+ child: Padding(+ padding: const EdgeInsets.fromLTRB(26, 26, 26, 22),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Text(scene.title.toUpperCase(), style: p.label(size: 10)),+ const SizedBox(height: 12),+ Text('What this does', style: p.display(size: 26)),+ const SizedBox(height: 14),+ Text(+ scene.explainer,+ style: TextStyle(+ color: p.inkMuted,+ fontSize: 14,+ height: 1.5,+ ),+ ),+ const SizedBox(height: 24),+ for (int i = 0; i < scene.steps.length; i++)+ Padding(+ padding: const EdgeInsets.only(bottom: 14),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Container(+ width: 26,+ height: 26,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: p.accent.withValues(alpha: 0.12),+ shape: BoxShape.circle,+ ),+ child: Text(+ '${i + 1}',+ style: p.mono(size: 12, color: p.accent),+ ),+ ),+ const SizedBox(width: 14),+ Expanded(+ child: Padding(+ padding: const EdgeInsets.only(top: 4),+ child: Text(+ scene.steps[i],+ style: TextStyle(+ color: p.ink,+ fontSize: 14.5,+ height: 1.35,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ const SizedBox(height: 6),+ Divider(color: p.border, height: 1),+ const SizedBox(height: 16),+ Text(+ 'Indexing happens once and stays on the server.',+ style: TextStyle(+ color: p.inkMuted,+ fontSize: 12.5,+ height: 1.45,+ ),+ ),+ const SizedBox(height: 14),+ Divider(color: p.border, height: 1),+ const SizedBox(height: 14),+ Text(+ 'VModal Flutter SDK. Bring your own key, v-modal.com/contact.',+ style: TextStyle(+ color: p.inkMuted,+ fontSize: 12.5,+ height: 1.45,+ ),+ ),+ const SizedBox(height: 20),+ Align(+ alignment: Alignment.centerRight,+ child: TextButton(+ onPressed: () => Navigator.of(context).pop(),+ style: TextButton.styleFrom(foregroundColor: p.accent),+ child: const Text('Got it'),+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ ],+ ),+ );+ }+}++/// Thin progress line, used while footage uploads.+class ThinProgress extends StatelessWidget {+ const ThinProgress({required this.value, required this.palette, super.key});++ final double value;+ final Palette palette;++ @override+ Widget build(BuildContext context) => ClipRRect(+ borderRadius: BorderRadius.circular(2),+ child: LinearProgressIndicator(+ value: value == 0 ? null : value,+ minHeight: 3,+ backgroundColor: palette.border,+ valueColor: AlwaysStoppedAnimation<Color>(palette.accent),+ ),+ );+}++/// One returned frame. Falls back to a neutral block if bytes are missing.+class FrameImage extends StatelessWidget {+ const FrameImage({+ required this.hit,+ required this.palette,+ this.fit = BoxFit.cover,+ super.key,+ });++ final SearchHit hit;+ final Palette palette;+ final BoxFit fit;++ @override+ Widget build(BuildContext context) {+ if (hit.bytes == null) {+ return ColoredBox(+ color: palette.border,+ child: Center(+ child: Icon(+ Icons.image_not_supported_outlined,+ size: 18,+ color: palette.inkMuted,+ ),+ ),+ );+ }+ return Image.memory(+ hit.bytes!,+ fit: fit,+ gaplessPlayback: true,+ semanticLabel: 'Frame at ${hit.timeLabel} from ${hit.fileName}',+ );+ }+}++/// Full-bleed view of one frame with its metadata.+class FrameDetail extends StatelessWidget {+ const FrameDetail({required this.hit, required this.palette, super.key});++ final SearchHit hit;+ final Palette palette;++ static void open(BuildContext context, SearchHit hit, Palette palette) {+ showDialog<void>(+ context: context,+ barrierColor: Colors.black87,+ builder: (BuildContext _) => FrameDetail(hit: hit, palette: palette),+ );+ }++ @override+ Widget build(BuildContext context) => Dialog(+ backgroundColor: palette.surface,+ insetPadding: const EdgeInsets.all(20),+ shape: RoundedRectangleBorder(borderRadius: palette.corner),+ clipBehavior: Clip.antiAlias,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: <Widget>[+ AspectRatio(+ aspectRatio: 16 / 9,+ child: FrameImage(hit: hit, palette: palette, fit: BoxFit.contain),+ ),+ Padding(+ padding: const EdgeInsets.all(18),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Text(hit.timeLabel, style: palette.mono(size: 20)),+ const SizedBox(height: 8),+ Text(+ hit.fileName,+ style: TextStyle(color: palette.inkMuted, fontSize: 13),+ ),+ ],+ ),+ ),+ ],+ ),+ );+}diff --git a/example/04_example/pubspec.lock b/example/04_example/pubspec.locknew file mode 100644index 0000000..c5c3e56--- /dev/null+++ b/example/04_example/pubspec.lock@@ -0,0 +1,392 @@+# Generated by pub+# See https://dart.dev/tools/pub/glossary#lockfile+packages:+ async:+ dependency: transitive+ description:+ name: async+ sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37+ url: "https://pub.dev"+ source: hosted+ version: "2.13.1"+ boolean_selector:+ dependency: transitive+ description:+ name: boolean_selector+ sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.2"+ characters:+ dependency: transitive+ description:+ name: characters+ sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b+ url: "https://pub.dev"+ source: hosted+ version: "1.4.1"+ clock:+ dependency: transitive+ description:+ name: clock+ sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ collection:+ dependency: transitive+ description:+ name: collection+ sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"+ url: "https://pub.dev"+ source: hosted+ version: "1.19.1"+ cross_file:+ dependency: transitive+ description:+ name: cross_file+ sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6+ url: "https://pub.dev"+ source: hosted+ version: "0.3.5+5"+ crypto:+ dependency: transitive+ description:+ name: crypto+ sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf+ url: "https://pub.dev"+ source: hosted+ version: "3.0.7"+ fake_async:+ dependency: transitive+ description:+ name: fake_async+ sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"+ url: "https://pub.dev"+ source: hosted+ version: "1.3.3"+ file:+ dependency: transitive+ description:+ name: file+ sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4+ url: "https://pub.dev"+ source: hosted+ version: "7.0.1"+ file_selector:+ dependency: "direct main"+ description:+ name: file_selector+ sha256: bd15e43e9268db636b53eeaca9f56324d1622af30e5c34d6e267649758c84d9a+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"+ file_selector_android:+ dependency: transitive+ description:+ name: file_selector_android+ sha256: "1d45e9910f68c16eb0c74f0b10097ad81aed516ea28054c027137e8f7d75e840"+ url: "https://pub.dev"+ source: hosted+ version: "0.5.2+9"+ file_selector_ios:+ dependency: transitive+ description:+ name: file_selector_ios+ sha256: e2ecf2885c121691ce13b60db3508f53c01f869fb6e8dc5c1cfa771e4c46aeca+ url: "https://pub.dev"+ source: hosted+ version: "0.5.3+5"+ file_selector_linux:+ dependency: transitive+ description:+ name: file_selector_linux+ sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0"+ url: "https://pub.dev"+ source: hosted+ version: "0.9.4"+ file_selector_macos:+ dependency: transitive+ description:+ name: file_selector_macos+ sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a"+ url: "https://pub.dev"+ source: hosted+ version: "0.9.5"+ file_selector_platform_interface:+ dependency: transitive+ description:+ name: file_selector_platform_interface+ sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85"+ url: "https://pub.dev"+ source: hosted+ version: "2.7.0"+ file_selector_web:+ dependency: transitive+ description:+ name: file_selector_web+ sha256: "73181fbc5257776d8ecaa6a94ab3c8e920ad143b9132a6d984a9271dfc6928d3"+ url: "https://pub.dev"+ source: hosted+ version: "0.9.5"+ file_selector_windows:+ dependency: transitive+ description:+ name: file_selector_windows+ sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd"+ url: "https://pub.dev"+ source: hosted+ version: "0.9.3+5"+ flutter:+ dependency: "direct main"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_driver:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_lints:+ dependency: "direct dev"+ description:+ name: flutter_lints+ sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"+ url: "https://pub.dev"+ source: hosted+ version: "6.0.0"+ flutter_test:+ dependency: "direct dev"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_web_plugins:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ fuchsia_remote_debug_protocol:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ http:+ dependency: transitive+ description:+ name: http+ sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"+ url: "https://pub.dev"+ source: hosted+ version: "1.6.0"+ http_parser:+ dependency: transitive+ description:+ name: http_parser+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"+ url: "https://pub.dev"+ source: hosted+ version: "4.1.2"+ integration_test:+ dependency: "direct dev"+ description: flutter+ source: sdk+ version: "0.0.0"+ leak_tracker:+ dependency: transitive+ description:+ name: leak_tracker+ sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"+ url: "https://pub.dev"+ source: hosted+ version: "11.0.2"+ leak_tracker_flutter_testing:+ dependency: transitive+ description:+ name: leak_tracker_flutter_testing+ sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"+ url: "https://pub.dev"+ source: hosted+ version: "3.0.10"+ leak_tracker_testing:+ dependency: transitive+ description:+ name: leak_tracker_testing+ sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"+ url: "https://pub.dev"+ source: hosted+ version: "3.0.2"+ lints:+ dependency: transitive+ description:+ name: lints+ sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df"+ url: "https://pub.dev"+ source: hosted+ version: "6.1.0"+ matcher:+ dependency: transitive+ description:+ name: matcher+ sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861+ url: "https://pub.dev"+ source: hosted+ version: "0.12.19"+ material_color_utilities:+ dependency: transitive+ description:+ name: material_color_utilities+ sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"+ url: "https://pub.dev"+ source: hosted+ version: "0.13.0"+ meta:+ dependency: transitive+ description:+ name: meta+ sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"+ url: "https://pub.dev"+ source: hosted+ version: "1.18.0"+ path:+ dependency: transitive+ description:+ name: path+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"+ url: "https://pub.dev"+ source: hosted+ version: "1.9.1"+ platform:+ dependency: transitive+ description:+ name: platform+ sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"+ url: "https://pub.dev"+ source: hosted+ version: "3.1.6"+ plugin_platform_interface:+ dependency: transitive+ description:+ name: plugin_platform_interface+ sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.8"+ process:+ dependency: transitive+ description:+ name: process+ sha256: c6248e4526673988586e8c00bb22a49210c258dc91df5227d5da9748ecf79744+ url: "https://pub.dev"+ source: hosted+ version: "5.0.5"+ sky_engine:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ source_span:+ dependency: transitive+ description:+ name: source_span+ sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"+ url: "https://pub.dev"+ source: hosted+ version: "1.10.2"+ stack_trace:+ dependency: transitive+ description:+ name: stack_trace+ sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"+ url: "https://pub.dev"+ source: hosted+ version: "1.12.1"+ stream_channel:+ dependency: transitive+ description:+ name: stream_channel+ sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.4"+ string_scanner:+ dependency: transitive+ description:+ name: string_scanner+ sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"+ url: "https://pub.dev"+ source: hosted+ version: "1.4.1"+ sync_http:+ dependency: transitive+ description:+ name: sync_http+ sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"+ url: "https://pub.dev"+ source: hosted+ version: "0.3.1"+ term_glyph:+ dependency: transitive+ description:+ name: term_glyph+ sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"+ url: "https://pub.dev"+ source: hosted+ version: "1.2.2"+ test_api:+ dependency: transitive+ description:+ name: test_api+ sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"+ url: "https://pub.dev"+ source: hosted+ version: "0.7.11"+ typed_data:+ dependency: transitive+ description:+ name: typed_data+ sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ vector_math:+ dependency: transitive+ description:+ name: vector_math+ sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b+ url: "https://pub.dev"+ source: hosted+ version: "2.2.0"+ vm_service:+ dependency: transitive+ description:+ name: vm_service+ sha256: "5f37239c4851efcef929cea7824e76df7f2f0970aef85d66bbc430afa40e72f0"+ url: "https://pub.dev"+ source: hosted+ version: "15.3.0"+ vmodal_sdk_flutter:+ dependency: "direct main"+ description:+ path: "../.."+ relative: true+ source: path+ version: "1.2.2"+ web:+ dependency: transitive+ description:+ name: web+ sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.1"+ webdriver:+ dependency: transitive+ description:+ name: webdriver+ sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade"+ url: "https://pub.dev"+ source: hosted+ version: "3.1.0"+sdks:+ dart: ">=3.12.2 <4.0.0"+ flutter: ">=3.44.0"diff --git a/example/04_example/pubspec.yaml b/example/04_example/pubspec.yamlindex d9c7735..28a5965 100644--- a/example/04_example/pubspec.yaml+++ b/example/04_example/pubspec.yaml@@ -13,9 +13,7 @@ dependencies:flutter:sdk: fluttervmodal_sdk_flutter:- git:- url: https://github.com/v-modal/vmodal_sdk_flutter.git- ref: 725ce8e+ path: ../..dev_dependencies:flutter_lints: ^6.0.0diff --git a/example/readme.md b/example/readme.mdindex ddedb4a..f9c67a7 100644--- a/example/readme.md+++ b/example/readme.md@@ -22,6 +22,7 @@ upload, cancellation, and error handling.| [`01_full_app`](01_full_app/README.md) | End-to-end mobile UI | Runtime API key, identity resolution, collection and index discovery, video upload, index creation, natural-language search, and image-result rendering. || [`02_users`](02_users/README.md) | Content organization patterns | Shared global search, private per-user collections, multiple streams per user, and business/product catalog layouts. || [`03_cctv`](03_cctv/README.md) | Timestamped surveillance media | CCTV filename and timestamp metadata, searchable tags/text, image indexing, and absolute-time metadata search. |+| [`04_example`](04_example/README.md) | Searchable-video demo app | Traffic-camera moment search and multi-video visual discovery in one Android/iOS application. |## SDK capabilitiesdiff --git a/test/regression_manifest_test.dart b/test/regression_manifest_test.dartindex db4ed25..25ed9a0 100644--- a/test/regression_manifest_test.dart+++ b/test/regression_manifest_test.dart@@ -65,6 +65,9 @@ void main() {'example/03_cctv/bin/main.dart','example/03_cctv/lib/cctv_example.dart','example/03_cctv/test/cctv_example_test.dart',+ 'example/04_example/README.md',+ 'example/04_example/lib/main.dart',+ 'example/04_example/test/widget_test.dart','test/new_api_surface_test.dart',];for (final path in files) {@@ -176,6 +179,9 @@ void main() {'example/03_cctv/bin/main.dart','example/03_cctv/lib/cctv_example.dart','example/03_cctv/test/cctv_example_test.dart',+ 'example/04_example/README.md',+ 'example/04_example/lib/main.dart',+ 'example/04_example/test/widget_test.dart','doc/search_app.md','doc/sdk_doc.md','doc/manage_api_key.md',