forked from CarGuo/gsy_github_app_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGSYUserIconWidget.dart
More file actions
37 lines (33 loc) · 1.08 KB
/
GSYUserIconWidget.dart
File metadata and controls
37 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import 'package:flutter/material.dart';
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
/**
* 头像Icon
* Created by guoshuyu
* Date: 2018-07-30
*/
class GSYUserIconWidget extends StatelessWidget {
final String image;
final VoidCallback onPressed;
final double width;
final double height;
final EdgeInsetsGeometry padding;
GSYUserIconWidget({this.image, this.onPressed, this.width = 30.0, this.height = 30.0, this.padding});
@override
Widget build(BuildContext context) {
return new RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: padding ?? const EdgeInsets.only(top: 4.0, right: 5.0, left: 5.0),
constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0),
child: new ClipOval(
child: new FadeInImage.assetNetwork(
placeholder: GSYICons.DEFAULT_USER_ICON,
//预览图
fit: BoxFit.fitWidth,
image: image,
width: width,
height: height,
),
),
onPressed: onPressed);
}
}