Compare commits
2 Commits
e1446337e9
...
6b168ccd62
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b168ccd62 | |||
| 551d10dec4 |
BIN
assets/images/image_copy.png
Normal file
BIN
assets/images/image_copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 795 B |
BIN
assets/images/image_delete.png
Normal file
BIN
assets/images/image_delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1011 B |
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
assets/images/image_vs.png
Normal file
BIN
assets/images/image_vs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
1
build-apk-split.sh
Normal file
1
build-apk-split.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
flutter build apk --release --split-per-abi
|
||||||
1
build-apk.sh
Normal file
1
build-apk.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
flutter build apk --release
|
||||||
@@ -1,15 +1,54 @@
|
|||||||
PODS:
|
PODS:
|
||||||
|
- connectivity_plus (0.0.1):
|
||||||
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- path_provider_foundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
|
- permission_handler_apple (9.4.8):
|
||||||
|
- Flutter
|
||||||
|
- shared_preferences_foundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
|
- sqflite_darwin (0.0.4):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
|
- url_launcher_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||||
|
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
|
||||||
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
|
connectivity_plus:
|
||||||
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
path_provider_foundation:
|
||||||
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
|
permission_handler_apple:
|
||||||
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
shared_preferences_foundation:
|
||||||
|
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||||
|
sqflite_darwin:
|
||||||
|
:path: ".symlinks/plugins/sqflite_darwin/darwin"
|
||||||
|
url_launcher_ios:
|
||||||
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
|
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
|
||||||
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
||||||
|
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
|
||||||
|
permission_handler_apple: 92d754bbaa7361d436db2d6c3c1c2a0fdcec462e
|
||||||
|
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
||||||
|
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
|
||||||
|
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
|
||||||
|
|
||||||
PODFILE CHECKSUM: 5a82b772179df87e6518bddc6f9bb8b4053ce48b
|
PODFILE CHECKSUM: 5a82b772179df87e6518bddc6f9bb8b4053ce48b
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
64BC3B3C75FABAA128C4FE7A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84231833EC084C45F76D9A0 /* Pods_RunnerTests.framework */; };
|
64BC3B3C75FABAA128C4FE7A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84231833EC084C45F76D9A0 /* Pods_RunnerTests.framework */; };
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
|
|
||||||
87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6AA1C86CE710449CC3E8FCD /* Pods_Runner.framework */; };
|
87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6AA1C86CE710449CC3E8FCD /* Pods_Runner.framework */; };
|
||||||
8D5D9D9E2C69000100F10001 /* RecordingPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D5D9D9D2C69000100F10001 /* RecordingPlugin.swift */; };
|
8D5D9D9E2C69000100F10001 /* RecordingPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D5D9D9D2C69000100F10001 /* RecordingPlugin.swift */; };
|
||||||
8E5D9D9E2C69000100F10002 /* PlatformInfoPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E5D9D9D2C69000100F10002 /* PlatformInfoPlugin.swift */; };
|
8E5D9D9E2C69000100F10002 /* PlatformInfoPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E5D9D9D2C69000100F10002 /* PlatformInfoPlugin.swift */; };
|
||||||
@@ -54,7 +53,6 @@
|
|||||||
69561E7442E8CC939DB2B482 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
69561E7442E8CC939DB2B482 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
|
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
8D5D9D9D2C69000100F10001 /* RecordingPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordingPlugin.swift; sourceTree = "<group>"; };
|
8D5D9D9D2C69000100F10001 /* RecordingPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordingPlugin.swift; sourceTree = "<group>"; };
|
||||||
8E5D9D9D2C69000100F10002 /* PlatformInfoPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatformInfoPlugin.swift; sourceTree = "<group>"; };
|
8E5D9D9D2C69000100F10002 /* PlatformInfoPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatformInfoPlugin.swift; sourceTree = "<group>"; };
|
||||||
@@ -86,7 +84,6 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
|
|
||||||
87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */,
|
87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -104,7 +101,6 @@
|
|||||||
DFA822DC4965C5AFAFF6BB41 /* Pods-RunnerTests.release.xcconfig */,
|
DFA822DC4965C5AFAFF6BB41 /* Pods-RunnerTests.release.xcconfig */,
|
||||||
99DBE6263F70650B13C33EAC /* Pods-RunnerTests.profile.xcconfig */,
|
99DBE6263F70650B13C33EAC /* Pods-RunnerTests.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
name = Pods;
|
|
||||||
path = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -128,7 +124,6 @@
|
|||||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
|
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||||
@@ -208,15 +203,14 @@
|
|||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
|
7858230D5ADC7A99F778CB03 /* [CP] Embed Pods Frameworks */,
|
||||||
|
99E9790F23C2D0C0B51A6C19 /* [CP] Copy Pods Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
packageProductDependencies = (
|
|
||||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
|
|
||||||
);
|
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
@@ -250,9 +244,6 @@
|
|||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = 97C146E51CF9000F007C117D;
|
mainGroup = 97C146E51CF9000F007C117D;
|
||||||
packageReferences = (
|
|
||||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
|
||||||
);
|
|
||||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
@@ -345,6 +336,23 @@
|
|||||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
|
7858230D5ADC7A99F778CB03 /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
alwaysOutOfDate = 1;
|
alwaysOutOfDate = 1;
|
||||||
@@ -360,6 +368,23 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
};
|
};
|
||||||
|
99E9790F23C2D0C0B51A6C19 /* [CP] Copy Pods Resources */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Copy Pods Resources";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@@ -726,20 +751,6 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCLocalSwiftPackageReference section */
|
|
||||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
|
|
||||||
isa = XCLocalSwiftPackageReference;
|
|
||||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
|
||||||
};
|
|
||||||
/* End XCLocalSwiftPackageReference section */
|
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
|
||||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
|
|
||||||
isa = XCSwiftPackageProductDependency;
|
|
||||||
productName = FlutterGeneratedPluginSwiftPackage;
|
|
||||||
};
|
|
||||||
/* End XCSwiftPackageProductDependency section */
|
|
||||||
};
|
};
|
||||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1510"
|
LastUpgradeVersion = "1510"
|
||||||
version = "1.3">
|
version = "1.7">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES">
|
buildImplicitDependencies = "YES">
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
</Testables>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Release"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||||
|
|||||||
@@ -129,14 +129,30 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
|||||||
var statusListener: (([String: Any]) -> Void)?
|
var statusListener: (([String: Any]) -> Void)?
|
||||||
|
|
||||||
func attach(previewView: RecordingPreviewView) {
|
func attach(previewView: RecordingPreviewView) {
|
||||||
self.previewView = previewView
|
let bindPreview = { [weak self, weak previewView] in
|
||||||
previewView.previewLayer.session = session
|
guard let self, let previewView else { return }
|
||||||
|
self.previewView = previewView
|
||||||
|
previewView.previewLayer.session = self.session
|
||||||
|
}
|
||||||
|
if Thread.isMainThread {
|
||||||
|
bindPreview()
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.async(execute: bindPreview)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func detach(previewView: RecordingPreviewView) {
|
func detach(previewView: RecordingPreviewView) {
|
||||||
if self.previewView === previewView {
|
let unbindPreview = { [weak self, weak previewView] in
|
||||||
self.previewView?.previewLayer.session = nil
|
guard let self, let previewView else { return }
|
||||||
self.previewView = nil
|
if self.previewView === previewView {
|
||||||
|
previewView.previewLayer.session = nil
|
||||||
|
self.previewView = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if Thread.isMainThread {
|
||||||
|
unbindPreview()
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.async(execute: unbindPreview)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,19 @@ enum ClipboardReadResult {
|
|||||||
invalid,
|
invalid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Permission> recordingGalleryPermissionsForHost({
|
||||||
|
required bool isIOS,
|
||||||
|
required bool isAndroid,
|
||||||
|
}) {
|
||||||
|
if (isIOS) {
|
||||||
|
return [Permission.photosAddOnly];
|
||||||
|
}
|
||||||
|
if (isAndroid) {
|
||||||
|
return [Permission.videos, Permission.storage];
|
||||||
|
}
|
||||||
|
return const [];
|
||||||
|
}
|
||||||
|
|
||||||
/// 开始录制所需的相机/麦克风权限检测结果。
|
/// 开始录制所需的相机/麦克风权限检测结果。
|
||||||
class RecordingRequiredPermissions {
|
class RecordingRequiredPermissions {
|
||||||
const RecordingRequiredPermissions({
|
const RecordingRequiredPermissions({
|
||||||
@@ -221,7 +234,9 @@ class RecordingViewModel extends Notifier<RecordingModel> {
|
|||||||
Future<void> restorePreview() async {
|
Future<void> restorePreview() async {
|
||||||
if (!RecordingPlatform.isSupported) return;
|
if (!RecordingPlatform.isSupported) return;
|
||||||
|
|
||||||
_updateSession((s) => s.copyWith(isPreviewReady: false, errorMessage: null));
|
_updateSession(
|
||||||
|
(s) => s.copyWith(isPreviewReady: false, errorMessage: null),
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
final status = await _initializePreviewWithRetry();
|
final status = await _initializePreviewWithRetry();
|
||||||
_updateSession(
|
_updateSession(
|
||||||
@@ -245,13 +260,10 @@ class RecordingViewModel extends Notifier<RecordingModel> {
|
|||||||
|
|
||||||
/// 当前平台所需的相册/视频保存权限列表。
|
/// 当前平台所需的相册/视频保存权限列表。
|
||||||
List<Permission> _galleryPermissions() {
|
List<Permission> _galleryPermissions() {
|
||||||
if (Platform.isIOS) {
|
return recordingGalleryPermissionsForHost(
|
||||||
return [Permission.photosAddOnly, Permission.photos];
|
isIOS: Platform.isIOS,
|
||||||
}
|
isAndroid: Platform.isAndroid,
|
||||||
if (Platform.isAndroid) {
|
);
|
||||||
return [Permission.videos, Permission.storage];
|
|
||||||
}
|
|
||||||
return const [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 判断相册相关权限是否至少有一项已授予。
|
/// 判断相册相关权限是否至少有一项已授予。
|
||||||
@@ -267,7 +279,8 @@ class RecordingViewModel extends Notifier<RecordingModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 检测并尝试申请相机、麦克风权限,同步更新 session 中的 isMicrophoneGranted。
|
/// 检测并尝试申请相机、麦克风权限,同步更新 session 中的 isMicrophoneGranted。
|
||||||
Future<RecordingRequiredPermissions> ensureCameraAndMicrophonePermissions() async {
|
Future<RecordingRequiredPermissions>
|
||||||
|
ensureCameraAndMicrophonePermissions() async {
|
||||||
final permissions = await PermissionService.requestMissing([
|
final permissions = await PermissionService.requestMissing([
|
||||||
Permission.camera,
|
Permission.camera,
|
||||||
Permission.microphone,
|
Permission.microphone,
|
||||||
@@ -303,9 +316,7 @@ class RecordingViewModel extends Notifier<RecordingModel> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!session.isPreviewReady) {
|
if (!session.isPreviewReady) {
|
||||||
_updateSession(
|
_updateSession((s) => s.copyWith(errorMessage: '相机预览未就绪,请稍后重试'));
|
||||||
(s) => s.copyWith(errorMessage: '相机预览未就绪,请稍后重试'),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class RecordHeaderWidget extends StatelessWidget {
|
|||||||
|
|
||||||
void _mockCopyEventInfo() {
|
void _mockCopyEventInfo() {
|
||||||
const strTemp =
|
const strTemp =
|
||||||
'{"title":"郑昌梦 丨黄伟依 空中格斗赛 小学组","address":"广东省汕头市番禺区青蓝街 111 号","filename":"郑昌梦_黄伟依_6月3日测试-1_空中格斗赛"}';
|
'{"title":"蔡依婷vs夏志豪 空中格斗赛 初中组","address":"黑龙江省鹤岗市11111","filename":"蔡依婷_夏志豪_测试循环赛-7_空中格斗赛"}';
|
||||||
Clipboard.setData(const ClipboardData(text: strTemp));
|
Clipboard.setData(const ClipboardData(text: strTemp));
|
||||||
AppToast.show('模拟复制赛事信息成功');
|
AppToast.show('模拟复制赛事信息成功');
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ class RecordHeaderWidget extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
Assets.images.imageLogo.path,
|
Assets.images.imageLogo.path,
|
||||||
width: 84.r,
|
width: 24.r,
|
||||||
height: 24.r,
|
height: 24.r,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
@@ -92,7 +92,7 @@ class _HeaderEventTitleRow extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -101,7 +101,7 @@ class _HeaderEventTitleRow extends StatelessWidget {
|
|||||||
fontSize: 12.sp,
|
fontSize: 12.sp,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.center,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
@@ -109,7 +109,12 @@ class _HeaderEventTitleRow extends StatelessWidget {
|
|||||||
if (!isRecording)
|
if (!isRecording)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: onClearEventInfo,
|
onPressed: onClearEventInfo,
|
||||||
icon: Icon(Icons.delete_outline, color: Colors.white, size: 22.r),
|
icon: Assets.images.imageDelete.image(
|
||||||
|
width: 15.r,
|
||||||
|
height: 15.r,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
excludeFromSemantics: true,
|
||||||
|
),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
constraints: BoxConstraints(minWidth: 40.r, minHeight: 40.r),
|
constraints: BoxConstraints(minWidth: 40.r, minHeight: 40.r),
|
||||||
tooltip: '删除',
|
tooltip: '删除',
|
||||||
@@ -137,6 +142,12 @@ class _HeaderPasteActions extends StatelessWidget {
|
|||||||
_HeaderActionButton(
|
_HeaderActionButton(
|
||||||
label: '粘贴选手信息',
|
label: '粘贴选手信息',
|
||||||
onPressed: () => onPasteEventInfo(),
|
onPressed: () => onPasteEventInfo(),
|
||||||
|
icon: Assets.images.imageCopy.image(
|
||||||
|
width: 10.r,
|
||||||
|
height: 10.r,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
excludeFromSemantics: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -144,23 +155,32 @@ class _HeaderPasteActions extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _HeaderActionButton extends StatelessWidget {
|
class _HeaderActionButton extends StatelessWidget {
|
||||||
const _HeaderActionButton({required this.label, required this.onPressed});
|
const _HeaderActionButton({
|
||||||
|
required this.label,
|
||||||
|
required this.onPressed,
|
||||||
|
this.icon,
|
||||||
|
});
|
||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
final Widget? icon;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextButton.icon(
|
return TextButton.icon(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
icon: Icon(Icons.content_paste, size: 18.r),
|
icon: icon ?? Icon(Icons.content_paste, size: 10.r),
|
||||||
label: Text(label),
|
label: Text(label),
|
||||||
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
|
minimumSize: Size.zero, // 取消 40dp 最小高度
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap, // 取消额外点击热区
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: Colors.black.withValues(alpha: 0.5),
|
backgroundColor: Colors.black.withValues(alpha: 0.5),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 14.r, vertical: 8.r),
|
textStyle: TextStyle(fontSize: 10.sp),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 7.r, vertical: 4.r),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(20.r),
|
borderRadius: BorderRadius.circular(25.r),
|
||||||
side: const BorderSide(color: Colors.white30),
|
side: const BorderSide(color: Colors.white30),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class _RecordTimerWidgetState extends ConsumerState<RecordTimerWidget> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
displayTime,
|
displayTime,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: isRecording ? Colors.white : Colors.white70,
|
color: Colors.white,
|
||||||
fontSize: 20.sp,
|
fontSize: 20.sp,
|
||||||
shadows: [Shadow(color: Colors.black54, blurRadius: 6.r)],
|
shadows: [Shadow(color: Colors.black54, blurRadius: 6.r)],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ import 'package:flutter/widgets.dart';
|
|||||||
class $AssetsImagesGen {
|
class $AssetsImagesGen {
|
||||||
const $AssetsImagesGen();
|
const $AssetsImagesGen();
|
||||||
|
|
||||||
|
/// File path: assets/images/image_copy.png
|
||||||
|
AssetGenImage get imageCopy =>
|
||||||
|
const AssetGenImage('assets/images/image_copy.png');
|
||||||
|
|
||||||
|
/// File path: assets/images/image_delete.png
|
||||||
|
AssetGenImage get imageDelete =>
|
||||||
|
const AssetGenImage('assets/images/image_delete.png');
|
||||||
|
|
||||||
/// File path: assets/images/image_dialog_bg.png
|
/// File path: assets/images/image_dialog_bg.png
|
||||||
AssetGenImage get imageDialogBg =>
|
AssetGenImage get imageDialogBg =>
|
||||||
const AssetGenImage('assets/images/image_dialog_bg.png');
|
const AssetGenImage('assets/images/image_dialog_bg.png');
|
||||||
@@ -23,7 +31,12 @@ class $AssetsImagesGen {
|
|||||||
const AssetGenImage('assets/images/image_logo.png');
|
const AssetGenImage('assets/images/image_logo.png');
|
||||||
|
|
||||||
/// List of all assets
|
/// List of all assets
|
||||||
List<AssetGenImage> get values => [imageDialogBg, imageLogo];
|
List<AssetGenImage> get values => [
|
||||||
|
imageCopy,
|
||||||
|
imageDelete,
|
||||||
|
imageDialogBg,
|
||||||
|
imageLogo,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
class Assets {
|
class Assets {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:recording_tool/features/recording/view-model/view_model_recording.dart';
|
import 'package:recording_tool/features/recording/view-model/view_model_recording.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -38,6 +39,27 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('recordingGalleryPermissionsForHost', () {
|
||||||
|
test('requests only add-only photo permission on iOS', () {
|
||||||
|
final permissions = recordingGalleryPermissionsForHost(
|
||||||
|
isIOS: true,
|
||||||
|
isAndroid: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(permissions, <Permission>[Permission.photosAddOnly]);
|
||||||
|
expect(permissions, isNot(contains(Permission.photos)));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('keeps Android gallery permissions unchanged', () {
|
||||||
|
final permissions = recordingGalleryPermissionsForHost(
|
||||||
|
isIOS: false,
|
||||||
|
isAndroid: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(permissions, <Permission>[Permission.videos, Permission.storage]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
group('RecordingViewModel.getClipboardContent', () {
|
group('RecordingViewModel.getClipboardContent', () {
|
||||||
test(
|
test(
|
||||||
'updates state when clipboard contains valid mini program JSON',
|
'updates state when clipboard contains valid mini program JSON',
|
||||||
@@ -56,14 +78,8 @@ void main() {
|
|||||||
expect(model.clipboardRecordingModel.title, '王东方 丨李想 空中格斗赛');
|
expect(model.clipboardRecordingModel.title, '王东方 丨李想 空中格斗赛');
|
||||||
expect(model.clipboardRecordingModel.startTimestamp, 1717334400);
|
expect(model.clipboardRecordingModel.startTimestamp, 1717334400);
|
||||||
expect(model.clipboardRecordingModel.endTimestamp, 1717334400);
|
expect(model.clipboardRecordingModel.endTimestamp, 1717334400);
|
||||||
expect(
|
expect(model.clipboardRecordingModel.address, '广州市番禺区·粤港澳大湾区青年人才双创小镇');
|
||||||
model.clipboardRecordingModel.address,
|
expect(model.clipboardRecordingModel.filename, '选手名称_选手ID_赛事名称_赛项');
|
||||||
'广州市番禺区·粤港澳大湾区青年人才双创小镇',
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
model.clipboardRecordingModel.filename,
|
|
||||||
'选手名称_选手ID_赛事名称_赛项',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -93,7 +109,10 @@ void main() {
|
|||||||
|
|
||||||
expect(result, ClipboardReadResult.invalid);
|
expect(result, ClipboardReadResult.invalid);
|
||||||
expect(
|
expect(
|
||||||
container.read(recordingViewModelProvider).clipboardRecordingModel.title,
|
container
|
||||||
|
.read(recordingViewModelProvider)
|
||||||
|
.clipboardRecordingModel
|
||||||
|
.title,
|
||||||
defaultClipboardTitle,
|
defaultClipboardTitle,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
@@ -113,33 +132,18 @@ void main() {
|
|||||||
|
|
||||||
expect(result, ClipboardReadResult.invalid);
|
expect(result, ClipboardReadResult.invalid);
|
||||||
expect(
|
expect(
|
||||||
container.read(recordingViewModelProvider).clipboardRecordingModel.title,
|
container
|
||||||
defaultClipboardTitle,
|
.read(recordingViewModelProvider)
|
||||||
);
|
.clipboardRecordingModel
|
||||||
});
|
.title,
|
||||||
|
|
||||||
test('returns invalid when clipboard JSON misses required address', () async {
|
|
||||||
await setClipboardText('{"title":"王东方 丨李想 空中格斗赛"}');
|
|
||||||
final container = ProviderContainer();
|
|
||||||
addTearDown(container.dispose);
|
|
||||||
|
|
||||||
final result = await container
|
|
||||||
.read(recordingViewModelProvider.notifier)
|
|
||||||
.getClipboardContent();
|
|
||||||
|
|
||||||
expect(result, ClipboardReadResult.invalid);
|
|
||||||
expect(
|
|
||||||
container.read(recordingViewModelProvider).clipboardRecordingModel.title,
|
|
||||||
defaultClipboardTitle,
|
defaultClipboardTitle,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'updates state when clipboard omits optional timestamps',
|
'returns invalid when clipboard JSON misses required address',
|
||||||
() async {
|
() async {
|
||||||
await setClipboardText(
|
await setClipboardText('{"title":"王东方 丨李想 空中格斗赛"}');
|
||||||
'{"title":"郑昌梦 丨黄伟依 空中格斗赛 小学组","address":"广东省汕头市番禺区青蓝街 111 号","filename":"郑昌梦_黄伟依_6月3日测试-1_空中格斗赛"}',
|
|
||||||
);
|
|
||||||
final container = ProviderContainer();
|
final container = ProviderContainer();
|
||||||
addTearDown(container.dispose);
|
addTearDown(container.dispose);
|
||||||
|
|
||||||
@@ -147,18 +151,36 @@ void main() {
|
|||||||
.read(recordingViewModelProvider.notifier)
|
.read(recordingViewModelProvider.notifier)
|
||||||
.getClipboardContent();
|
.getClipboardContent();
|
||||||
|
|
||||||
expect(result, ClipboardReadResult.success);
|
expect(result, ClipboardReadResult.invalid);
|
||||||
final model = container.read(recordingViewModelProvider);
|
|
||||||
expect(model.hasValidClipboardInfo, isTrue);
|
|
||||||
expect(model.clipboardRecordingModel.startTimestamp, isNull);
|
|
||||||
expect(model.clipboardRecordingModel.endTimestamp, isNull);
|
|
||||||
expect(
|
expect(
|
||||||
model.clipboardRecordingModel.filename,
|
container
|
||||||
'郑昌梦_黄伟依_6月3日测试-1_空中格斗赛',
|
.read(recordingViewModelProvider)
|
||||||
|
.clipboardRecordingModel
|
||||||
|
.title,
|
||||||
|
defaultClipboardTitle,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test('updates state when clipboard omits optional timestamps', () async {
|
||||||
|
await setClipboardText(
|
||||||
|
'{"title":"郑昌梦 丨黄伟依 空中格斗赛 小学组","address":"广东省汕头市番禺区青蓝街 111 号","filename":"郑昌梦_黄伟依_6月3日测试-1_空中格斗赛"}',
|
||||||
|
);
|
||||||
|
final container = ProviderContainer();
|
||||||
|
addTearDown(container.dispose);
|
||||||
|
|
||||||
|
final result = await container
|
||||||
|
.read(recordingViewModelProvider.notifier)
|
||||||
|
.getClipboardContent();
|
||||||
|
|
||||||
|
expect(result, ClipboardReadResult.success);
|
||||||
|
final model = container.read(recordingViewModelProvider);
|
||||||
|
expect(model.hasValidClipboardInfo, isTrue);
|
||||||
|
expect(model.clipboardRecordingModel.startTimestamp, isNull);
|
||||||
|
expect(model.clipboardRecordingModel.endTimestamp, isNull);
|
||||||
|
expect(model.clipboardRecordingModel.filename, '郑昌梦_黄伟依_6月3日测试-1_空中格斗赛');
|
||||||
|
});
|
||||||
|
|
||||||
test('returns invalid when clipboard JSON has wrong field type', () async {
|
test('returns invalid when clipboard JSON has wrong field type', () async {
|
||||||
await setClipboardText(
|
await setClipboardText(
|
||||||
'{"title":"王东方 丨李想 空中格斗赛","startTimestamp":"1717334400","endTimestamp":1717334400,"address":"广州市番禺区·粤港澳大湾区青年人才双创小镇"}',
|
'{"title":"王东方 丨李想 空中格斗赛","startTimestamp":"1717334400","endTimestamp":1717334400,"address":"广州市番禺区·粤港澳大湾区青年人才双创小镇"}',
|
||||||
@@ -172,7 +194,10 @@ void main() {
|
|||||||
|
|
||||||
expect(result, ClipboardReadResult.invalid);
|
expect(result, ClipboardReadResult.invalid);
|
||||||
expect(
|
expect(
|
||||||
container.read(recordingViewModelProvider).clipboardRecordingModel.title,
|
container
|
||||||
|
.read(recordingViewModelProvider)
|
||||||
|
.clipboardRecordingModel
|
||||||
|
.title,
|
||||||
defaultClipboardTitle,
|
defaultClipboardTitle,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
53
test/features/recording/widget_record_header_test.dart
Normal file
53
test/features/recording/widget_record_header_test.dart
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:recording_tool/features/recording/widgets/widget_record_header.dart';
|
||||||
|
import 'package:recording_tool/gen/assets.gen.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
Future<void> pumpHeader(
|
||||||
|
WidgetTester tester, {
|
||||||
|
required bool hasValidClipboardInfo,
|
||||||
|
String? eventTitle,
|
||||||
|
}) async {
|
||||||
|
await tester.pumpWidget(
|
||||||
|
ScreenUtilInit(
|
||||||
|
designSize: const Size(375, 812),
|
||||||
|
builder: (context, _) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: RecordHeaderWidget(
|
||||||
|
hasValidClipboardInfo: hasValidClipboardInfo,
|
||||||
|
eventTitle: eventTitle,
|
||||||
|
isRecording: false,
|
||||||
|
elapsedLabel: '00:00',
|
||||||
|
onPasteEventInfo: () async {},
|
||||||
|
onClearEventInfo: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
testWidgets('paste player info button uses copy image asset', (tester) async {
|
||||||
|
await pumpHeader(tester, hasValidClipboardInfo: false);
|
||||||
|
|
||||||
|
expect(find.text('粘贴选手信息'), findsOneWidget);
|
||||||
|
expect(find.image(AssetImage(Assets.images.imageCopy.path)), findsOne);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('clear player info button uses delete image asset', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
await pumpHeader(
|
||||||
|
tester,
|
||||||
|
hasValidClipboardInfo: true,
|
||||||
|
eventTitle: '王东方 丨李想 空中格斗赛',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.text('王东方 丨李想 空中格斗赛'), findsOneWidget);
|
||||||
|
expect(find.image(AssetImage(Assets.images.imageDelete.path)), findsOne);
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user