11import 'package:flutter/material.dart' ;
2+ import 'package:gsy_github_app_flutter/common/model/User.dart' ;
23import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
34import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart' ;
45import 'package:gsy_github_app_flutter/widget/GSYIConText.dart' ;
@@ -8,6 +9,10 @@ import 'package:gsy_github_app_flutter/widget/GSYIConText.dart';
89 * Date: 2018-07-17
910 */
1011class UserHeaderItem extends StatelessWidget {
12+ final User userInfo;
13+
14+ UserHeaderItem (this .userInfo);
15+
1116 @override
1217 Widget build (BuildContext context) {
1318 return new Column (
@@ -30,7 +35,7 @@ class UserHeaderItem extends StatelessWidget {
3035 placeholder: "static/images/logo.png" ,
3136 //预览图
3237 fit: BoxFit .fitWidth,
33- image: "fffffff" ,
38+ image: userInfo.avatar_url ,
3439 width: 80.0 ,
3540 height: 80.0 ,
3641 ),
@@ -40,26 +45,19 @@ class UserHeaderItem extends StatelessWidget {
4045 child: new Column (
4146 crossAxisAlignment: CrossAxisAlignment .start,
4247 children: < Widget > [
43- new Text ("Login" , style: GSYConstant .normalTextBold),
44- new GSYIConText (
45- GSYICons .REPOS_ITEM_USER ,
46- "Name " ,
47- GSYConstant .subLightSmallText,
48- Color (GSYColors .subLightTextColor),
49- 10.0 ,
50- padding: 3.0 ,
51- ),
48+ new Text (userInfo.login, style: GSYConstant .largeTextWhiteBold),
49+ new Text (userInfo.name, style: GSYConstant .subLightSmallText),
5250 new GSYIConText (
53- GSYICons .REPOS_ITEM_USER ,
54- " company " ,
51+ GSYICons .USER_ITEM_COMPANY ,
52+ userInfo. company == null ? GSYStrings .nothing_now : userInfo.company ,
5553 GSYConstant .subLightSmallText,
5654 Color (GSYColors .subLightTextColor),
5755 10.0 ,
5856 padding: 3.0 ,
5957 ),
6058 new GSYIConText (
61- GSYICons .REPOS_ITEM_USER ,
62- " location " ,
59+ GSYICons .USER_ITEM_LOCATION ,
60+ userInfo. location == null ? GSYStrings .nothing_now : userInfo.location ,
6361 GSYConstant .subLightSmallText,
6462 Color (GSYColors .subLightTextColor),
6563 10.0 ,
@@ -71,19 +69,20 @@ class UserHeaderItem extends StatelessWidget {
7169 ],
7270 ),
7371 new Container (
74- child: new Text (
75- "link" ,
76- style: GSYConstant .subSmallText,
77- maxLines: 3 ,
78- overflow: TextOverflow .ellipsis,
72+ child: new GSYIConText (
73+ GSYICons .USER_ITEM_LINK ,
74+ userInfo.blog == null ? GSYStrings .nothing_now : userInfo.blog,
75+ GSYConstant .subLightSmallText,
76+ Color (GSYColors .subLightTextColor),
77+ 10.0 ,
78+ padding: 3.0 ,
7979 ),
8080 margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
8181 alignment: Alignment .topLeft),
8282 new Container (
8383 child: new Text (
84- "desssssssssssss" ,
85- style: GSYConstant .subSmallText,
86- maxLines: 3 ,
84+ userInfo.bio == null ? GSYStrings .nothing_now : userInfo.bio,
85+ style: GSYConstant .subLightSmallText,
8786 overflow: TextOverflow .ellipsis,
8887 ),
8988 margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
@@ -94,27 +93,31 @@ class UserHeaderItem extends StatelessWidget {
9493 children: < Widget > [
9594 new Expanded (
9695 child: new Center (
97- child: new Text ("fff \n ff" ),
96+ child: new Text ("仓库 \n " + userInfo.public_repos. toString (), textAlign : TextAlign .center, style : GSYConstant .subSmallText ),
9897 ),
9998 ),
10099 new Expanded (
101100 child: new Center (
102- child: new Text ("fff \n ff" ),
101+ child: new Text ("粉丝 \n " + userInfo.followers. toString (), textAlign : TextAlign .center, style : GSYConstant .subSmallText ),
103102 ),
104103 ),
105104 new Expanded (
106105 child: new Center (
107- child: new Text ("fff\n ff" ),
106+ child: new Text (
107+ "关注\n " + userInfo.following.toString (),
108+ textAlign: TextAlign .center,
109+ style: GSYConstant .subSmallText,
110+ ),
108111 ),
109112 ),
110113 new Expanded (
111114 child: new Center (
112- child: new Text ("fff \n ff" ),
115+ child: new Text ("星标 \n ---" , textAlign : TextAlign .center, style : GSYConstant .subSmallText ),
113116 ),
114117 ),
115118 new Expanded (
116119 child: new Center (
117- child: new Text ("fff \n ff" ),
120+ child: new Text ("荣耀 \n ---" , textAlign : TextAlign .center, style : GSYConstant .subSmallText ),
118121 ),
119122 ),
120123 ],
0 commit comments