VideoShopFlutter constructor

const VideoShopFlutter({
  1. Key? key,
  2. required List<Map<String, dynamic>> listData,
  3. Widget customVideoInfo(
    1. VideoModel? video
    )?,
  4. Widget followWidget(
    1. VideoModel? video
    )?,
  5. Widget likeWidget(
    1. VideoModel? video,
    2. dynamic (
      1. int likes,
      2. bool liked
      )
    )?,
  6. Widget commentWidget(
    1. VideoModel? video
    )?,
  7. Widget shareWidget(
    1. VideoModel? video
    )?,
  8. Widget buyWidget(
    1. VideoModel? video
    )?,
  9. Widget viewWidget(
    1. VideoModel? video,
    2. int index
    )?,
  10. required int pageSize,
  11. required dynamic loadMore(
    1. int page,
    2. int pageSize
    ),
  12. EdgeInsetsGeometry? informationPadding,
  13. required List<String> videoWatched,
  14. int? lastSeenPage,
  15. EdgeInsetsGeometry? actionsPadding,
  16. AlignmentGeometry? informationAlign,
  17. AlignmentGeometry? actionsAlign,
  18. dynamic updateLastSeenPage(
    1. int lastSeenPage
    )?,
  19. bool? enableBackgroundContent,
})

Create Video Player Layout Like Tiktok.

The listData, pageSize, loadMore are required.

The others arguments use for custom UI (not required),

if you want to hide them, you can return SizeBox.shrink().

Note: the listData is a list of Map, each Map is a Video object and

video object required some field of data like this:

{
  'id': 123,
  'url': 'https://video.mp4',
  'thumbnail': 'https://thumbnail.jpg',
  'likes': 100,
  'liked': true,
}

Please follow above format data.

The pageSize is size of list data every time load more data,

it affects when to load more data.

The loadMore is a function to load more data,

it is called every time current PageView is at position:

listData.length - (pageSize/2)

Example:

VideoShopFlutter(
      listData: data,
      pageSize: 10,
      loadMore: (){
        debugPrint("load more...");
        setState(() {
          data = [...data, ...playList];
        });
      }
 )

Implementation

const VideoShopFlutter({
  Key? key,
  required this.listData,
  this.customVideoInfo,
  this.followWidget,
  this.likeWidget,
  this.commentWidget,
  this.shareWidget,
  this.buyWidget,
  this.viewWidget,
  required this.pageSize,
  required this.loadMore,
  this.informationPadding,
  required this.videoWatched,
  this.lastSeenPage,
  this.actionsPadding,
  this.informationAlign,
  this.actionsAlign,
  this.updateLastSeenPage,
  this.enableBackgroundContent,
}) : super(key: key);