user_avatat.dart 1.6 KB

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