audioItemBuilder method

  1. @override
Widget audioItemBuilder(
  1. BuildContext context,
  2. int index,
  3. AssetEntity asset
)
override

The item builder for audio type of asset. 音频资源的部件构建

Implementation

@override
Widget audioItemBuilder(BuildContext context, int index, AssetEntity asset) {
  return Stack(
    children: <Widget>[
      Container(
        width: double.maxFinite,
        alignment: AlignmentDirectional.topStart,
        padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 8),
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: AlignmentDirectional.topCenter,
            end: AlignmentDirectional.bottomCenter,
            colors: <Color>[theme.dividerColor, Colors.transparent],
          ),
        ),
        child: Padding(
          padding: const EdgeInsetsDirectional.only(start: 4, end: 30),
          child: ScaleText(
            asset.title ?? '',
            style: const TextStyle(fontSize: 16),
            maxLines: 3,
            overflow: TextOverflow.ellipsis,
          ),
        ),
      ),
      const Align(
        alignment: AlignmentDirectional(0.9, 0.8),
        child: Icon(Icons.audiotrack),
      ),
      audioIndicator(context, asset),
    ],
  );
}