Skip to content

Commit

Permalink
💄 Adapt the latest interface of WeChat (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Jun 20, 2024
1 parent fb2b8a4 commit be58cf7
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 263 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ See the [Migration Guide](guides/migration_guide.md) for breaking changes betwee

## 4.3.0

### Improvements

- Adapt the latest interface of WeChat.

### Fixes

- Constraints `camera_android` version to resolves https://github.com/flutter/flutter/issues/150549.
Expand Down
5 changes: 3 additions & 2 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Language: [English](README.md) | 中文
基于 **微信 UI** 的 Flutter 相机选择器,可以单独运行,
同时是 [wechat_assets_picker][wechat_assets_picker pub] 的扩展。

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

查看 [迁移指南][] 了解如何从破坏性改动中迁移为可用代码。
Expand Down Expand Up @@ -188,8 +188,9 @@ final AssetEntity? entity = await CameraPicker.pickFromCamera(
| enableExposureControlOnPoint | `bool` | 用户是否可以根据已经设置的曝光点调节曝光度 | `true` |
| enablePinchToZoom | `bool` | 用户是否可以在界面上双指缩放相机对焦 | `true` |
| enablePullToZoomInRecord | `bool` | 用户是否可以在录制视频时上拉缩放 | `true` |
| enableScaledPreview | `bool` | 拍摄过程中相机预览是否需要缩放 | `false` |
| shouldDeletePreviewFile | `bool` | 返回页面时是否删除预览文件 | `false` |
| shouldAutoPreviewVideo | `bool` | 在预览时是否直接播放视频 | `false` |
| shouldAutoPreviewVideo | `bool` | 在预览时是否直接播放视频 | `true` |
| maximumRecordingDuration | `Duration?` | 录制视频最长时长 | `const Duration(seconds: 15)` |
| minimumRecordingDuration | `Duration` | 录制视频最短时长 | `const Duration(seconds: 1)` |
| theme | `ThemeData?` | 选择器的主题 | `CameraPicker.themeData(wechatThemeColor)` |
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A **camera picker** for Flutter projects based on WeChat's UI,
which is also a separate runnable extension to the
[wechat_assets_picker][wechat_assets_picker pub].

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

See the [Migration Guide][] to learn how to migrate between breaking changes.
Expand Down Expand Up @@ -193,8 +193,9 @@ Fields in `CameraPickerConfig`:
| enableExposureControlOnPoint | `bool` | Whether users can adjust exposure according to the set point. | `true` |
| enablePinchToZoom | `bool` | Whether users can zoom the camera by pinch. | `true` |
| enablePullToZoomInRecord | `bool` | Whether users can zoom by pulling up when recording video. | `true` |
| enableScaledPreview | `bool` | Whether the camera preview should be scaled during captures. | `false` |
| shouldDeletePreviewFile | `bool` | Whether the preview file will be delete when pop. | `false` |
| shouldAutoPreviewVideo | `bool` | Whether the video should be played instantly in the preview. | `false` |
| shouldAutoPreviewVideo | `bool` | Whether the video should be played instantly in the preview. | `true` |
| maximumRecordingDuration | `Duration?` | The maximum duration of the video recording process. | `const Duration(seconds: 15)` |
| minimumRecordingDuration | `Duration` | The minimum duration of the video recording process. | `const Duration(seconds: 1)` |
| theme | `ThemeData?` | Theme data for the picker. | `CameraPicker.themeData(wechatThemeColor)` |
Expand Down
6 changes: 2 additions & 4 deletions example/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
"pickMethodVideosByTapDescription": "Use cameras only to take videos, but not with long-press, just a single tap.",
"pickMethodSilenceRecordingName": "Silence recording",
"pickMethodSilenceRecordingDescription": "Make recordings silent.",
"pickMethodAutoPreviewVideosName": "Auto preview videos",
"pickMethodAutoPreviewVideosDescription": "Play videos automatically in the preview after captured.",
"pickMethodNoDurationLimitName": "No duration limit",
"pickMethodNoDurationLimitDescription": "Record as long as you with (if your device stays alive)...",
"pickMethodCustomizableThemeName": "Customizable theme (ThemeData)",
"pickMethodCustomizableThemeDescription": "Picking assets with the light theme or with a different color.",
"pickMethodRotateInTurnsName": "Rotate picker in turns",
"pickMethodRotateInTurnsDescription": "Rotate the picker layout in quarter turns, without the camera preview.",
"pickMethodPreventScalingName": "Prevent scaling for camera preview",
"pickMethodPreventScalingDescription": "Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.",
"pickMethodScalingPreviewName": "Scaling for camera preview",
"pickMethodScalingPreviewDescription": "Camera preview will be scaled to cover the whole screen of the device with the original aspect ratio.",
"pickMethodLowerResolutionName": "Lower resolutions",
"pickMethodLowerResolutionDescription": "Use a lower resolution preset might be helpful in some specific scenarios.",
"pickMethodPreferFrontCameraName": "Prefer front camera",
Expand Down
6 changes: 2 additions & 4 deletions example/lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
"pickMethodVideosByTapDescription": "轻触录像按钮进行录像,而不是长按。",
"pickMethodSilenceRecordingName": "静音录像",
"pickMethodSilenceRecordingDescription": "录像时不录制声音。",
"pickMethodAutoPreviewVideosName": "自动预览录制的视频",
"pickMethodAutoPreviewVideosDescription": "预览录制的视频时,自动播放。",
"pickMethodNoDurationLimitName": "无时长限制录像",
"pickMethodNoDurationLimitDescription": "想录多久,就录多久(只要手机健在)。",
"pickMethodCustomizableThemeName": "自定义主题 (ThemeData)",
"pickMethodCustomizableThemeDescription": "可以用亮色或其他颜色及自定义的主题进行选择。",
"pickMethodRotateInTurnsName": "旋转选择器的布局",
"pickMethodRotateInTurnsDescription": "顺时针旋转选择器的元素布局,不旋转相机视图。",
"pickMethodPreventScalingName": "禁止缩放相机预览",
"pickMethodPreventScalingDescription": "相机预览视图不会被放大到覆盖整个屏幕,仅适应原始的预览比例。",
"pickMethodScalingPreviewName": "缩放相机预览",
"pickMethodScalingPreviewDescription": "相机预览视图会被放大到覆盖整个屏幕且保持原始的预览比例。",
"pickMethodLowerResolutionName": "低分辨率拍照",
"pickMethodLowerResolutionDescription": "某些情况或机型使用低分辨率拍照会有稳定性改善。",
"pickMethodPreferFrontCameraName": "首选前置摄像头",
Expand Down
24 changes: 6 additions & 18 deletions example/lib/l10n/gen/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,6 @@ abstract class AppLocalizations {
/// **'Make recordings silent.'**
String get pickMethodSilenceRecordingDescription;

/// No description provided for @pickMethodAutoPreviewVideosName.
///
/// In en, this message translates to:
/// **'Auto preview videos'**
String get pickMethodAutoPreviewVideosName;

/// No description provided for @pickMethodAutoPreviewVideosDescription.
///
/// In en, this message translates to:
/// **'Play videos automatically in the preview after captured.'**
String get pickMethodAutoPreviewVideosDescription;

/// No description provided for @pickMethodNoDurationLimitName.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -231,17 +219,17 @@ abstract class AppLocalizations {
/// **'Rotate the picker layout in quarter turns, without the camera preview.'**
String get pickMethodRotateInTurnsDescription;

/// No description provided for @pickMethodPreventScalingName.
/// No description provided for @pickMethodScalingPreviewName.
///
/// In en, this message translates to:
/// **'Prevent scaling for camera preview'**
String get pickMethodPreventScalingName;
/// **'Scaling for camera preview'**
String get pickMethodScalingPreviewName;

/// No description provided for @pickMethodPreventScalingDescription.
/// No description provided for @pickMethodScalingPreviewDescription.
///
/// In en, this message translates to:
/// **'Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.'**
String get pickMethodPreventScalingDescription;
/// **'Camera preview will be scaled to cover the whole screen of the device with the original aspect ratio.'**
String get pickMethodScalingPreviewDescription;

/// No description provided for @pickMethodLowerResolutionName.
///
Expand Down
10 changes: 2 additions & 8 deletions example/lib/l10n/gen/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get pickMethodSilenceRecordingDescription => 'Make recordings silent.';

@override
String get pickMethodAutoPreviewVideosName => 'Auto preview videos';

@override
String get pickMethodAutoPreviewVideosDescription => 'Play videos automatically in the preview after captured.';

@override
String get pickMethodNoDurationLimitName => 'No duration limit';

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

@override
String get pickMethodPreventScalingName => 'Prevent scaling for camera preview';
String get pickMethodScalingPreviewName => 'Scaling for camera preview';

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

@override
String get pickMethodLowerResolutionName => 'Lower resolutions';
Expand Down
10 changes: 2 additions & 8 deletions example/lib/l10n/gen/app_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get pickMethodSilenceRecordingDescription => '录像时不录制声音。';

@override
String get pickMethodAutoPreviewVideosName => '自动预览录制的视频';

@override
String get pickMethodAutoPreviewVideosDescription => '预览录制的视频时,自动播放。';

@override
String get pickMethodNoDurationLimitName => '无时长限制录像';

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

@override
String get pickMethodPreventScalingName => '禁止缩放相机预览';
String get pickMethodScalingPreviewName => '缩放相机预览';

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

@override
String get pickMethodLowerResolutionName => '低分辨率拍照';
Expand Down
20 changes: 3 additions & 17 deletions example/lib/models/picker_method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ List<PickMethod> pickMethods(BuildContext context) {
),
),
),
PickMethod(
icon: '▶️',
name: context.l10n.pickMethodAutoPreviewVideosName,
description: context.l10n.pickMethodAutoPreviewVideosDescription,
method: (BuildContext context) => CameraPicker.pickFromCamera(
context,
pickerConfig: const CameraPickerConfig(
enableRecording: true,
onlyEnableRecording: true,
enableTapRecording: true,
shouldAutoPreviewVideo: true,
),
),
),
PickMethod(
icon: '⏳',
name: context.l10n.pickMethodNoDurationLimitName,
Expand Down Expand Up @@ -115,11 +101,11 @@ List<PickMethod> pickMethods(BuildContext context) {
),
PickMethod(
icon: '🔍',
name: context.l10n.pickMethodPreventScalingName,
description: context.l10n.pickMethodPreventScalingDescription,
name: context.l10n.pickMethodScalingPreviewName,
description: context.l10n.pickMethodScalingPreviewDescription,
method: (BuildContext context) => CameraPicker.pickFromCamera(
context,
pickerConfig: const CameraPickerConfig(enableScaledPreview: false),
pickerConfig: const CameraPickerConfig(enableScaledPreview: true),
),
),
PickMethod(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/constants/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ final class CameraPickerConfig {
this.enableExposureControlOnPoint = true,
this.enablePinchToZoom = true,
this.enablePullToZoomInRecord = true,
this.enableScaledPreview = true,
this.enableScaledPreview = false,
this.shouldDeletePreviewFile = false,
this.shouldAutoPreviewVideo = false,
this.shouldAutoPreviewVideo = true,
this.maximumRecordingDuration = const Duration(seconds: 15),
this.minimumRecordingDuration = const Duration(seconds: 1),
this.theme,
Expand Down
Loading

0 comments on commit be58cf7

Please sign in to comment.