import 'package:shimmer/shimmer.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_comm/util/extension/color.dart';

///
/// 登陆页面的骨架屏
///
class LoginAccountSkeleton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: HexColor.fromHex('#FFFFFF'),
        elevation: 0,
        title: Text(
          '登录',
          style: TextStyle(color: HexColor.fromHex('#333333')),
        ),
        centerTitle: true,
        leading: IconButton(
          icon: Icon(
            Icons.arrow_back_ios,
            size: 22,
            color: HexColor.fromHex('#333333'),
          ),
          onPressed: () {},
        ),
      ),
      body: Container(
        padding: const EdgeInsets.symmetric(horizontal: 27.5),
        width: double.infinity,
        height: double.infinity,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            /// 标题
            Padding( padding: const EdgeInsets.only(top: 40), child: _shimmerWidget(width: 175, height: 20),),
            Padding( padding: const EdgeInsets.only(top: 30), child: _shimmerWidget(width: 320, height: 42),),
            Padding( padding: const EdgeInsets.only(top: 15), child: _shimmerWidget(width: 320, height: 42),),
            Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.only(top: 15), child: _shimmerWidget(width: 72, height: 13),)),
            Padding( padding: const EdgeInsets.only(top: 30), child: _shimmerWidget(width: 320, height: 52.7, radius: 30),),
            Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.only(top: 12.5), child: _shimmerWidget(width: 220, height: 15),)),
            Expanded(
              child: Align(
                alignment: Alignment.bottomCenter,
                child: Padding(
                  padding: const EdgeInsets.only(bottom: 25),
                  child: _shimmerWidget(width: 132, 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)),
      ),
    );
  }
}
