@@ -32,7 +32,7 @@ class UserHeaderItem extends StatelessWidget {
3232 UserHeaderItem (this .userInfo, this .beStaredCount, this .themeColor,
3333 {this .notifyColor, this .refreshCallBack, this .orgList});
3434
35- ///通知ICon
35+ ///通知Icon
3636 _getNotifyIcon (BuildContext context, Color color) {
3737 if (notifyColor == null ) {
3838 return Container ();
@@ -105,6 +105,95 @@ class UserHeaderItem extends StatelessWidget {
105105 return Row (children: list);
106106 }
107107
108+ _renderImg (context) {
109+ return new RawMaterialButton (
110+ onPressed: () {
111+ if (userInfo.avatar_url != null ) {
112+ NavigatorUtils .gotoPhotoViewPage (context, userInfo.avatar_url);
113+ }
114+ },
115+ materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
116+ padding: const EdgeInsets .all (0.0 ),
117+ constraints: const BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
118+ child: new ClipOval (
119+ child: new FadeInImage .assetNetwork (
120+ placeholder: GSYICons .DEFAULT_USER_ICON ,
121+ //预览图
122+ fit: BoxFit .fitWidth,
123+ image: userInfo.avatar_url ?? GSYICons .DEFAULT_REMOTE_PIC ,
124+ width: 80.0 ,
125+ height: 80.0 ,
126+ ),
127+ ));
128+ }
129+
130+ _renderUserInfo (context) {
131+ return new Column (
132+ crossAxisAlignment: CrossAxisAlignment .start,
133+ children: < Widget > [
134+ new Row (
135+ children: < Widget > [
136+ ///用户名
137+ new Text (userInfo.login ?? "" ,
138+ style: GSYConstant .largeTextWhiteBold),
139+ _getNotifyIcon (context, notifyColor),
140+ ],
141+ ),
142+ new Text (userInfo.name == null ? "" : userInfo.name,
143+ style: GSYConstant .smallSubLightText),
144+
145+ ///用户组织
146+ new GSYIConText (
147+ GSYICons .USER_ITEM_COMPANY ,
148+ userInfo.company ?? GSYLocalizations .i18n (context).nothing_now,
149+ GSYConstant .smallSubLightText,
150+ GSYColors .subLightTextColor,
151+ 10.0 ,
152+ padding: 3.0 ,
153+ ),
154+
155+ ///用户位置
156+ new GSYIConText (
157+ GSYICons .USER_ITEM_LOCATION ,
158+ userInfo.location ?? GSYLocalizations .i18n (context).nothing_now,
159+ GSYConstant .smallSubLightText,
160+ GSYColors .subLightTextColor,
161+ 10.0 ,
162+ padding: 3.0 ,
163+ ),
164+ ],
165+ );
166+ }
167+
168+ _renderBlog (context) {
169+ return new Container (
170+
171+ ///用户博客
172+ child: new RawMaterialButton (
173+ onPressed: () {
174+ if (userInfo.blog != null ) {
175+ CommonUtils .launchOutURL (userInfo.blog, context);
176+ }
177+ },
178+ materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
179+ padding: const EdgeInsets .all (0.0 ),
180+ constraints: const BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
181+ child: new GSYIConText (
182+ GSYICons .USER_ITEM_LINK ,
183+ userInfo.blog ?? GSYLocalizations .i18n (context).nothing_now,
184+ (userInfo.blog == null )
185+ ? GSYConstant .smallSubLightText
186+ : GSYConstant .smallActionLightText,
187+ GSYColors .subLightTextColor,
188+ 10.0 ,
189+ padding: 3.0 ,
190+ textWidth: MediaQuery .of (context).size.width - 50 ,
191+ ),
192+ ),
193+ margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
194+ alignment: Alignment .topLeft);
195+ }
196+
108197 @override
109198 Widget build (BuildContext context) {
110199 return new GSYCardItem (
@@ -126,98 +215,14 @@ class UserHeaderItem extends StatelessWidget {
126215 crossAxisAlignment: CrossAxisAlignment .start,
127216 children: < Widget > [
128217 ///用户头像
129- new RawMaterialButton (
130- onPressed: () {
131- if (userInfo.avatar_url != null ) {
132- NavigatorUtils .gotoPhotoViewPage (
133- context, userInfo.avatar_url);
134- }
135- },
136- materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
137- padding: const EdgeInsets .all (0.0 ),
138- constraints:
139- const BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
140- child: new ClipOval (
141- child: new FadeInImage .assetNetwork (
142- placeholder: GSYICons .DEFAULT_USER_ICON ,
143- //预览图
144- fit: BoxFit .fitWidth,
145- image: userInfo.avatar_url ??
146- GSYICons .DEFAULT_REMOTE_PIC ,
147- width: 80.0 ,
148- height: 80.0 ,
149- ),
150- )),
218+ _renderImg (context),
151219 new Padding (padding: EdgeInsets .all (10.0 )),
152220 new Expanded (
153- child: new Column (
154- crossAxisAlignment: CrossAxisAlignment .start,
155- children: < Widget > [
156- new Row (
157- children: < Widget > [
158- ///用户名
159- new Text (userInfo.login ?? "" ,
160- style: GSYConstant .largeTextWhiteBold),
161- _getNotifyIcon (context, notifyColor),
162- ],
163- ),
164- new Text (userInfo.name == null ? "" : userInfo.name,
165- style: GSYConstant .smallSubLightText),
166-
167- ///用户组织
168- new GSYIConText (
169- GSYICons .USER_ITEM_COMPANY ,
170- userInfo.company ??
171- GSYLocalizations .i18n (context).nothing_now,
172- GSYConstant .smallSubLightText,
173- GSYColors .subLightTextColor,
174- 10.0 ,
175- padding: 3.0 ,
176- ),
177-
178- ///用户位置
179- new GSYIConText (
180- GSYICons .USER_ITEM_LOCATION ,
181- userInfo.location ??
182- GSYLocalizations .i18n (context).nothing_now,
183- GSYConstant .smallSubLightText,
184- GSYColors .subLightTextColor,
185- 10.0 ,
186- padding: 3.0 ,
187- ),
188- ],
189- ),
221+ child: _renderUserInfo (context),
190222 ),
191223 ],
192224 ),
193- new Container (
194-
195- ///用户博客
196- child: new RawMaterialButton (
197- onPressed: () {
198- if (userInfo.blog != null ) {
199- CommonUtils .launchOutURL (userInfo.blog, context);
200- }
201- },
202- materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
203- padding: const EdgeInsets .all (0.0 ),
204- constraints:
205- const BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
206- child: new GSYIConText (
207- GSYICons .USER_ITEM_LINK ,
208- userInfo.blog ??
209- GSYLocalizations .i18n (context).nothing_now,
210- (userInfo.blog == null )
211- ? GSYConstant .smallSubLightText
212- : GSYConstant .smallActionLightText,
213- GSYColors .subLightTextColor,
214- 10.0 ,
215- padding: 3.0 ,
216- textWidth: MediaQuery .of (context).size.width - 50 ,
217- ),
218- ),
219- margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
220- alignment: Alignment .topLeft),
225+ _renderBlog (context),
221226
222227 ///组织
223228 _renderOrgs (context, orgList),
@@ -243,9 +248,6 @@ class UserHeaderItem extends StatelessWidget {
243248 margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
244249 alignment: Alignment .topLeft),
245250 new Padding (padding: EdgeInsets .only (bottom: 5.0 )),
246- /*new Divider(
247- color: Color(GSYColors.subLightTextColor),
248- ),*/
249251 ],
250252 ),
251253 ));
0 commit comments