Skip to content

Commit be58cf7

Browse files
authored
💄 Adapt the latest interface of WeChat (#255)
1 parent fb2b8a4 commit be58cf7

13 files changed

+149
-263
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ See the [Migration Guide](guides/migration_guide.md) for breaking changes betwee
88

99
## 4.3.0
1010

11+
### Improvements
12+
13+
- Adapt the latest interface of WeChat.
14+
1115
### Fixes
1216

1317
- Constraints `camera_android` version to resolves https://github.com/flutter/flutter/issues/150549.

README-ZH.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Language: [English](README.md) | 中文
2020
基于 **微信 UI** 的 Flutter 相机选择器,可以单独运行,
2121
同时是 [wechat_assets_picker][wechat_assets_picker pub] 的扩展。
2222

23-
当前的界面设计基于的微信版本:**8.3.x**
23+
当前的界面设计基于的微信版本:**8.0.49**
2424
界面更新将在微信版本更新后随时进行跟进。
2525

2626
查看 [迁移指南][] 了解如何从破坏性改动中迁移为可用代码。
@@ -188,8 +188,9 @@ final AssetEntity? entity = await CameraPicker.pickFromCamera(
188188
| enableExposureControlOnPoint | `bool` | 用户是否可以根据已经设置的曝光点调节曝光度 | `true` |
189189
| enablePinchToZoom | `bool` | 用户是否可以在界面上双指缩放相机对焦 | `true` |
190190
| enablePullToZoomInRecord | `bool` | 用户是否可以在录制视频时上拉缩放 | `true` |
191+
| enableScaledPreview | `bool` | 拍摄过程中相机预览是否需要缩放 | `false` |
191192
| shouldDeletePreviewFile | `bool` | 返回页面时是否删除预览文件 | `false` |
192-
| shouldAutoPreviewVideo | `bool` | 在预览时是否直接播放视频 | `false` |
193+
| shouldAutoPreviewVideo | `bool` | 在预览时是否直接播放视频 | `true` |
193194
| maximumRecordingDuration | `Duration?` | 录制视频最长时长 | `const Duration(seconds: 15)` |
194195
| minimumRecordingDuration | `Duration` | 录制视频最短时长 | `const Duration(seconds: 1)` |
195196
| theme | `ThemeData?` | 选择器的主题 | `CameraPicker.themeData(wechatThemeColor)` |

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ A **camera picker** for Flutter projects based on WeChat's UI,
2121
which is also a separate runnable extension to the
2222
[wechat_assets_picker][wechat_assets_picker pub].
2323

24-
Current WeChat version that UI based on: **8.3.x**
24+
Current WeChat version that UI based on: **8.0.49**
2525
UI designs will be updated following the WeChat update in anytime.
2626

2727
See the [Migration Guide][] to learn how to migrate between breaking changes.
@@ -193,8 +193,9 @@ Fields in `CameraPickerConfig`:
193193
| enableExposureControlOnPoint | `bool` | Whether users can adjust exposure according to the set point. | `true` |
194194
| enablePinchToZoom | `bool` | Whether users can zoom the camera by pinch. | `true` |
195195
| enablePullToZoomInRecord | `bool` | Whether users can zoom by pulling up when recording video. | `true` |
196+
| enableScaledPreview | `bool` | Whether the camera preview should be scaled during captures. | `false` |
196197
| shouldDeletePreviewFile | `bool` | Whether the preview file will be delete when pop. | `false` |
197-
| shouldAutoPreviewVideo | `bool` | Whether the video should be played instantly in the preview. | `false` |
198+
| shouldAutoPreviewVideo | `bool` | Whether the video should be played instantly in the preview. | `true` |
198199
| maximumRecordingDuration | `Duration?` | The maximum duration of the video recording process. | `const Duration(seconds: 15)` |
199200
| minimumRecordingDuration | `Duration` | The minimum duration of the video recording process. | `const Duration(seconds: 1)` |
200201
| theme | `ThemeData?` | Theme data for the picker. | `CameraPicker.themeData(wechatThemeColor)` |

example/lib/l10n/app_en.arb

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
"pickMethodVideosByTapDescription": "Use cameras only to take videos, but not with long-press, just a single tap.",
1616
"pickMethodSilenceRecordingName": "Silence recording",
1717
"pickMethodSilenceRecordingDescription": "Make recordings silent.",
18-
"pickMethodAutoPreviewVideosName": "Auto preview videos",
19-
"pickMethodAutoPreviewVideosDescription": "Play videos automatically in the preview after captured.",
2018
"pickMethodNoDurationLimitName": "No duration limit",
2119
"pickMethodNoDurationLimitDescription": "Record as long as you with (if your device stays alive)...",
2220
"pickMethodCustomizableThemeName": "Customizable theme (ThemeData)",
2321
"pickMethodCustomizableThemeDescription": "Picking assets with the light theme or with a different color.",
2422
"pickMethodRotateInTurnsName": "Rotate picker in turns",
2523
"pickMethodRotateInTurnsDescription": "Rotate the picker layout in quarter turns, without the camera preview.",
26-
"pickMethodPreventScalingName": "Prevent scaling for camera preview",
27-
"pickMethodPreventScalingDescription": "Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.",
24+
"pickMethodScalingPreviewName": "Scaling for camera preview",
25+
"pickMethodScalingPreviewDescription": "Camera preview will be scaled to cover the whole screen of the device with the original aspect ratio.",
2826
"pickMethodLowerResolutionName": "Lower resolutions",
2927
"pickMethodLowerResolutionDescription": "Use a lower resolution preset might be helpful in some specific scenarios.",
3028
"pickMethodPreferFrontCameraName": "Prefer front camera",

example/lib/l10n/app_zh.arb

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
"pickMethodVideosByTapDescription": "轻触录像按钮进行录像,而不是长按。",
1616
"pickMethodSilenceRecordingName": "静音录像",
1717
"pickMethodSilenceRecordingDescription": "录像时不录制声音。",
18-
"pickMethodAutoPreviewVideosName": "自动预览录制的视频",
19-
"pickMethodAutoPreviewVideosDescription": "预览录制的视频时,自动播放。",
2018
"pickMethodNoDurationLimitName": "无时长限制录像",
2119
"pickMethodNoDurationLimitDescription": "想录多久,就录多久(只要手机健在)。",
2220
"pickMethodCustomizableThemeName": "自定义主题 (ThemeData)",
2321
"pickMethodCustomizableThemeDescription": "可以用亮色或其他颜色及自定义的主题进行选择。",
2422
"pickMethodRotateInTurnsName": "旋转选择器的布局",
2523
"pickMethodRotateInTurnsDescription": "顺时针旋转选择器的元素布局,不旋转相机视图。",
26-
"pickMethodPreventScalingName": "禁止缩放相机预览",
27-
"pickMethodPreventScalingDescription": "相机预览视图不会被放大到覆盖整个屏幕,仅适应原始的预览比例。",
24+
"pickMethodScalingPreviewName": "缩放相机预览",
25+
"pickMethodScalingPreviewDescription": "相机预览视图会被放大到覆盖整个屏幕且保持原始的预览比例。",
2826
"pickMethodLowerResolutionName": "低分辨率拍照",
2927
"pickMethodLowerResolutionDescription": "某些情况或机型使用低分辨率拍照会有稳定性改善。",
3028
"pickMethodPreferFrontCameraName": "首选前置摄像头",

example/lib/l10n/gen/app_localizations.dart

+6-18
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,6 @@ abstract class AppLocalizations {
183183
/// **'Make recordings silent.'**
184184
String get pickMethodSilenceRecordingDescription;
185185

186-
/// No description provided for @pickMethodAutoPreviewVideosName.
187-
///
188-
/// In en, this message translates to:
189-
/// **'Auto preview videos'**
190-
String get pickMethodAutoPreviewVideosName;
191-
192-
/// No description provided for @pickMethodAutoPreviewVideosDescription.
193-
///
194-
/// In en, this message translates to:
195-
/// **'Play videos automatically in the preview after captured.'**
196-
String get pickMethodAutoPreviewVideosDescription;
197-
198186
/// No description provided for @pickMethodNoDurationLimitName.
199187
///
200188
/// In en, this message translates to:
@@ -231,17 +219,17 @@ abstract class AppLocalizations {
231219
/// **'Rotate the picker layout in quarter turns, without the camera preview.'**
232220
String get pickMethodRotateInTurnsDescription;
233221

234-
/// No description provided for @pickMethodPreventScalingName.
222+
/// No description provided for @pickMethodScalingPreviewName.
235223
///
236224
/// In en, this message translates to:
237-
/// **'Prevent scaling for camera preview'**
238-
String get pickMethodPreventScalingName;
225+
/// **'Scaling for camera preview'**
226+
String get pickMethodScalingPreviewName;
239227

240-
/// No description provided for @pickMethodPreventScalingDescription.
228+
/// No description provided for @pickMethodScalingPreviewDescription.
241229
///
242230
/// In en, this message translates to:
243-
/// **'Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.'**
244-
String get pickMethodPreventScalingDescription;
231+
/// **'Camera preview will be scaled to cover the whole screen of the device with the original aspect ratio.'**
232+
String get pickMethodScalingPreviewDescription;
245233

246234
/// No description provided for @pickMethodLowerResolutionName.
247235
///

example/lib/l10n/gen/app_localizations_en.dart

+2-8
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ class AppLocalizationsEn extends AppLocalizations {
5353
@override
5454
String get pickMethodSilenceRecordingDescription => 'Make recordings silent.';
5555

56-
@override
57-
String get pickMethodAutoPreviewVideosName => 'Auto preview videos';
58-
59-
@override
60-
String get pickMethodAutoPreviewVideosDescription => 'Play videos automatically in the preview after captured.';
61-
6256
@override
6357
String get pickMethodNoDurationLimitName => 'No duration limit';
6458

@@ -78,10 +72,10 @@ class AppLocalizationsEn extends AppLocalizations {
7872
String get pickMethodRotateInTurnsDescription => 'Rotate the picker layout in quarter turns, without the camera preview.';
7973

8074
@override
81-
String get pickMethodPreventScalingName => 'Prevent scaling for camera preview';
75+
String get pickMethodScalingPreviewName => 'Scaling for camera preview';
8276

8377
@override
84-
String get pickMethodPreventScalingDescription => 'Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.';
78+
String get pickMethodScalingPreviewDescription => 'Camera preview will be scaled to cover the whole screen of the device with the original aspect ratio.';
8579

8680
@override
8781
String get pickMethodLowerResolutionName => 'Lower resolutions';

example/lib/l10n/gen/app_localizations_zh.dart

+2-8
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ class AppLocalizationsZh extends AppLocalizations {
5353
@override
5454
String get pickMethodSilenceRecordingDescription => '录像时不录制声音。';
5555

56-
@override
57-
String get pickMethodAutoPreviewVideosName => '自动预览录制的视频';
58-
59-
@override
60-
String get pickMethodAutoPreviewVideosDescription => '预览录制的视频时,自动播放。';
61-
6256
@override
6357
String get pickMethodNoDurationLimitName => '无时长限制录像';
6458

@@ -78,10 +72,10 @@ class AppLocalizationsZh extends AppLocalizations {
7872
String get pickMethodRotateInTurnsDescription => '顺时针旋转选择器的元素布局,不旋转相机视图。';
7973

8074
@override
81-
String get pickMethodPreventScalingName => '禁止缩放相机预览';
75+
String get pickMethodScalingPreviewName => '缩放相机预览';
8276

8377
@override
84-
String get pickMethodPreventScalingDescription => '相机预览视图不会被放大到覆盖整个屏幕,仅适应原始的预览比例。';
78+
String get pickMethodScalingPreviewDescription => '相机预览视图会被放大到覆盖整个屏幕且保持原始的预览比例。';
8579

8680
@override
8781
String get pickMethodLowerResolutionName => '低分辨率拍照';

example/lib/models/picker_method.dart

+3-17
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,6 @@ List<PickMethod> pickMethods(BuildContext context) {
6565
),
6666
),
6767
),
68-
PickMethod(
69-
icon: '▶️',
70-
name: context.l10n.pickMethodAutoPreviewVideosName,
71-
description: context.l10n.pickMethodAutoPreviewVideosDescription,
72-
method: (BuildContext context) => CameraPicker.pickFromCamera(
73-
context,
74-
pickerConfig: const CameraPickerConfig(
75-
enableRecording: true,
76-
onlyEnableRecording: true,
77-
enableTapRecording: true,
78-
shouldAutoPreviewVideo: true,
79-
),
80-
),
81-
),
8268
PickMethod(
8369
icon: '⏳',
8470
name: context.l10n.pickMethodNoDurationLimitName,
@@ -115,11 +101,11 @@ List<PickMethod> pickMethods(BuildContext context) {
115101
),
116102
PickMethod(
117103
icon: '🔍',
118-
name: context.l10n.pickMethodPreventScalingName,
119-
description: context.l10n.pickMethodPreventScalingDescription,
104+
name: context.l10n.pickMethodScalingPreviewName,
105+
description: context.l10n.pickMethodScalingPreviewDescription,
120106
method: (BuildContext context) => CameraPicker.pickFromCamera(
121107
context,
122-
pickerConfig: const CameraPickerConfig(enableScaledPreview: false),
108+
pickerConfig: const CameraPickerConfig(enableScaledPreview: true),
123109
),
124110
),
125111
PickMethod(

lib/src/constants/config.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ final class CameraPickerConfig {
2323
this.enableExposureControlOnPoint = true,
2424
this.enablePinchToZoom = true,
2525
this.enablePullToZoomInRecord = true,
26-
this.enableScaledPreview = true,
26+
this.enableScaledPreview = false,
2727
this.shouldDeletePreviewFile = false,
28-
this.shouldAutoPreviewVideo = false,
28+
this.shouldAutoPreviewVideo = true,
2929
this.maximumRecordingDuration = const Duration(seconds: 15),
3030
this.minimumRecordingDuration = const Duration(seconds: 1),
3131
this.theme,

0 commit comments

Comments
 (0)