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

class StoreSkeleton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 50,
      margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20),
      width: double.infinity,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[

          /// 图片
          _shimmerWidget(width: 50, height: 50),

          const SizedBox(width: 10),
          ///
          Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[

              _shimmerWidget(width: 150, height: 20),
              _shimmerWidget(width: 50, height: 15)

            ],
          ),

        ],
      ),
    );
  }

  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)),
      ),
    );
  }
}
