Skip to content

Commit 055cb8a

Browse files
committed
➖ Remove common exports.
1 parent 4d4ecc5 commit 055cb8a

File tree

4 files changed

+82
-3
lines changed

4 files changed

+82
-3
lines changed

lib/src/constants/constants.dart

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,34 @@
22
/// [Author] Alex (https://github.com/AlexV525)
33
/// [Date] 2020/7/15 02:06
44
///
5+
import 'dart:developer';
6+
7+
import 'package:flutter/widgets.dart';
8+
import 'package:flutter/foundation.dart';
59
import 'package:wechat_camera_picker/wechat_camera_picker.dart';
610

7-
export 'package:flutter_common_exports/flutter_common_exports.dart';
811
export 'package:photo_manager/photo_manager.dart';
912

1013
export '../delegates/camera_picker_text_delegate.dart';
1114
export '../utils/device_utils.dart';
1215
export 'colors.dart';
16+
export 'screens.dart';
1317

1418
class Constants {
1519
const Constants._();
1620

1721
static CameraPickerTextDelegate textDelegate =
1822
DefaultCameraPickerTextDelegate();
1923
}
24+
25+
/// Log only in debug mode.
26+
/// 只在调试模式打印
27+
void realDebugPrint(dynamic message) {
28+
if (!kReleaseMode) {
29+
log('$message');
30+
}
31+
}
32+
33+
int get currentTimeStamp => DateTime.now().millisecondsSinceEpoch;
34+
35+
const BorderRadius maxBorderRadius = BorderRadius.all(Radius.circular(999999));

lib/src/constants/screens.dart

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
///
2+
/// [Author] Alex (https://github.com/AlexV525)
3+
/// [Date] 2020/8/19 10:29
4+
///
5+
import 'dart:ui' as ui;
6+
7+
import 'package:flutter/material.dart';
8+
import 'package:flutter/services.dart';
9+
10+
/// Screens utils with multiple properties access.
11+
/// 获取屏幕各项属性的工具类
12+
class Screens {
13+
const Screens._();
14+
15+
/// Get [MediaQueryData] from [ui.window]
16+
/// 通过 [ui.window] 获取 [MediaQueryData]
17+
static MediaQueryData get mediaQuery => MediaQueryData.fromWindow(ui.window);
18+
19+
/// The number of device pixels for each logical pixel.
20+
/// 设备每个逻辑像素对应的dp比例
21+
static double get scale => mediaQuery.devicePixelRatio;
22+
23+
/// The horizontal extent of this size.
24+
/// 水平范围的大小
25+
static double get width => mediaQuery.size.width;
26+
27+
/// The horizontal pixels of this size.
28+
/// 水平范围的像素值
29+
static int get widthPixels => (width * scale).toInt();
30+
31+
/// The vertical extent of this size.
32+
/// 垂直范围的大小
33+
static double get height => mediaQuery.size.height;
34+
35+
/// The vertical pixels of this size.
36+
/// 垂直范围的像素值
37+
static int get heightPixels => (height * scale).toInt();
38+
39+
/// Top offset in the [ui.window], usually is the notch size.
40+
/// 从 [ui.window] 获取的顶部偏移(间距),通常是刘海的大小。
41+
static double get topSafeHeight => mediaQuery.padding.top;
42+
43+
/// Bottom offset in the [ui.window], usually is the action bar/navigation bar size.
44+
/// 从 [ui.window] 获取的底部偏移(间距),通常是操作条/导航条的大小。
45+
static double get bottomSafeHeight => mediaQuery.padding.bottom;
46+
47+
/// Height exclude top and bottom safe height.
48+
/// 去除顶部和底部安全区域的高度
49+
static double get safeHeight => height - topSafeHeight - bottomSafeHeight;
50+
51+
/// Method to update status bar's style.
52+
/// 更新状态栏样式的方法
53+
static void updateStatusBarStyle(SystemUiOverlayStyle style) {
54+
SystemChrome.setSystemUIOverlayStyle(style);
55+
}
56+
57+
/// Scale factor for the text.
58+
/// 文字缩放的倍数
59+
static double get textScaleFactor => mediaQuery.textScaleFactor;
60+
61+
/// Return a fixed font size according to text scale factor.
62+
/// 根据文字缩放计算出的固定文字大小
63+
static double fixedFontSize(double fontSize) => fontSize / textScaleFactor;
64+
}

lib/src/widget/camera_picker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class CameraPicker extends StatefulWidget {
144144
class CameraPickerState extends State<CameraPicker> {
145145
/// The [Duration] for record detection. (200ms)
146146
/// 检测是否开始录制的时长 (200毫秒)
147-
final Duration recordDetectDuration = 200.milliseconds;
147+
final Duration recordDetectDuration = const Duration(milliseconds: 200);
148148

149149
/// Available cameras.
150150
/// 可用的相机实例

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313

1414
camera: ^0.5.8+5
1515
device_info: ^0.4.2+6
16-
flutter_common_exports: ^0.1.0
1716
path_provider: ^1.6.11
1817
photo_manager: ^0.5.7
1918
video_player: ^0.10.11+2

0 commit comments

Comments
 (0)