@@ -42,7 +42,8 @@ class CommonUtils {
4242 static double sStaticBarHeight = 0.0 ;
4343
4444 static void initStatusBarHeight (context) async {
45- sStaticBarHeight = await FlutterStatusbar .height / MediaQuery .of (context).devicePixelRatio;
45+ sStaticBarHeight =
46+ await FlutterStatusbar .height / MediaQuery .of (context).devicePixelRatio;
4647 }
4748
4849 static String getDateStr (DateTime date) {
@@ -55,12 +56,16 @@ class CommonUtils {
5556 }
5657
5758 static String getUserChartAddress (String userName) {
58- return Address .graphicHost + GSYColors .primaryValueString.replaceAll ("#" , "" ) + "/" + userName;
59+ return Address .graphicHost +
60+ GSYColors .primaryValueString.replaceAll ("#" , "" ) +
61+ "/" +
62+ userName;
5963 }
6064
6165 ///日期格式转换
6266 static String getNewsTimeStr (DateTime date) {
63- int subTime = DateTime .now ().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
67+ int subTime =
68+ DateTime .now ().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
6469
6570 if (subTime < MILLIS_LIMIT ) {
6671 return "刚刚" ;
@@ -84,9 +89,12 @@ class CommonUtils {
8489 } else {
8590 appDir = await getExternalStorageDirectory ();
8691 }
87- PermissionStatus permission = await PermissionHandler ().checkPermissionStatus (PermissionGroup .storage);
92+ PermissionStatus permission = await PermissionHandler ()
93+ .checkPermissionStatus (PermissionGroup .storage);
8894 if (permission != PermissionStatus .granted) {
89- Map <PermissionGroup , PermissionStatus > permissions = await PermissionHandler ().requestPermissions ([PermissionGroup .storage]);
95+ Map <PermissionGroup , PermissionStatus > permissions =
96+ await PermissionHandler ()
97+ .requestPermissions ([PermissionGroup .storage]);
9098 if (permissions[PermissionGroup .storage] != PermissionStatus .granted) {
9199 return null ;
92100 }
@@ -120,14 +128,16 @@ class CommonUtils {
120128 }
121129
122130 static getFullName (String repository_url) {
123- if (repository_url != null && repository_url.substring (repository_url.length - 1 ) == "/" ) {
131+ if (repository_url != null &&
132+ repository_url.substring (repository_url.length - 1 ) == "/" ) {
124133 repository_url = repository_url.substring (0 , repository_url.length - 1 );
125134 }
126135 String fullName = '' ;
127136 if (repository_url != null ) {
128137 List <String > splicurl = repository_url.split ("/" );
129138 if (splicurl.length > 2 ) {
130- fullName = splicurl[splicurl.length - 2 ] + "/" + splicurl[splicurl.length - 1 ];
139+ fullName =
140+ splicurl[splicurl.length - 2 ] + "/" + splicurl[splicurl.length - 1 ];
131141 }
132142 }
133143 return fullName;
@@ -140,7 +150,6 @@ class CommonUtils {
140150 store.dispatch (new RefreshThemeDataAction (themeData));
141151 }
142152
143-
144153 static getThemeData (Color color) {
145154 return ThemeData (primarySwatch: color, platform: TargetPlatform .android);
146155 }
@@ -191,7 +200,8 @@ class CommonUtils {
191200
192201 static copy (String data, BuildContext context) {
193202 Clipboard .setData (new ClipboardData (text: data));
194- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).option_share_copy_success);
203+ Fluttertoast .showToast (
204+ msg: CommonUtils .getLocale (context).option_share_copy_success);
195205 }
196206
197207 static launchUrl (context, String url) {
@@ -206,7 +216,9 @@ class CommonUtils {
206216 return ;
207217 }
208218
209- if (parseUrl != null && parseUrl.host == "github.com" && parseUrl.path.length > 0 ) {
219+ if (parseUrl != null &&
220+ parseUrl.host == "github.com" &&
221+ parseUrl.path.length > 0 ) {
210222 List <String > pathnames = parseUrl.path.split ("/" );
211223 if (pathnames.length == 2 ) {
212224 //解析人
@@ -232,20 +244,27 @@ class CommonUtils {
232244 NavigatorUtils .goGSYWebView (context, url, title);
233245 } else {
234246 NavigatorUtils .goGSYWebView (
235- context, new Uri .dataFromString (url, mimeType: 'text/html' , encoding: Encoding .getByName ("utf-8" )).toString (), title);
247+ context,
248+ new Uri .dataFromString (url,
249+ mimeType: 'text/html' , encoding: Encoding .getByName ("utf-8" ))
250+ .toString (),
251+ title);
236252 }
237253 }
238254
239255 static launchOutURL (String url, BuildContext context) async {
240256 if (await canLaunch (url)) {
241257 await launch (url);
242258 } else {
243- Fluttertoast .showToast (msg: CommonUtils .getLocale (context).option_web_launcher_error + ": " + url);
259+ Fluttertoast .showToast (
260+ msg: CommonUtils .getLocale (context).option_web_launcher_error +
261+ ": " +
262+ url);
244263 }
245264 }
246265
247266 static Future <Null > showLoadingDialog (BuildContext context) {
248- return showDialog (
267+ return NavigatorUtils . showGSYDialog (
249268 context: context,
250269 builder: (BuildContext context) {
251270 return new Material (
@@ -265,9 +284,14 @@ class CommonUtils {
265284 child: new Column (
266285 mainAxisAlignment: MainAxisAlignment .center,
267286 children: < Widget > [
268- new Container (child: SpinKitCubeGrid (color: Color (GSYColors .white))),
287+ new Container (
288+ child:
289+ SpinKitCubeGrid (color: Color (GSYColors .white))),
269290 new Container (height: 10.0 ),
270- new Container (child: new Text (CommonUtils .getLocale (context).loading_text, style: GSYConstant .normalTextWhite)),
291+ new Container (
292+ child: new Text (
293+ CommonUtils .getLocale (context).loading_text,
294+ style: GSYConstant .normalTextWhite)),
271295 ],
272296 ),
273297 ),
@@ -286,7 +310,7 @@ class CommonUtils {
286310 TextEditingController valueController,
287311 bool needTitle = true ,
288312 }) {
289- return showDialog (
313+ return NavigatorUtils . showGSYDialog (
290314 context: context,
291315 builder: (BuildContext context) {
292316 return Center (
@@ -303,6 +327,7 @@ class CommonUtils {
303327 });
304328 }
305329
330+ ///列表item dialog
306331 static Future <Null > showCommitOptionDialog (
307332 BuildContext context,
308333 List <String > commitMaps,
@@ -311,7 +336,7 @@ class CommonUtils {
311336 height = 400.0 ,
312337 List <Color > colorList,
313338 }) {
314- return showDialog (
339+ return NavigatorUtils . showGSYDialog (
315340 context: context,
316341 builder: (BuildContext context) {
317342 return Center (
@@ -329,10 +354,12 @@ class CommonUtils {
329354 itemCount: commitMaps.length,
330355 itemBuilder: (context, index) {
331356 return GSYFlexButton (
332- maxLines: 2 ,
357+ maxLines: 1 ,
333358 mainAxisAlignment: MainAxisAlignment .start,
334359 fontSize: 14.0 ,
335- color: colorList != null ? colorList[index] : Theme .of (context).primaryColor,
360+ color: colorList != null
361+ ? colorList[index]
362+ : Theme .of (context).primaryColor,
336363 text: commitMaps[index],
337364 textColor: Color (GSYColors .white),
338365 onPress: () {
@@ -347,8 +374,9 @@ class CommonUtils {
347374 }
348375
349376 ///版本更新
350- static Future <Null > showUpdateDialog (BuildContext context, String contentMsg) {
351- return showDialog (
377+ static Future <Null > showUpdateDialog (
378+ BuildContext context, String contentMsg) {
379+ return NavigatorUtils .showGSYDialog (
352380 context: context,
353381 builder: (BuildContext context) {
354382 return AlertDialog (
0 commit comments