user_avatat.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/rendering.dart';
  3. import 'package:liftmanager/widgets/load_image.dart';
  4. class UserAvatar extends StatelessWidget {
  5. final bool isNetwork;
  6. final String image;
  7. final VoidCallback onPressed;
  8. final double width;
  9. final double height;
  10. final EdgeInsetsGeometry padding;
  11. UserAvatar(
  12. {this.isNetwork, this.image, this.onPressed, this.width = 30.0, this.height = 30.0, this.padding});
  13. @override
  14. Widget build(BuildContext context) {
  15. return RawMaterialButton(
  16. materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
  17. constraints: BoxConstraints(minWidth: 0.0, minHeight: 0.0),
  18. child: ClipRRect(
  19. borderRadius: BorderRadius.all(Radius.circular(500.0)),
  20. child: LoadNetworkImage(
  21. image,
  22. width: width,
  23. height: height,
  24. )
  25. // this.isNetwork ?
  26. // FadeInImage.assetNetwork(
  27. // placeholder: 'assets/images/temporary/avator2.png',
  28. // //预览图
  29. // fit: BoxFit.fitWidth,
  30. // image: image,
  31. // width: width,
  32. // height: height,
  33. // )
  34. // :Image.asset(
  35. // image,
  36. // fit: BoxFit.cover,
  37. // width: width,
  38. // height: height,
  39. // ),
  40. ),
  41. onPressed: onPressed
  42. );
  43. }
  44. }