// Author: fengshengxiong
// Date: 2024/6/21
// Description: 单曲Item

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:tone_snap/components/network_image_widget.dart';
import 'package:tone_snap/data/sideb/models/home_model.dart';
import 'package:tone_snap/generated/assets.dart';
import 'package:tone_snap/utils/obj_util.dart';

class AtvItem extends StatelessWidget {
  const AtvItem({super.key, required this.content, required this.onTap});

  final Content content;
  final Function() onTap;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(16).r,
        child: SizedBox(
          width: 168.w,
          height: double.infinity,
          child: Stack(
            children: [
              NetworkImageWidget(
                url: content.thumbnail,
                width: double.infinity,
                height: double.infinity,
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: Container(
                  width: double.infinity,
                  height: 50.h,
                  color: const Color(0xB3000000),
                  child: ClipRect(
                    child: BackdropFilter(
                      filter: ImageFilter.blur(sigmaX: 31.0, sigmaY: 31.0),
                      child: Padding(
                        padding: const EdgeInsets.only(left: 12, right: 14).w,
                        child: Row(
                          children: [
                            Expanded(
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text(
                                    ObjUtil.getStr(content.title),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis,
                                    style: TextStyle(
                                      color: Colors.white,
                                      fontSize: 14.sp,
                                      fontWeight: FontWeight.w600,
                                    ),
                                  ),
                                  Text(
                                    ObjUtil.getStr(content.subTitle),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis,
                                    style: TextStyle(
                                      color: const Color(0xFFA3A3A3),
                                      fontSize: 11.sp,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Image.asset(
                              Assets.sideBItemPlayer1,
                              width: 30.w,
                              height: 22.h,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
