重构通道名称,在Android和iOS实现中使用统一的命名空间‘app.record_tool’。相应地更新相关的常量和方法通道。增强在录制HUD中的缩放比例显示格式。

This commit is contained in:
2026-07-01 11:19:30 +08:00
parent c8a7494344
commit 90e8966528
7 changed files with 29 additions and 18 deletions
@@ -1,10 +1,10 @@
package com.run.sportsx
object AppConstants {
const val PACKAGE_NAME = "com.run.sportsx"
const val PLATFORM_INFO_CHANNEL = "$PACKAGE_NAME/platform_info"
const val RECORDING_METHOD_CHANNEL = "$PACKAGE_NAME/recording"
const val RECORDING_EVENT_CHANNEL = "$PACKAGE_NAME/recording_events"
const val RECORDING_ACTION_START = "$PACKAGE_NAME.recording.START"
const val RECORDING_ACTION_STOP = "$PACKAGE_NAME.recording.STOP"
private const val CHANNEL_NAMESPACE = "app.record_tool"
const val PLATFORM_INFO_CHANNEL = "$CHANNEL_NAMESPACE/platform_info"
const val RECORDING_METHOD_CHANNEL = "$CHANNEL_NAMESPACE/recording"
const val RECORDING_EVENT_CHANNEL = "$CHANNEL_NAMESPACE/recording_events"
const val RECORDING_ACTION_START = "$CHANNEL_NAMESPACE.recording.START"
const val RECORDING_ACTION_STOP = "$CHANNEL_NAMESPACE.recording.STOP"
}
+1 -1
View File
@@ -4,7 +4,7 @@ import UIKit
final class PlatformInfoPlugin: NSObject, FlutterPlugin {
static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(
name: "com.run.sportsx/platform_info",
name: "app.record_tool/platform_info",
binaryMessenger: registrar.messenger()
)
let plugin = PlatformInfoPlugin()
+3 -3
View File
@@ -633,9 +633,9 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
}
private enum RecordingChannelNames {
static let packageName = "com.run.sportsx"
static let method = "\(packageName)/recording"
static let events = "\(packageName)/recording_events"
static let namespace = "app.record_tool"
static let method = "\(namespace)/recording"
static let events = "\(namespace)/recording_events"
}
final class RecordingPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
+1 -1
View File
@@ -60,7 +60,7 @@ class AppPlatformInfo {
AppPlatformInfo._();
static const MethodChannel _channel = MethodChannel(
'com.run.sportsx/platform_info',
'app.record_tool/platform_info',
);
static Future<AppPackageInfo> packageInfo() async {
@@ -1,5 +1,5 @@
abstract final class RecordingChannelNames {
static const packageName = 'com.run.sportsx';
static const method = '$packageName/recording';
static const events = '$packageName/recording_events';
static const namespace = 'app.record_tool';
static const method = '$namespace/recording';
static const events = '$namespace/recording_events';
}
@@ -308,7 +308,7 @@ class _ZoomPresetButton extends StatelessWidget {
),
),
child: Text(
'${_formatZoomRatio(displayRatio)}x',
_formatZoomRatio(displayRatio),
style: TextStyle(
fontSize: 13.sp,
fontWeight: FontWeight.w700,
@@ -320,9 +320,12 @@ class _ZoomPresetButton extends StatelessWidget {
}
String _formatZoomRatio(double ratio) {
if (ratio < 1.0) {
return '广角';
}
if (ratio == ratio.roundToDouble()) {
return ratio.toStringAsFixed(0);
return '${ratio.toStringAsFixed(0)}x';
}
return ratio.toStringAsFixed(1);
return '${ratio.toStringAsFixed(1)}x';
}
}
@@ -1,7 +1,15 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:recording_tool/features/recording/platform/recording_channel_names.dart';
import 'package:recording_tool/features/recording/platform/recording_platform.dart';
void main() {
group('RecordingChannelNames', () {
test('uses stable bridge names without package binding', () {
expect(RecordingChannelNames.method, 'app.record_tool/recording');
expect(RecordingChannelNames.events, 'app.record_tool/recording_events');
});
});
group('RecordingPlatform support', () {
test('supports Android and iOS hosts only', () {
expect(