@@ -85,32 +85,23 @@ class CommonUtils {
8585
8686 static pushTheme (Store store, int index) {
8787 ThemeData themeData;
88- switch (index) {
89- case 0 :
90- themeData = new ThemeData (primarySwatch: GSYColors .primarySwatch);
91- break ;
92- case 1 :
93- themeData = new ThemeData (primarySwatch: Colors .brown);
94- break ;
95- case 2 :
96- themeData = new ThemeData (primarySwatch: Colors .blue);
97- break ;
98- case 3 :
99- themeData = new ThemeData (primarySwatch: Colors .teal);
100- break ;
101- case 4 :
102- themeData = new ThemeData (primarySwatch: Colors .amber);
103- break ;
104- case 5 :
105- themeData = new ThemeData (primarySwatch: Colors .blueGrey);
106- break ;
107- case 6 :
108- themeData = new ThemeData (primarySwatch: Colors .deepOrange);
109- break ;
110- }
88+ List <Color > colors = getThemeListColor ();
89+ themeData = new ThemeData (primarySwatch: colors[index]);
11190 store.dispatch (new RefreshThemeDataAction (themeData));
11291 }
11392
93+ static List <Color > getThemeListColor () {
94+ return [
95+ GSYColors .primarySwatch,
96+ Colors .brown,
97+ Colors .blue,
98+ Colors .teal,
99+ Colors .amber,
100+ Colors .blueGrey,
101+ Colors .deepOrange,
102+ ];
103+ }
104+
114105 static const IMAGE_END = [".png" , ".jpg" , ".jpeg" , ".gif" , ".svg" ];
115106
116107 static isImageEnd (path) {
@@ -132,7 +123,7 @@ class CommonUtils {
132123 if (url == null && url.length == 0 ) return ;
133124 Uri parseUrl = Uri .parse (url);
134125 bool isImage = isImageEnd (parseUrl.toString ());
135- if (parseUrl.toString ().endsWith ("?raw=true" )) {
126+ if (parseUrl.toString ().endsWith ("?raw=true" )) {
136127 isImage = isImageEnd (parseUrl.toString ().replaceAll ("?raw=true" , "" ));
137128 }
138129 if (isImage) {
@@ -165,8 +156,7 @@ class CommonUtils {
165156 if (url.startsWith ("http" )) {
166157 NavigatorUtils .goGSYWebView (context, url, title);
167158 } else {
168- NavigatorUtils .goGSYWebView (
169- context, new Uri .dataFromString (url, mimeType: 'text/html' , encoding: Encoding .getByName ("utf-8" )).toString (), title);
159+ NavigatorUtils .goGSYWebView (context, new Uri .dataFromString (url, mimeType: 'text/html' , encoding: Encoding .getByName ("utf-8" )).toString (), title);
170160 }
171161 }
172162
@@ -237,8 +227,14 @@ class CommonUtils {
237227 });
238228 }
239229
240- static Future <Null > showCommitOptionDialog (BuildContext context, List <String > commitMaps, ValueChanged <int > onTap,
241- {width = 250.0 , height = 400.0 }) {
230+ static Future <Null > showCommitOptionDialog (
231+ BuildContext context,
232+ List <String > commitMaps,
233+ ValueChanged <int > onTap, {
234+ width = 250.0 ,
235+ height = 400.0 ,
236+ List <Color > colorList,
237+ }) {
242238 return showDialog (
243239 context: context,
244240 builder: (BuildContext context) {
@@ -260,7 +256,7 @@ class CommonUtils {
260256 maxLines: 2 ,
261257 mainAxisAlignment: MainAxisAlignment .start,
262258 fontSize: 14.0 ,
263- color: Theme .of (context).primaryColor,
259+ color: colorList != null ? colorList[index] : Theme .of (context).primaryColor,
264260 text: commitMaps[index],
265261 textColor: Color (GSYColors .white),
266262 onPress: () {
0 commit comments