11import 'package:flutter/material.dart' ;
2+ import 'package:flutter_spinkit/flutter_spinkit.dart' ;
3+ import 'package:flutter_svg/flutter_svg.dart' ;
24import 'package:gsy_github_app_flutter/common/model/User.dart' ;
35import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
46import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
@@ -68,6 +70,43 @@ class UserHeaderItem extends StatelessWidget {
6870 });
6971 }
7072
73+ _renderChart (context) {
74+ double height = 140.0 ;
75+ double width = 3 * MediaQuery .of (context).size.width / 2 ;
76+ return userInfo.login != null
77+ ? new Card (
78+ margin: EdgeInsets .only (top: 0.0 , left: 10.0 , right: 10.0 , bottom: 10.0 ),
79+ color: Colors .white,
80+ child: new SingleChildScrollView (
81+ scrollDirection: Axis .horizontal,
82+ child: new Container (
83+ padding: EdgeInsets .only (left: 10.0 , right: 10.0 ),
84+ width: width,
85+ height: height,
86+ child: new SvgPicture .network (
87+ CommonUtils .getUserChartAddress (userInfo.login),
88+ width: width,
89+ height: height - 10 ,
90+ allowDrawingOutsideViewBox: true ,
91+ placeholderBuilder: (BuildContext context) => new Container (
92+ height: height / 2 ,
93+ width: width,
94+ child: Center (
95+ child: const SpinKitRipple (color: Color (GSYColors .primaryValue)),
96+ ),
97+ ),
98+ ),
99+ ),
100+ ),
101+ )
102+ : new Container (
103+ height: height,
104+ child: Center (
105+ child: const SpinKitRipple (color: Color (GSYColors .primaryValue)),
106+ ),
107+ );
108+ }
109+
71110 @override
72111 Widget build (BuildContext context) {
73112 return new Column (
@@ -91,7 +130,7 @@ class UserHeaderItem extends StatelessWidget {
91130 placeholder: GSYICons .DEFAULT_USER_ICON ,
92131 //预览图
93132 fit: BoxFit .fitWidth,
94- image: userInfo.avatar_url ?? GSYICons .DEFAULT_REMOTE_PIC ,
133+ image: userInfo.avatar_url ?? GSYICons .DEFAULT_REMOTE_PIC ,
95134 width: 80.0 ,
96135 height: 80.0 ,
97136 ),
@@ -217,6 +256,7 @@ class UserHeaderItem extends StatelessWidget {
217256 ),
218257 margin: new EdgeInsets .only (top: 15.0 , bottom: 15.0 , left: 12.0 ),
219258 alignment: Alignment .topLeft),
259+ _renderChart (context),
220260 ],
221261 );
222262 }
0 commit comments