[READ ONLY MIRROR] Open Source TikTok alternative built on AT Protocol github.com/sprksocial/client
flutter atproto video dart
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(camera): flip button

+38 -4
+33 -3
lib/src/features/posting/providers/camera_provider.dart
··· 124 124 return; 125 125 } 126 126 127 - _logger.d('Flipping camera'); 127 + final fallbackIndex = currentState.selectedCameraIndex.clamp( 128 + 0, 129 + currentState.cameras.length - 1, 130 + ); 131 + final currentCamera = currentState.controller?.description; 132 + final currentLensDirection = 133 + currentCamera?.lensDirection ?? 134 + currentState.cameras[fallbackIndex].lensDirection; 135 + final targetLensDirection = switch (currentLensDirection) { 136 + CameraLensDirection.front => CameraLensDirection.back, 137 + CameraLensDirection.back => CameraLensDirection.front, 138 + _ => null, 139 + }; 128 140 129 - final newIndex = 130 - (currentState.selectedCameraIndex + 1) % currentState.cameras.length; 141 + if (targetLensDirection == null) { 142 + _logger.w( 143 + 'Cannot flip camera - unsupported lens direction: ' 144 + '$currentLensDirection', 145 + ); 146 + return; 147 + } 148 + 149 + final newIndex = currentState.cameras.indexWhere( 150 + (camera) => camera.lensDirection == targetLensDirection, 151 + ); 152 + if (newIndex < 0) { 153 + _logger.w( 154 + 'Cannot flip camera - no camera found for lens direction: ' 155 + '$targetLensDirection', 156 + ); 157 + return; 158 + } 159 + 160 + _logger.d('Flipping camera'); 131 161 final newCamera = currentState.cameras[newIndex]; 132 162 final oldController = currentState.controller; 133 163
+5 -1
lib/src/features/posting/ui/pages/recording_page.dart
··· 483 483 ); 484 484 } 485 485 486 + final availableLensDirections = cameraState.cameras 487 + .map((camera) => camera.lensDirection) 488 + .toSet(); 486 489 final canFlipCamera = 487 - cameraState.cameras.length > 1 && 490 + availableLensDirections.contains(CameraLensDirection.front) && 491 + availableLensDirections.contains(CameraLensDirection.back) && 488 492 !recordingState.isRecording && 489 493 !cameraState.isFlipping; 490 494 final aspectRatio = cameraState.controller!.value.aspectRatio;