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 PositionedDirectional(
    start: 0,
    end: 0,
    bottom: 0,
    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.dividerColor, Colors.transparent],
        ),
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          const Icon(Icons.videocam, size: 22, color: Colors.white),
          Expanded(
            child: Padding(
              padding: const EdgeInsetsDirectional.only(start: 4),
              child: ScaleText(
                Constants.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,
              ),
            ),
          ),
        ],
      ),
    ),
  );
}