基础库
 
 
 
 
 

70 lines
2.5 KiB

  1. import 'package:shimmer/shimmer.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:zhiying_comm/util/color.dart';
  4. ///
  5. /// 登陆页面的骨架屏
  6. ///
  7. class LoginAccountSkeleton extends StatelessWidget {
  8. @override
  9. Widget build(BuildContext context) {
  10. return Scaffold(
  11. appBar: AppBar(
  12. backgroundColor: HexColor.fromHex('#FFFFFF'),
  13. elevation: 0,
  14. title: Text(
  15. '登录',
  16. style: TextStyle(color: HexColor.fromHex('#333333')),
  17. ),
  18. centerTitle: true,
  19. leading: IconButton(
  20. icon: Icon(
  21. Icons.arrow_back_ios,
  22. size: 22,
  23. color: HexColor.fromHex('#333333'),
  24. ),
  25. onPressed: () {},
  26. ),
  27. ),
  28. body: Container(
  29. padding: const EdgeInsets.symmetric(horizontal: 27.5),
  30. width: double.infinity,
  31. height: double.infinity,
  32. child: Column(
  33. crossAxisAlignment: CrossAxisAlignment.start,
  34. children: <Widget>[
  35. /// 标题
  36. Padding( padding: const EdgeInsets.only(top: 40), child: _shimmerWidget(width: 175, height: 20),),
  37. Padding( padding: const EdgeInsets.only(top: 30), child: _shimmerWidget(width: 320, height: 42),),
  38. Padding( padding: const EdgeInsets.only(top: 15), child: _shimmerWidget(width: 320, height: 42),),
  39. Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.only(top: 15), child: _shimmerWidget(width: 72, height: 13),)),
  40. Padding( padding: const EdgeInsets.only(top: 30), child: _shimmerWidget(width: 320, height: 52.7, radius: 30),),
  41. Align( alignment: Alignment.center, child: Padding( padding: const EdgeInsets.only(top: 12.5), child: _shimmerWidget(width: 220, height: 15),)),
  42. Expanded(
  43. child: Align(
  44. alignment: Alignment.bottomCenter,
  45. child: Padding(
  46. padding: const EdgeInsets.only(bottom: 25),
  47. child: _shimmerWidget(width: 132, height: 15),
  48. ),
  49. ),
  50. )
  51. ],
  52. ),
  53. ),
  54. );
  55. }
  56. Widget _shimmerWidget({double width, double height, double radius = 0}) {
  57. return Shimmer.fromColors(
  58. baseColor: Colors.grey[300],
  59. highlightColor: Colors.grey[100],
  60. child: Container(
  61. width: width,
  62. height: height,
  63. decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(radius)),
  64. ),
  65. );
  66. }
  67. }