videoIndicator method

  1. @override
Widget videoIndicator(
  1. BuildContext context,
  2. AssetEntity asset
)
override

Videos often contains various of color in the cover, so in order to keep the content visible in most cases, the color of the indicator has been set to Colors.white.

视频封面通常包含各种颜色,为了保证内容在一般情况下可见,此处 将指示器的图标和文字设置为 Colors.white

Implementation

@override
Widget videoIndicator(BuildContext context, AssetEntity asset) {
  return Align(
    alignment: Alignment.bottomCenter,
    child: Container(
      width: double.maxFinite,
      height: 26,
      padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 2),
      decoration: BoxDecoration(
        gradient: LinearGradient(
          begin: AlignmentDirectional.bottomCenter,
          end: AlignmentDirectional.topCenter,
          colors: <Color>[theme.splashColor, Colors.transparent],
        ),
      ),
      child: Row(
        children: <Widget>[
          const Icon(Icons.videocam, size: 22, color: Colors.white),
          Expanded(
            child: Padding(
              padding: const EdgeInsetsDirectional.only(start: 4),
              child: ScaleText(
                textDelegate.durationIndicatorBuilder(
                  Duration(seconds: asset.duration),
                ),
                style: const TextStyle(color: Colors.white, fontSize: 15),
                strutStyle: const StrutStyle(
                  forceStrutHeight: true,
                  height: 1.4,
                ),
                maxLines: 1,
                maxScaleFactor: 1.2,
                semanticsLabel:
                    semanticsTextDelegate.durationIndicatorBuilder(
                  Duration(seconds: asset.duration),
                ),
              ),
            ),
          ),
        ],
      ),
    ),
  );
}