Skip to content

Commit 0b5d1b1

Browse files
authored
Merge pull request #920 from abalmagd/master
Fix zoomAndPan not having an effect
2 parents 1369e9d + d51d4e5 commit 0b5d1b1

File tree

7 files changed

+91
-65
lines changed

7 files changed

+91
-65
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
paths-ignore:
6-
- '**.md'
7-
push:
8-
branches:
9-
- master
5+
types: [opened, synchronize, reopened]
106
paths-ignore:
117
- '**.md'
128
workflow_dispatch:
@@ -15,24 +11,56 @@ concurrency:
1511
group: ${{ github.workflow }}-${{ github.ref }}
1612
cancel-in-progress: true
1713

14+
env:
15+
# Define global environment variables for the workflow
16+
# The version of Flutter to use should use the minimum Dart SDK version supported by the package,
17+
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
18+
# Note: The version below should be manually updated to the latest second most recent version
19+
# after a new stable version comes out.
20+
# Current minimum is set to Flutter 3.29. Make this the new minimum once the next
21+
# stable version is released
22+
FLUTTER_VERSION_MINIMUM_DEFAULT: "3.29.3"
23+
FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT: "3.x"
24+
1825
jobs:
26+
setup_matrix:
27+
name: Determine Flutter Test Versions # Name for the setup_matrix job
28+
runs-on: ubuntu-latest
29+
outputs:
30+
flutter_versions_json: ${{ steps.set_versions.outputs.versions_json }}
31+
flutter_version_minimum: ${{ steps.set_versions.outputs.version_min }}
32+
steps:
33+
- name: Determine Flutter versions
34+
id: set_versions
35+
run: |
36+
MIN_VERSION_VALUE="${{ env.FLUTTER_VERSION_MINIMUM_DEFAULT }}"
37+
LATEST_VERSION_VALUE="${{ env.FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT }}"
38+
39+
echo "version_min=$MIN_VERSION_VALUE" >> $GITHUB_OUTPUT
40+
echo "version_latest=$LATEST_VERSION_VALUE" >> $GITHUB_OUTPUT
41+
42+
VERSIONS_JSON=$(jq -c --null-input '$ARGS.positional' --args "$MIN_VERSION_VALUE" "$LATEST_VERSION_VALUE")
43+
echo "versions_json=$VERSIONS_JSON" >> $GITHUB_OUTPUT
44+
45+
echo "Determined Min Version: $MIN_VERSION_VALUE"
46+
echo "Determined Latest Version: $LATEST_VERSION_VALUE"
47+
echo "Determined JSON: $VERSIONS_JSON"
48+
1949
# Does a sanity check that packages at least pass analysis on the N-1
2050
# versions of Flutter stable if the package claims to support that version.
2151
# This is to minimize accidentally making changes that break old versions
2252
# (which we don't commit to supporting, but don't want to actively break)
2353
# without updating the constraints.
2454
lint_and_build:
2555
name: Flutter Version ${{ matrix.flutter-version }} Lint and Build.
56+
needs: setup_matrix # Ensures this job runs after setup_matrix completes
2657
runs-on: ubuntu-latest
58+
env:
59+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
60+
FLUTTER_VERSION_MINIMUM: ${{ needs.setup_matrix.outputs.flutter_version_minimum }}
2761
strategy:
2862
matrix:
29-
flutter-version:
30-
# The version of Flutter to use should use the minimum Dart SDK version supported by the package,
31-
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
32-
# Note: The version below should be manually updated to the latest second most recent version
33-
# after a new stable version comes out.
34-
- "3.29.3"
35-
- "3.x"
63+
flutter-version: ${{ fromJSON(needs.setup_matrix.outputs.flutter_versions_json) }}
3664
fail-fast: false
3765
steps:
3866
- name: 📚 Git Checkout
@@ -51,6 +79,10 @@ jobs:
5179

5280
- name: ✨ Check Formatting
5381
run: dart format --set-exit-if-changed lib
82+
# Only continue on error if this is the job for the MINIMUM Flutter version
83+
# This allows formatting issues to be warnings on older supported versions
84+
# but enforces them on the latest stable or primary development version.
85+
continue-on-error: ${{ matrix.flutter-version == env.FLUTTER_VERSION_MINIMUM }}
5486

5587
- name: 🕵️ Analyze
5688
run: flutter analyze lib

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (keystorePropertiesFile.exists()) {
3131

3232
android {
3333
namespace "com.example.example"
34-
compileSdk 34
34+
compileSdk 35
3535

3636
compileOptions {
3737
sourceCompatibility JavaVersion.VERSION_17

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
1212
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13-
5B171717BA079CE808D1B32C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73C604A80B929E096139088E /* Pods_RunnerTests.framework */; };
1413
65355E45871BBAC473F56EC4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 161F52A253A901BB69307277 /* Pods_Runner.framework */; };
1514
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1615
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -50,11 +49,8 @@
5049
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5150
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5251
6AEFCF184013ED5CA996B82B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
53-
6D5C22CEED22C7791375B03E /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
54-
73C604A80B929E096139088E /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5552
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
5653
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
57-
75018BE4F219FC27188BF5C2 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
5854
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
5955
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
6056
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
@@ -63,7 +59,6 @@
6359
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6460
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6561
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
66-
CCE42FB5D8CBF00852B83E23 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
6762
D9EB2FAA5097BC9A403E4AC5 /* 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>"; };
6863
/* End PBXFileReference section */
6964

@@ -80,7 +75,6 @@
8075
isa = PBXFrameworksBuildPhase;
8176
buildActionMask = 2147483647;
8277
files = (
83-
5B171717BA079CE808D1B32C /* Pods_RunnerTests.framework in Frameworks */,
8478
);
8579
runOnlyForDeploymentPostprocessing = 0;
8680
};
@@ -93,9 +87,6 @@
9387
D9EB2FAA5097BC9A403E4AC5 /* Pods-Runner.debug.xcconfig */,
9488
6AEFCF184013ED5CA996B82B /* Pods-Runner.release.xcconfig */,
9589
0EA25D90DB1772C2D6071B55 /* Pods-Runner.profile.xcconfig */,
96-
CCE42FB5D8CBF00852B83E23 /* Pods-RunnerTests.debug.xcconfig */,
97-
75018BE4F219FC27188BF5C2 /* Pods-RunnerTests.release.xcconfig */,
98-
6D5C22CEED22C7791375B03E /* Pods-RunnerTests.profile.xcconfig */,
9990
);
10091
name = Pods;
10192
path = Pods;
@@ -105,7 +96,6 @@
10596
isa = PBXGroup;
10697
children = (
10798
161F52A253A901BB69307277 /* Pods_Runner.framework */,
108-
73C604A80B929E096139088E /* Pods_RunnerTests.framework */,
10999
);
110100
name = Frameworks;
111101
sourceTree = "<group>";
@@ -172,7 +162,6 @@
172162
isa = PBXNativeTarget;
173163
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
174164
buildPhases = (
175-
3FADDB6B4D6AA8657115BAF4 /* [CP] Check Pods Manifest.lock */,
176165
331C807D294A63A400263BE5 /* Sources */,
177166
331C807F294A63A400263BE5 /* Resources */,
178167
ADF676FEC51290FAF51E0789 /* Frameworks */,
@@ -303,28 +292,6 @@
303292
shellPath = /bin/sh;
304293
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
305294
};
306-
3FADDB6B4D6AA8657115BAF4 /* [CP] Check Pods Manifest.lock */ = {
307-
isa = PBXShellScriptBuildPhase;
308-
buildActionMask = 2147483647;
309-
files = (
310-
);
311-
inputFileListPaths = (
312-
);
313-
inputPaths = (
314-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
315-
"${PODS_ROOT}/Manifest.lock",
316-
);
317-
name = "[CP] Check Pods Manifest.lock";
318-
outputFileListPaths = (
319-
);
320-
outputPaths = (
321-
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
322-
);
323-
runOnlyForDeploymentPostprocessing = 0;
324-
shellPath = /bin/sh;
325-
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";
326-
showEnvVarsInLog = 0;
327-
};
328295
6B3BB5498CBA14DCD8E20CF8 /* [CP] Check Pods Manifest.lock */ = {
329296
isa = PBXShellScriptBuildPhase;
330297
buildActionMask = 2147483647;
@@ -488,7 +455,6 @@
488455
};
489456
331C8088294A63A400263BE5 /* Debug */ = {
490457
isa = XCBuildConfiguration;
491-
baseConfigurationReference = CCE42FB5D8CBF00852B83E23 /* Pods-RunnerTests.debug.xcconfig */;
492458
buildSettings = {
493459
BUNDLE_LOADER = "$(TEST_HOST)";
494460
CODE_SIGN_STYLE = Automatic;
@@ -506,7 +472,6 @@
506472
};
507473
331C8089294A63A400263BE5 /* Release */ = {
508474
isa = XCBuildConfiguration;
509-
baseConfigurationReference = 75018BE4F219FC27188BF5C2 /* Pods-RunnerTests.release.xcconfig */;
510475
buildSettings = {
511476
BUNDLE_LOADER = "$(TEST_HOST)";
512477
CODE_SIGN_STYLE = Automatic;
@@ -522,7 +487,6 @@
522487
};
523488
331C808A294A63A400263BE5 /* Profile */ = {
524489
isa = XCBuildConfiguration;
525-
baseConfigurationReference = 6D5C22CEED22C7791375B03E /* Pods-RunnerTests.profile.xcconfig */;
526490
buildSettings = {
527491
BUNDLE_LOADER = "$(TEST_HOST)";
528492
CODE_SIGN_STYLE = Automatic;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -54,11 +55,13 @@
5455
buildConfiguration = "Debug"
5556
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5657
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5759
launchStyle = "0"
5860
useCustomWorkingDirectory = "NO"
5961
ignoresPersistentStateOnLaunch = "NO"
6062
debugDocumentVersioning = "YES"
6163
debugServiceExtension = "internal"
64+
enableGPUValidationMode = "1"
6265
allowLocationSimulation = "YES">
6366
<BuildableProductRunnable
6467
runnableDebuggingMode = "0">

example/lib/app/app.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
109109
_chewieController = ChewieController(
110110
videoPlayerController: _videoPlayerController1,
111111
autoPlay: true,
112+
zoomAndPan: true,
112113
looping: true,
113114
progressIndicatorDelay:
114115
bufferDelay != null ? Duration(milliseconds: bufferDelay!) : null,

lib/src/chewie_player.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ class ChewieController extends ChangeNotifier {
380380
cupertinoProgressColors ?? this.cupertinoProgressColors,
381381
materialProgressColors:
382382
materialProgressColors ?? this.materialProgressColors,
383+
zoomAndPan: zoomAndPan ?? this.zoomAndPan,
384+
maxScale: maxScale ?? this.maxScale,
385+
controlsSafeAreaMinimum:
386+
controlsSafeAreaMinimum ?? this.controlsSafeAreaMinimum,
387+
transformationController:
388+
transformationController ?? this.transformationController,
383389
materialSeekButtonFadeDuration:
384390
materialSeekButtonFadeDuration ?? this.materialSeekButtonFadeDuration,
385391
materialSeekButtonSize:
@@ -490,10 +496,14 @@ class ChewieController extends ChangeNotifier {
490496
/// Whether or not to show the controls at all
491497
final bool showControls;
492498

493-
/// Controller to pass into the [InteractiveViewer] component
499+
/// Controller to pass into the [InteractiveViewer] component.
500+
/// If it is required to control the transformation only via the controller,
501+
/// `zoomAndPan` should be set to false.
494502
final TransformationController? transformationController;
495503

496-
/// Whether or not to allow zooming and panning
504+
/// Whether or not to allow zooming and panning.
505+
/// This can still be false, and the `transformationController` can be used to control the
506+
/// transformation.
497507
final bool zoomAndPan;
498508

499509
/// Max scale when zooming

lib/src/player_with_controls.dart

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,17 @@ class PlayerWithControls extends StatelessWidget {
3333
ChewieController chewieController,
3434
BuildContext context,
3535
) {
36-
return Stack(
37-
children: <Widget>[
36+
final playerNotifier = context.read<PlayerNotifier>();
37+
final child = Stack(
38+
children: [
3839
if (chewieController.placeholder != null)
3940
chewieController.placeholder!,
40-
InteractiveViewer(
41-
transformationController: chewieController.transformationController,
42-
maxScale: chewieController.maxScale,
43-
panEnabled: chewieController.zoomAndPan,
44-
scaleEnabled: chewieController.zoomAndPan,
45-
child: Center(
46-
child: AspectRatio(
47-
aspectRatio:
48-
chewieController.aspectRatio ??
49-
chewieController.videoPlayerController.value.aspectRatio,
50-
child: VideoPlayer(chewieController.videoPlayerController),
51-
),
41+
Center(
42+
child: AspectRatio(
43+
aspectRatio:
44+
chewieController.aspectRatio ??
45+
chewieController.videoPlayerController.value.aspectRatio,
46+
child: VideoPlayer(chewieController.videoPlayerController),
5247
),
5348
),
5449
if (chewieController.overlay != null) chewieController.overlay!,
@@ -80,6 +75,27 @@ class PlayerWithControls extends StatelessWidget {
8075
),
8176
],
8277
);
78+
79+
if (chewieController.zoomAndPan ||
80+
chewieController.transformationController != null) {
81+
return InteractiveViewer(
82+
transformationController: chewieController.transformationController,
83+
maxScale: chewieController.maxScale,
84+
panEnabled: chewieController.zoomAndPan,
85+
scaleEnabled: chewieController.zoomAndPan,
86+
onInteractionUpdate:
87+
chewieController.zoomAndPan
88+
? (_) => playerNotifier.hideStuff = true
89+
: null,
90+
onInteractionEnd:
91+
chewieController.zoomAndPan
92+
? (_) => playerNotifier.hideStuff = false
93+
: null,
94+
child: child,
95+
);
96+
}
97+
98+
return child;
8399
}
84100

85101
return LayoutBuilder(

0 commit comments

Comments
 (0)