// Author: fengshengxiong
// Date: 2024/6/21
// Description: 首页专辑/歌单Item

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/models/music_model.dart';
import 'package:tone_snap/utils/obj_util.dart';

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

  final MusicModel musicModel;
  final Function() onTap;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: SizedBox(
        width: 109.w,
        height: 160.h,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            NetworkImageWidget(
              url: musicModel.coverUrl,
              width: 109.w,
              height: 109.w,
              radius: 16.r,
            ),
            const Spacer(),
            Text(
              ObjUtil.getStr(musicModel.title),
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                color: Colors.white,
                fontSize: 14.sp,
              ),
            ),
            SizedBox(height: 2.h),
            Text(
              ObjUtil.getStr(musicModel.subtitle),
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                color: const Color(0xFF666666),
                fontSize: 12.sp,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
