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

class WalletIncomeSkeleton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
      padding: EdgeInsets.only(left: 15, right: 15, top: 10, bottom: 10),
      decoration: BoxDecoration(
          color: Colors.white, borderRadius: BorderRadius.circular(7.5)),
      child: Shimmer.fromColors(
          baseColor: Colors.grey[300],
          highlightColor: Colors.grey[100],
          child: Column(
            children: <Widget>[
              Container(
                width: double.infinity,
                child: _createTab(),
              ),
              Container(
                margin: EdgeInsets.only(top: 6),
                width: double.infinity,
                child: _createTags(),
              ),
              Container(
                margin: EdgeInsets.only(top: 6),
                height: 64,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(7.5),
                    color: Colors.white),
              ),
              _createDataRow(),
              _createDataRow(),
              _createDataRow(),
            ],
          )),
    );
  }

  Widget _createTab() {
    return Row(
      children: List.generate(5, (index) {
        return Expanded(
          child: Container(
            height: 14,
            margin: EdgeInsets.only(left: 10, right: 10, top: 4, bottom: 4),
            color: Colors.white,
          ),
        );
      }),
    );
  }

  Widget _createTags() {
    return Row(
      children: List.generate(5, (index) {
        return Expanded(
          child: Container(
            height: 20,
            margin: EdgeInsets.only(left: 10, right: 10, top: 4, bottom: 4),
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(10)),
          ),
        );
      }),
    );
  }

  Widget _createDataRow() {
    return Column(
      children: <Widget>[
        Container(
          margin: EdgeInsets.only(top: 8, bottom: 2),
          width: 64,
          height: 18,
          color: Colors.white,
        ),
        Row(
          children: <Widget>[
            Expanded(
              child: Container(
                margin: EdgeInsets.only(top: 6, right: 5),
                height: 64,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(7.5),
                    color: Colors.white),
              ),
            ),
            Expanded(
              child: Container(
                margin: EdgeInsets.only(top: 6, left: 5),
                height: 64,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(7.5),
                    color: Colors.white),
              ),
            )
          ],
        )
      ],
    );
  }
}
