From 2a80d56969b3008de243d3586cda2422e951c07e Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Mon, 6 May 2024 20:53:09 -0400 Subject: [PATCH] wip --- example/pubspec.lock | 72 +++++++------------ lib/components/atoms/slide_view.dart | 2 - .../molecules/slide_thumbnail_list.dart | 9 +++ lib/components/superdeck_app.dart | 2 +- lib/providers/controller.dart | 17 ++--- pubspec.lock | 44 +++++------- pubspec.yaml | 4 +- 7 files changed, 61 insertions(+), 89 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 0be9c812..b359192f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -13,18 +13,18 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265 url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.5.1" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: barcode - sha256: "1fe4a55344505850517ce72d4a3a7b9ccf51b0dc1631ee7e552f6eacc4947f96" + sha256: ab180ce22c6555d77d45f0178a523669db67f95856e3378259ef2ffeb43e6003 url: "https://pub.dev" source: hosted - version: "2.2.7" + version: "2.2.8" bidi: dependency: transitive description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: cached_network_image_web - sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316" + sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" characters: dependency: transitive description: @@ -113,14 +113,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" cross_file: dependency: transitive description: @@ -189,10 +181,10 @@ packages: dependency: transitive description: name: file_picker - sha256: "45c70b43df893027e441a6fa0aacc8f484fb9f9c60c746dc8f1dc4f774cf55cd" + sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a" url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.0.3" fixnum: dependency: transitive description: @@ -210,10 +202,10 @@ packages: dependency: transitive description: name: flutter_cache_manager - sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + sha256: "395d6b7831f21f3b989ebedbb785545932adb9afe2622c1ffacf7f4b53a7e544" url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.3.2" flutter_lints: dependency: "direct dev" description: @@ -244,10 +236,10 @@ packages: dependency: transitive description: name: go_router - sha256: "771c8feb40ad0ef639973d7ecf1b43d55ffcedb2207fd43fab030f5639e40446" + sha256: b465e99ce64ba75e61c8c0ce3d87b66d8ac07f0b35d0a7e0263fcfc10f99e836 url: "https://pub.dev" source: hosted - version: "13.2.4" + version: "13.2.5" google_fonts: dependency: "direct main" description: @@ -288,14 +280,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.7" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" leak_tracker: dependency: transitive description: @@ -419,10 +403,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.4" path_provider_foundation: dependency: transitive description: @@ -487,14 +471,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333" - url: "https://pub.dev" - source: hosted - version: "3.8.0" qr: dependency: transitive description: @@ -584,18 +560,18 @@ packages: dependency: transitive description: name: sqflite - sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4" stack_trace: dependency: transitive description: @@ -759,10 +735,10 @@ packages: dependency: transitive description: name: uuid - sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.dev" source: hosted - version: "4.3.3" + version: "4.4.0" vector_math: dependency: transitive description: @@ -799,10 +775,10 @@ packages: dependency: transitive description: name: win32 - sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.5.0" window_manager: dependency: transitive description: diff --git a/lib/components/atoms/slide_view.dart b/lib/components/atoms/slide_view.dart index 566e3e81..7422a149 100644 --- a/lib/components/atoms/slide_view.dart +++ b/lib/components/atoms/slide_view.dart @@ -32,8 +32,6 @@ class SlideView extends StatelessWidget { final variantStyle = style.applyVariant(variant); - sdController.dependencyKey.watch(context); - final backgroundWidget = slide.background != null ? CacheImage( url: slide.background!, diff --git a/lib/components/molecules/slide_thumbnail_list.dart b/lib/components/molecules/slide_thumbnail_list.dart index 7aa7a621..afa15bc7 100644 --- a/lib/components/molecules/slide_thumbnail_list.dart +++ b/lib/components/molecules/slide_thumbnail_list.dart @@ -31,6 +31,15 @@ class _SlideThumbnailListState extends State { var _visibleItems = []; + @override + void didUpdateWidget(covariant SlideThumbnailList oldWidget) { + super.didUpdateWidget(oldWidget); + + if (widget.currentSlide != oldWidget.currentSlide) { + goToPage(widget.currentSlide); + } + } + Future goToPage(int page, {bool animate = true}) async { if (page < 0 || page >= widget.slides.length) return; diff --git a/lib/components/superdeck_app.dart b/lib/components/superdeck_app.dart index e1bf18ca..428ee002 100644 --- a/lib/components/superdeck_app.dart +++ b/lib/components/superdeck_app.dart @@ -105,7 +105,7 @@ class _SuperDeckAppState extends State { final result = _initialize.watch(context); return result.map( - data: (value) => child!, + data: (_) => child!, loading: () => renderLoading(), error: (error, _) { return ExceptionWidget( diff --git a/lib/providers/controller.dart b/lib/providers/controller.dart index 43296d64..154d7403 100644 --- a/lib/providers/controller.dart +++ b/lib/providers/controller.dart @@ -7,7 +7,6 @@ import 'package:signals/signals_flutter.dart'; import '../builder/slides_loader.dart'; import '../helpers/constants.dart'; -import '../helpers/utils.dart'; import '../services/project_service.dart'; import '../superdeck.dart'; @@ -29,15 +28,6 @@ class SDController { final examples = mapSignal({}); - late final dependencyKey = computed(() { - final variant = style.value.toString(); - final previousVariant = style.previousValue.toString(); - final example = examples.values.toString(); - print(shortHashId(variant)); - print(style.value.getDiff(style.previousValue!)); - return shortHashId(variant + example); - }); - late final error = computed( () { final data = _data.value; @@ -55,6 +45,12 @@ class SDController { this.examples.assign({for (var e in examples) e.name: e}); }); + if (_data.isDone) { + await _data.reload(); + } else { + await _data.future; + } + if (kCanRunProcess) { SlidesLoader.instance.listen(_data.refresh); } @@ -113,6 +109,7 @@ class NavigationProvider { } void goToSlide(int slide) { + if (slide < 0 || slide >= sdController.slides.value.length) return; currentSlide.value = slide; } diff --git a/pubspec.lock b/pubspec.lock index f55c143b..eea8d6db 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265 url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.5.1" args: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: barcode - sha256: "1fe4a55344505850517ce72d4a3a7b9ccf51b0dc1631ee7e552f6eacc4947f96" + sha256: ab180ce22c6555d77d45f0178a523669db67f95856e3378259ef2ffeb43e6003 url: "https://pub.dev" source: hosted - version: "2.2.7" + version: "2.2.8" bidi: dependency: transitive description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: cached_network_image_web - sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316" + sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" characters: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.8.0" cross_file: dependency: transitive description: @@ -373,10 +373,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "45c70b43df893027e441a6fa0aacc8f484fb9f9c60c746dc8f1dc4f774cf55cd" + sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a" url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.0.3" fixnum: dependency: transitive description: @@ -394,10 +394,10 @@ packages: dependency: transitive description: name: flutter_cache_manager - sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + sha256: "395d6b7831f21f3b989ebedbb785545932adb9afe2622c1ffacf7f4b53a7e544" url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.3.2" flutter_lints: dependency: "direct dev" description: @@ -532,10 +532,10 @@ packages: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -751,14 +751,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "79fbafed02cfdbe85ef3fd06c7f4bc2cbcba0177e61b765264853d4253b21744" - url: "https://pub.dev" - source: hosted - version: "3.9.0" pool: dependency: transitive description: @@ -936,10 +928,10 @@ packages: dependency: transitive description: name: sqflite - sha256: "5ce2e1a15e822c3b4bfb5400455775e421da7098eed8adc8f26298ada7c9308c" + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.3+1" sqflite_common: dependency: transitive description: @@ -1192,10 +1184,10 @@ packages: dependency: transitive description: name: win32 - sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a" + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "5.5.0" window_manager: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 89d43eaf..2aa60b7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,8 +27,8 @@ dependencies: scrollable_positioned_list: ^0.3.8 pdf: ^3.10.8 localstorage: ^5.0.0 - go_router: ^13.2.4 - file_picker: ^8.0.1 + go_router: ^13.2.5 + file_picker: ^8.0.3 universal_html: ^2.2.4 path_provider: ^2.1.3 url_launcher: ^6.2.6