VideoShopFlutter constructor
const
VideoShopFlutter({
- Key? key,
- required List<
Map< listData,String, dynamic> > - Widget customVideoInfo(
- VideoModel? video
- Widget followWidget(
- VideoModel? video
- Widget likeWidget(
- VideoModel? video,
- dynamic ()
- Widget commentWidget(
- VideoModel? video
- Widget buyWidget(
- VideoModel? video
- Widget viewWidget(
- VideoModel? video,
- int index
- required int pageSize,
- required dynamic loadMore(),
- EdgeInsetsGeometry? informationPadding,
- required List<
String> videoWatched, - int? lastSeenPage,
- EdgeInsetsGeometry? actionsPadding,
- AlignmentGeometry? informationAlign,
- AlignmentGeometry? actionsAlign,
- dynamic updateLastSeenPage(
- int lastSeenPage
- 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);