1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import 'package:flutter/material.dart';
- import 'package:flutter/rendering.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- class UserAvatar extends StatelessWidget {
- final bool isNetwork;
- final String image;
- final VoidCallback onPressed;
- final double width;
- final double height;
- final EdgeInsetsGeometry padding;
- UserAvatar(
- {this.isNetwork, this.image, this.onPressed, this.width = 30.0, this.height = 30.0, this.padding});
- @override
- Widget build(BuildContext context) {
- return RawMaterialButton(
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- constraints: BoxConstraints(minWidth: 0.0, minHeight: 0.0),
- child: ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(500.0)),
- child: LoadNetworkImage(
- image,
- width: width,
- height: height,
- )
- // this.isNetwork ?
- // FadeInImage.assetNetwork(
- // placeholder: 'assets/images/temporary/avator2.png',
- // //预览图
- // fit: BoxFit.fitWidth,
- // image: image,
- // width: width,
- // height: height,
- // )
- // :Image.asset(
- // image,
- // fit: BoxFit.cover,
- // width: width,
- // height: height,
- // ),
- ),
- onPressed: onPressed
- );
- }
- }
|