@@ -3,16 +3,19 @@ import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
33import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
44import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart' ;
55import 'package:gsy_github_app_flutter/widget/GSYIConText.dart' ;
6+ import 'package:gsy_github_app_flutter/widget/GSYSelectItemWidget.dart' ;
67
78/**
89 * 仓库详情信息头控件
910 * Created by guoshuyu
1011 * Date: 2018-07-18
1112 */
1213class ReposHeaderItem extends StatelessWidget {
14+ final SelectItemChanged selectItemChanged;
15+
1316 final ReposHeaderViewModel reposHeaderViewModel;
1417
15- ReposHeaderItem (this .reposHeaderViewModel) : super ();
18+ ReposHeaderItem (this .reposHeaderViewModel, this .selectItemChanged ) : super ();
1619
1720 _getBottomItem (IconData icon, String text) {
1821 return new Expanded (
@@ -40,65 +43,71 @@ class ReposHeaderItem extends StatelessWidget {
4043
4144 String infoText = createStr + ((reposHeaderViewModel.push_at != null ) ? updateStr : '' );
4245
43- return new Container (
44- child: new GSYCardItem (
45- color: new Color (GSYColors .primaryValue),
46- child: new Padding (
47- padding: new EdgeInsets .only (left: 10.0 , top: 10.0 , right: 10.0 , bottom: 10.0 ),
48- child: new Column (
49- mainAxisSize: MainAxisSize .min,
50- children: < Widget > [
51- new Row (
52- children: < Widget > [
53- new RawMaterialButton (
54- constraints: new BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
55- padding: new EdgeInsets .all (0.0 ),
56- onPressed: () {},
57- child: new Text (reposHeaderViewModel.ownerName, style: GSYConstant .normalTextMitWhiteBold),
58- ),
59- new Text (" /" , style: GSYConstant .normalTextMitWhiteBold),
60- new Text (" " + reposHeaderViewModel.repositoryName, style: GSYConstant .normalTextMitWhiteBold),
61- ],
62- ),
63- new Padding (padding: new EdgeInsets .all (5.0 )),
64- new Row (
65- children: < Widget > [
66- new Text (reposHeaderViewModel.repositoryType != null ? reposHeaderViewModel.repositoryType : "--" ,
67- style: GSYConstant .subLightSmallText),
68- new Container (width: 5.3 , height: 1.0 ),
69- new Text (reposHeaderViewModel.repositorySize != null ? reposHeaderViewModel.repositorySize : "--" ,
70- style: GSYConstant .subLightSmallText),
71- new Container (width: 5.3 , height: 1.0 ),
72- new Text (reposHeaderViewModel.license != null ? reposHeaderViewModel.license : "--" , style: GSYConstant .subLightSmallText),
73- ],
74- ),
75- new Padding (padding: new EdgeInsets .all (5.0 )),
76- new Container (
77- child: new Text (reposHeaderViewModel.repositoryDes, style: GSYConstant .subSmallText),
78- margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
79- alignment: Alignment .topLeft),
80- new Container (
81- child: new Text (infoText, style: GSYConstant .subSmallText),
82- margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 , right: 5.0 ),
83- alignment: Alignment .topRight),
84- new Divider (
85- color: Color (GSYColors .subTextColor),
86- ),
87- new Padding (
88- padding: new EdgeInsets .all (5.0 ),
89- child: new Row (
90- crossAxisAlignment: CrossAxisAlignment .center,
91- mainAxisAlignment: MainAxisAlignment .center,
92- children: < Widget > [
93- _getBottomItem (GSYICons .REPOS_ITEM_STAR , reposHeaderViewModel.repositoryStar),
94- _getBottomItem (GSYICons .REPOS_ITEM_FORK , reposHeaderViewModel.repositoryFork),
95- _getBottomItem (GSYICons .REPOS_ITEM_WATCH , reposHeaderViewModel.repositoryWatch),
96- _getBottomItem (GSYICons .REPOS_ITEM_ISSUE , reposHeaderViewModel.repositoryIssue),
97- ],
98- )),
99- ],
100- ),
101- )),
46+ return new Column (
47+ children: < Widget > [
48+ new GSYCardItem (
49+ color: new Color (GSYColors .primaryValue),
50+ child: new Padding (
51+ padding: new EdgeInsets .only (left: 10.0 , top: 10.0 , right: 10.0 , bottom: 10.0 ),
52+ child: new Column (
53+ mainAxisSize: MainAxisSize .min,
54+ children: < Widget > [
55+ new Row (
56+ children: < Widget > [
57+ new RawMaterialButton (
58+ constraints: new BoxConstraints (minWidth: 0.0 , minHeight: 0.0 ),
59+ padding: new EdgeInsets .all (0.0 ),
60+ onPressed: () {},
61+ child: new Text (reposHeaderViewModel.ownerName, style: GSYConstant .normalTextMitWhiteBold),
62+ ),
63+ new Text (" /" , style: GSYConstant .normalTextMitWhiteBold),
64+ new Text (" " + reposHeaderViewModel.repositoryName, style: GSYConstant .normalTextMitWhiteBold),
65+ ],
66+ ),
67+ new Padding (padding: new EdgeInsets .all (5.0 )),
68+ new Row (
69+ children: < Widget > [
70+ new Text (reposHeaderViewModel.repositoryType != null ? reposHeaderViewModel.repositoryType : "--" ,
71+ style: GSYConstant .subLightSmallText),
72+ new Container (width: 5.3 , height: 1.0 ),
73+ new Text (reposHeaderViewModel.repositorySize != null ? reposHeaderViewModel.repositorySize : "--" ,
74+ style: GSYConstant .subLightSmallText),
75+ new Container (width: 5.3 , height: 1.0 ),
76+ new Text (reposHeaderViewModel.license != null ? reposHeaderViewModel.license : "--" , style: GSYConstant .subLightSmallText),
77+ ],
78+ ),
79+ new Padding (padding: new EdgeInsets .all (5.0 )),
80+ new Container (
81+ child: new Text (reposHeaderViewModel.repositoryDes, style: GSYConstant .subSmallText),
82+ margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
83+ alignment: Alignment .topLeft),
84+ new Container (
85+ child: new Text (infoText, style: GSYConstant .subSmallText),
86+ margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 , right: 5.0 ),
87+ alignment: Alignment .topRight),
88+ new Divider (
89+ color: Color (GSYColors .subTextColor),
90+ ),
91+ new Padding (
92+ padding: new EdgeInsets .all (5.0 ),
93+ child: new Row (
94+ crossAxisAlignment: CrossAxisAlignment .center,
95+ mainAxisAlignment: MainAxisAlignment .center,
96+ children: < Widget > [
97+ _getBottomItem (GSYICons .REPOS_ITEM_STAR , reposHeaderViewModel.repositoryStar),
98+ _getBottomItem (GSYICons .REPOS_ITEM_FORK , reposHeaderViewModel.repositoryFork),
99+ _getBottomItem (GSYICons .REPOS_ITEM_WATCH , reposHeaderViewModel.repositoryWatch),
100+ _getBottomItem (GSYICons .REPOS_ITEM_ISSUE , reposHeaderViewModel.repositoryIssue),
101+ ],
102+ )),
103+ ],
104+ ),
105+ )),
106+ new GSYSelectItemWidget ([
107+ GSYStrings .repos_tab_activity,
108+ GSYStrings .repos_tab_commits,
109+ ], selectItemChanged)
110+ ],
102111 );
103112 }
104113}
0 commit comments