Skip to content

Commit 32a912d

Browse files
committed
photo view loading
1 parent 0ffa563 commit 32a912d

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

‎lib/common/utils/CommonUtils.dart‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ class CommonUtils {
3232
static double sStaticBarHeight = 0.0;
3333

3434
static void initStatusBarHeight(context) async {
35-
sStaticBarHeight = await FlutterStatusbar.height / MediaQuery
36-
.of(context)
37-
.devicePixelRatio;
35+
sStaticBarHeight = await FlutterStatusbar.height / MediaQuery.of(context).devicePixelRatio;
3836
}
3937

4038
static String getDateStr(DateTime date) {
4139
if (date == null || date.toString() == null) {
4240
return "";
43-
} else if (date
44-
.toString()
45-
.length < 10) {
41+
} else if (date.toString().length < 10) {
4642
return date.toString();
4743
}
4844
return date.toString().substring(0, 10);
@@ -54,9 +50,7 @@ class CommonUtils {
5450

5551
///日期格式转换
5652
static String getNewsTimeStr(DateTime date) {
57-
int subTime = DateTime
58-
.now()
59-
.millisecondsSinceEpoch - date.millisecondsSinceEpoch;
53+
int subTime = DateTime.now().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
6054

6155
if (subTime < MILLIS_LIMIT) {
6256
return "刚刚";
@@ -108,6 +102,7 @@ class CommonUtils {
108102
if (url == null && url.length == 0) return;
109103
Uri parseUrl = Uri.parse(url);
110104
if (isImageEnd(parseUrl.toString())) {
105+
NavigatorUtils.gotoPhotoViewPage(context, url);
111106
return;
112107
}
113108

@@ -173,15 +168,16 @@ class CommonUtils {
173168
});
174169
}
175170

176-
static Future<Null> showEditDialog(BuildContext context,
177-
String dialogTitle,
178-
ValueChanged<String> onTitleChanged,
179-
ValueChanged<String> onContentChanged,
180-
VoidCallback onPressed, {
181-
TextEditingController titleController,
182-
TextEditingController valueController,
183-
bool needTitle = true,
184-
}) {
171+
static Future<Null> showEditDialog(
172+
BuildContext context,
173+
String dialogTitle,
174+
ValueChanged<String> onTitleChanged,
175+
ValueChanged<String> onContentChanged,
176+
VoidCallback onPressed, {
177+
TextEditingController titleController,
178+
TextEditingController valueController,
179+
bool needTitle = true,
180+
}) {
185181
return showDialog(
186182
context: context,
187183
builder: (BuildContext context) {

0 commit comments

Comments
 (0)