Browse Source

Revise的日志完善

liukai 7 months ago
parent
commit
3b04bb6365

+ 3 - 3
packages/cpt_job_sg/lib/modules/revise_log/revise_log_item.dart

@@ -38,7 +38,7 @@ class ReviseLogItem extends StatelessWidget {
             crossAxisAlignment: CrossAxisAlignment.center,
             children: [
               MyTextView(
-                "Date Time:".tr,
+                "Date Time".tr + ":",
                 isFontRegular: true,
                 textColor: ColorConstants.textGrayAECAE5,
                 fontSize: 14,
@@ -80,7 +80,7 @@ class ReviseLogItem extends StatelessWidget {
             crossAxisAlignment: CrossAxisAlignment.center,
             children: [
               MyTextView(
-                "Action:".tr,
+                "Action".tr + ":",
                 isFontRegular: true,
                 textColor: ColorConstants.textGrayAECAE5,
                 fontSize: 14,
@@ -103,7 +103,7 @@ class ReviseLogItem extends StatelessWidget {
             crossAxisAlignment: CrossAxisAlignment.start,
             children: [
               MyTextView(
-                "Content:".tr,
+                "Content".tr + ":",
                 isFontRegular: true,
                 textColor: ColorConstants.textGrayAECAE5,
                 fontSize: 14,

+ 3 - 0
packages/cs_resources/lib/local/language/en_US.dart

@@ -222,6 +222,9 @@ const Map<String, String> en_US = {
   'Are you sure you want to recall this revise?': 'Are you sure you want to recall this revise?',
   'Are you sure you want to delete this revise?': 'Are you sure you want to delete this revise?',
   'Logs': 'Logs',
+  'Date Time': 'Date Time',
+  'Action': 'Action',
+  'Content': 'Content',
 
   //插件的国际化
   'Pull to refresh': 'Pull to refresh',

+ 3 - 0
packages/cs_resources/lib/local/language/vi_VN.dart

@@ -222,6 +222,9 @@ const Map<String, String> vi_VN = {
   'Are you sure you want to recall this revise?': 'Anh có chắc là anh muốn rút hồ sơ sửa đổi này không??',
   'Are you sure you want to delete this revise?': 'Bạn có chắc chắn muốn xóa bản ghi sửa đổi này?',
   'Logs': 'Đăng nhập',
+  'Date Time': 'Ngày giờ',
+  'Action': 'Sự kiện',
+  'Content': 'Nội dung',
 
   //插件的国际化
   "Pull to refresh": "Kéo để làm mới",

+ 3 - 0
packages/cs_resources/lib/local/language/zh_CN.dart

@@ -222,6 +222,9 @@ const Map<String, String> zh_CN = {
   'Are you sure you want to recall this revise?': '你确定要撤回此修改记录吗?',
   'Are you sure you want to delete this revise?': '你确定要删除此修改记录吗?',
   'Logs': '日志',
+  'Date Time': '日期时间',
+  'Action': '事件',
+  'Content': '内容',
 
   //插件的国际化
   'Pull to refresh': '下拉刷新',

+ 11 - 14
packages/cs_shared/lib/utils/screen_util.dart

@@ -1,7 +1,8 @@
+import 'dart:ui';
+
 import 'package:flutter/material.dart';
 import 'dart:ui' as ui show window;
 
-
 ///默认设计稿尺寸(单位 dp or pt)
 double _designW = 360.0;
 double _designH = 640.0;
@@ -40,14 +41,15 @@ class ScreenUtil {
   }
 
   _init() {
+    //先用老的方法获取,如果获取不到再使用新方法获取
     MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window);
     if (_mediaQueryData != mediaQuery) {
       _mediaQueryData = mediaQuery;
-      _screenWidth = mediaQuery.size.width;
-      _screenHeight = mediaQuery.size.height;
-      _screenDensity = mediaQuery.devicePixelRatio;
-      _statusBarHeight = mediaQuery.padding.top;
-      _bottomBarHeight = mediaQuery.padding.bottom;
+      _screenWidth = mediaQuery.size.width == 0.0 ? MediaQueryData.fromView(PlatformDispatcher.instance.views.first).size.width : mediaQuery.size.width;
+      _screenHeight = mediaQuery.size.height == 0.0 ? MediaQueryData.fromView(PlatformDispatcher.instance.views.first).size.height : mediaQuery.size.height;
+      _screenDensity = mediaQuery.devicePixelRatio == 0.0 ? MediaQueryData.fromView(PlatformDispatcher.instance.views.first).devicePixelRatio : mediaQuery.devicePixelRatio;
+      _statusBarHeight = mediaQuery.padding.top == 0.0 ? MediaQueryData.fromView(PlatformDispatcher.instance.views.first).padding.top : mediaQuery.padding.top;
+      _bottomBarHeight = mediaQuery.padding.bottom == 0.0 ? MediaQueryData.fromView(PlatformDispatcher.instance.views.first).padding.bottom : mediaQuery.padding.bottom;
       _appBarHeight = kToolbarHeight;
     }
   }
@@ -174,9 +176,7 @@ class ScreenUtil {
   /// 返回根据屏幕宽适配后尺寸(单位 dp or pt)
   /// sizePx unit px
   double getWidthPx(double sizePx) {
-    return _screenWidth == 0.0
-        ? (sizePx / _designD)
-        : (sizePx * _screenWidth / (_designW * _designD));
+    return _screenWidth == 0.0 ? (sizePx / _designD) : (sizePx * _screenWidth / (_designW * _designD));
   }
 
   /// 仅支持纵屏。
@@ -184,9 +184,7 @@ class ScreenUtil {
   /// 返回根据屏幕高适配后尺寸(单位 dp or pt)
   /// sizePx unit px
   double getHeightPx(double sizePx) {
-    return _screenHeight == 0.0
-        ? (sizePx / _designD)
-        : (sizePx * _screenHeight / (_designH * _designD));
+    return _screenHeight == 0.0 ? (sizePx / _designD) : (sizePx * _screenHeight / (_designH * _designD));
   }
 
   /// 仅支持纵屏。
@@ -209,8 +207,7 @@ class ScreenUtil {
   /// 适配比率。
   /// Ratio.
   double getRatio() {
-    return (_screenWidth > _screenHeight ? _screenHeight : _screenWidth) /
-        _designW;
+    return (_screenWidth > _screenHeight ? _screenHeight : _screenWidth) / _designW;
   }
 
   /// 兼容横/纵屏。