- Print
Shortform API
- Print
Installing a short-form
https://pub.dev/packages/shoplive_player/install
Depend on it
Run this command:
With Flutter:
$ flutter pub add shoplive_player
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
shoplive_player: ^1.6.5
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:shoplive_player/shoplive_player.dart';
Run a short-form
void play({required ShopLiveShortformCollectionData data})
to play back the Shortform details.
ShopLiveShortformCollectionData
If you put one or more of the field values in , you can play the related detail screen.
ShopLiveShortformCollectionData
Property name | Type | Description |
---|---|---|
shortsId | String? | Short-form unique IDs |
shortsCollectionId | String? | Short-form group ID |
shortsSrn | String? | Global resource name for managing the resources you allocate to the short form. This is the value that ShopLive uses internally. |
tags | [String]? | Values that can be searched for related tags |
tagSearchOperator | ShopLiveTagSearchOperator? | Tag Search Options
|
brands | [String]? | Values that can be searched for related brands (title, all identifiers) |
shuffle | Bool? // default = false | Shuffleable value (Default: |
referrer | String? | Values that can be traced |
isMuted | Bool? | Mute short-form (Default: false) |
delegate | ShopLiveShortformReceiveHandlerDelegate? | Delegate to receive various events from ShopLiveShortform |
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.play(data: data);
Ending a short-form
void close()
to exit the Shortform detail screen.
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.close();
Ability to click on short-form products
Stream<ShopLiveShortformProductData> onClickProduct
Through Shoplive we develop the ability to click products directly in Shortform. Create a product refer to the guide.
ShopLiveShortformProductData
Property | Type | Description |
---|---|---|
brand | String? | Brand information of the product |
currency | String? | Currency of the commodity |
description | String? | Description of the product |
discountPrice | Double? | Discounted price of the product |
discountRate | Double? | Discount rate of the product |
imageUrl | String? | Product image URL |
name | String? | Product Name |
originalPrice | Double? | The regular price of the product |
productId | Long? | A unique ID for the product. Automatically issued at the time of product registration |
showPrice | Boolean | The visible price of the goods |
sku | String? | Product-specific SKU information |
url | String? | The URL of the product detail page |
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.onClickProduct.listen((data) {
_showToast("onClickProduct : ${data.productId} ");
});
Short-form banner clickability
Stream<ShopliveShortformUrlData> onClickBanner
Through Shoplive you develop banner clicks directly in Shortform. Create product banner refer to the guide.
ShopLiveShortformProductData
Property | Type | Description |
---|---|---|
brand | String? | Brand information of the product |
currency | String? | Currency of the commodity |
description | String? | Description of the product |
discountPrice | Double? | Discounted price of the product |
discountRate | Double? | Discount rate of the product |
imageUrl | String? | Product image URL |
name | String? | Product Name |
originalPrice | Double? | The regular price of the product |
productId | Long? | A unique ID for the product. Automatically issued at the time of product registration |
showPrice | Boolean | The visible price of the goods |
sku | String? | Product-specific SKU information |
url | String? | The URL of the product detail page |
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.onClickBanner.listen((data) {
_showToast("onClickBanner : ${data.url} ");
});
Click to share short-form
Stream<ShopLiveShortformShareData> onShare
Develop a Share click feature directly from Shoplive Shortform.
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.onShare.listen((data) {
_showToast("onClickShare : ${data.shortsId}, ${data.title} ");
});
Short-form start notification function
Stream<ShopLiveBaseData> onStart
lets you know if Shoplive Shortform has started.
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.onStart.listen((data) {
_showToast("onShortformStarted");
});
Short-form end notification function
Stream<ShopLiveBaseData> onClose
lets you know if your Shoplive Shortform has been shut down.
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.onClose.listen((data) {
_showToast("onShortformClosed");
});
Short-form log feature
Stream<ShopliveShortformLogData> log
allows Shoplive Shortform to check the logs.
late final _shopLiveShortformPlugin = ShopLiveShortform();
_shopLiveShortformPlugin.log.listen((data) {
_showToast("onShortformEventLog : ${data.command}, ${data.payload} ");
});