import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';

///
/// 商品详情骨架图
///
class GoodsDetailsImgSkeleton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: List.generate(4, (index) => AspectRatio(
        aspectRatio: 1/1,
        child: Container(
          margin: const EdgeInsets.only(top: 7.5, left: 12.5, right: 12.5),
          child: _shimmerWidget(width: double.infinity, height: double.infinity, radius: 5),
        ),
      )),
    );
  }

  Widget _shimmerWidget({double width, double height, double radius = 0}) {
    return Shimmer.fromColors(
      baseColor: Colors.grey[300],
      highlightColor: Colors.grey[100],
      child: Container(
        width: width,
        height: height,
        decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(radius)),
      ),
    );
  }
}
