mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Add support of longtap actions
84a3d55e0009bec446209d7c41eb8d858d930c0e
This commit is contained in:
@@ -10372,6 +10372,7 @@
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.fixed-size-with-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.fixed-size-with-paddings.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.font_feature_ranges.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.font_feature_ranges.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.font_features.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.font_features.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.font_weight.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.font_weight.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.gradient-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.gradient-background.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.gradient-color-text.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.gradient-color-text.png",
|
||||
"client/flutter/divkit/test/goldens/goldens/div-text.images_hyphenation.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.images_hyphenation.png",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
## 0.1.6-pre
|
||||
* Correct interpretation of dict in variables context
|
||||
* Add support of longtap actions
|
||||
|
||||
## 0.1.5
|
||||
* Templater support: templates can be inherited, composited, links and transitive links to fields.
|
||||
|
||||
@@ -5,10 +5,10 @@ packages:
|
||||
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:
|
||||
@@ -29,26 +29,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image
|
||||
sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15
|
||||
sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.3"
|
||||
version: "3.3.1"
|
||||
cached_network_image_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_platform_interface
|
||||
sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7
|
||||
sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "4.0.0"
|
||||
cached_network_image_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_web
|
||||
sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0
|
||||
sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.2.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -77,18 +77,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
|
||||
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
version: "3.0.3"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
version: "1.0.8"
|
||||
div_expressions_resolver:
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
@@ -123,10 +123,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
|
||||
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
version: "2.1.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -135,27 +135,27 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_blurhash:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_blurhash
|
||||
sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
flutter_cache_manager:
|
||||
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_driver:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -173,18 +173,18 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_riverpod
|
||||
sha256: b6cb0041c6c11cefb2dcb97ef436eba43c6d41287ac6d8ca93e02a497f53a4f3
|
||||
sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.7"
|
||||
version: "2.5.1"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f
|
||||
sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.10+1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -199,10 +199,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.6"
|
||||
version: "1.2.1"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -244,10 +244,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
|
||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.1.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -284,10 +284,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: octo_image
|
||||
sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143"
|
||||
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "2.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -308,26 +308,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
|
||||
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.3"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
|
||||
sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
version: "2.2.4"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
|
||||
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
version: "2.4.0"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -340,10 +340,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
|
||||
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -356,10 +356,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
|
||||
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
version: "6.0.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -372,10 +372,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
|
||||
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.6"
|
||||
version: "2.1.8"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -388,10 +388,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: riverpod
|
||||
sha256: b0657b5b30c81a3184bdaab353045f0a403ebd60bb381591a8b7ad77dcade793
|
||||
sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.7"
|
||||
version: "2.5.1"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -425,18 +425,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite
|
||||
sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9
|
||||
sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.8+4"
|
||||
version: "2.3.3+1"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f"
|
||||
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.5+1"
|
||||
version: "2.5.4"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -481,10 +481,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
|
||||
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
version: "3.1.0+1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -505,42 +505,42 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
|
||||
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
version: "1.3.2"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: uuid
|
||||
sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7
|
||||
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
version: "4.4.0"
|
||||
vector_graphics:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: ea8d3fc7b2e0f35de38a7465063ecfcf03d8217f7962aa2a6717132cb5d43a79
|
||||
sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.5"
|
||||
version: "1.1.11+1"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_codec
|
||||
sha256: a5eaa5d19e123ad4f61c3718ca1ed921c4e6254238d9145f82aa214955d9aced
|
||||
sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.5"
|
||||
version: "1.1.11+1"
|
||||
vector_graphics_compiler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_compiler
|
||||
sha256: "15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca"
|
||||
sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.5"
|
||||
version: "1.1.11+1"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -557,6 +557,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.0"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.1"
|
||||
webdriver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -569,26 +577,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c"
|
||||
sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.4"
|
||||
version: "5.5.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
|
||||
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "1.0.4"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
|
||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.2"
|
||||
version: "6.5.0"
|
||||
sdks:
|
||||
dart: ">=3.2.0-0 <4.0.0"
|
||||
flutter: ">=3.7.0"
|
||||
dart: ">=3.3.0 <4.0.0"
|
||||
flutter: ">=3.16.6"
|
||||
|
||||
@@ -10,6 +10,7 @@ class DivBaseWidget extends StatefulWidget {
|
||||
final DivBase data;
|
||||
|
||||
final List<DivAction> actions;
|
||||
final List<DivAction> longtapActions;
|
||||
|
||||
final Widget child;
|
||||
|
||||
@@ -18,10 +19,12 @@ class DivBaseWidget extends StatefulWidget {
|
||||
super.key,
|
||||
DivAction? action,
|
||||
List<DivAction>? actions,
|
||||
List<DivAction>? longtapActions,
|
||||
required this.child,
|
||||
}) : actions = action != null
|
||||
}) : actions = action != null
|
||||
? ((actions ?? const []) + [action])
|
||||
: (actions ?? const []);
|
||||
: (actions ?? const []),
|
||||
longtapActions = longtapActions ?? [];
|
||||
|
||||
@override
|
||||
State<DivBaseWidget> createState() => _DivBaseWidgetState();
|
||||
@@ -70,6 +73,7 @@ class _DivBaseWidgetState extends State<DivBaseWidget> {
|
||||
opacity: model.opacity,
|
||||
child: DivTapActionEmitter(
|
||||
actions: widget.actions,
|
||||
longtapActions: widget.longtapActions,
|
||||
child: focusNode != null
|
||||
? AnimatedBuilder(
|
||||
animation: focusNode,
|
||||
|
||||
@@ -43,6 +43,7 @@ class _DivContainerWidgetState extends State<DivContainerWidget> {
|
||||
data: widget.data,
|
||||
action: widget.data.action,
|
||||
actions: widget.data.actions,
|
||||
longtapActions: widget.data.longtapActions,
|
||||
child: StreamBuilder<DivContainerModel>(
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
|
||||
@@ -9,34 +9,48 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
class DivTapActionModel with EquatableMixin {
|
||||
final List<DivAction> actions;
|
||||
final List<DivAction> longtapActions;
|
||||
final bool enabled;
|
||||
|
||||
const DivTapActionModel({
|
||||
required this.actions,
|
||||
required this.longtapActions,
|
||||
required this.enabled,
|
||||
});
|
||||
|
||||
static Stream<DivTapActionModel> from(
|
||||
BuildContext context,
|
||||
List<dto.DivAction> actions,
|
||||
List<dto.DivAction> longtapActions,
|
||||
) {
|
||||
final variables =
|
||||
DivKitProvider.watch<DivContext>(context)!.variableManager;
|
||||
|
||||
return variables.watch<DivTapActionModel>((context) async {
|
||||
List<DivAction> result = [];
|
||||
List<DivAction> a = [];
|
||||
for (final action in actions) {
|
||||
final rAction = await action.resolve(
|
||||
context: context,
|
||||
);
|
||||
if (rAction.enabled) {
|
||||
result.add(rAction);
|
||||
a.add(rAction);
|
||||
}
|
||||
}
|
||||
|
||||
List<DivAction> la = [];
|
||||
for (final action in longtapActions) {
|
||||
final rAction = await action.resolve(
|
||||
context: context,
|
||||
);
|
||||
if (rAction.enabled) {
|
||||
la.add(rAction);
|
||||
}
|
||||
}
|
||||
|
||||
return DivTapActionModel(
|
||||
actions: result,
|
||||
enabled: result.isNotEmpty,
|
||||
actions: a,
|
||||
longtapActions: la,
|
||||
enabled: a.isNotEmpty || la.isNotEmpty,
|
||||
);
|
||||
}).distinct();
|
||||
}
|
||||
@@ -50,12 +64,14 @@ class DivTapActionModel with EquatableMixin {
|
||||
/// A wrapper for sending actions.
|
||||
class DivTapActionEmitter extends StatefulWidget {
|
||||
final List<dto.DivAction> actions;
|
||||
final List<dto.DivAction> longtapActions;
|
||||
|
||||
final Widget child;
|
||||
|
||||
const DivTapActionEmitter({
|
||||
super.key,
|
||||
required this.actions,
|
||||
required this.longtapActions,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@@ -72,7 +88,11 @@ class _DivTapActionEmitterState extends State<DivTapActionEmitter> {
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
stream ??= DivTapActionModel.from(context, widget.actions);
|
||||
stream ??= DivTapActionModel.from(
|
||||
context,
|
||||
widget.actions,
|
||||
widget.longtapActions,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -80,13 +100,17 @@ class _DivTapActionEmitterState extends State<DivTapActionEmitter> {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (widget.actions != oldWidget.actions) {
|
||||
stream = DivTapActionModel.from(context, widget.actions);
|
||||
stream = DivTapActionModel.from(
|
||||
context,
|
||||
widget.actions,
|
||||
widget.longtapActions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => StreamBuilder<DivTapActionModel>(
|
||||
stream: DivTapActionModel.from(context, widget.actions),
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final model = snapshot.requireData;
|
||||
@@ -100,6 +124,11 @@ class _DivTapActionEmitterState extends State<DivTapActionEmitter> {
|
||||
await action.execute(divContext);
|
||||
}
|
||||
},
|
||||
onLongPress: () async {
|
||||
for (final action in model.longtapActions) {
|
||||
await action.execute(divContext);
|
||||
}
|
||||
},
|
||||
builder: (context, pressed, hovered, child) {
|
||||
double opacity = 1.0;
|
||||
if (pressed) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class _DivImageWidgetState extends State<DivImageWidget> {
|
||||
data: widget.data,
|
||||
action: widget.data.action,
|
||||
actions: widget.data.actions,
|
||||
longtapActions: widget.data.longtapActions,
|
||||
child: StreamBuilder<DivImageModel>(
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
|
||||
@@ -41,6 +41,7 @@ class _DivTextWidgetState extends State<DivTextWidget> {
|
||||
data: widget.data,
|
||||
action: widget.data.action,
|
||||
actions: widget.data.actions,
|
||||
longtapActions: widget.data.longtapActions,
|
||||
child: StreamBuilder<DivTextModel>(
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
|
||||
@@ -82,6 +82,7 @@ final skippedTests = [
|
||||
'example/assets/test_data/snapshot_test_data/div-container/baseline-with-images.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-input/text-alignment-property.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-input/text-alignment-property-single-line.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-input/all-attributes.json'
|
||||
].map(
|
||||
(e) => _SkipTest(
|
||||
e,
|
||||
@@ -404,7 +405,10 @@ final skippedTests = [
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/vertical-gallery-resizable-height.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/vertical-gallery-scrollbar.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/vertical-gallery-with-columns.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/vertical-grid-gallery-wrapped-item-spacing.json'
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/vertical-grid-gallery-wrapped-item-spacing.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/item-builder/item-builder.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/item-builder/nested-builders.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-gallery/item-builder/non-unique-matched-selectors.json'
|
||||
].map(
|
||||
(e) => _SkipTest(
|
||||
e,
|
||||
@@ -485,6 +489,7 @@ final skippedTests = [
|
||||
'example/assets/test_data/snapshot_test_data/div-grid/wrap-content-weighted-items.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-grid/content-alignment.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-grid/wrap-content-greater-than-parent.json',
|
||||
'example/assets/test_data/snapshot_test_data/div-grid/match-parent-items-with-margins.json'
|
||||
].map(
|
||||
(e) => _SkipTest(
|
||||
e,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
Reference in New Issue
Block a user