Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
32a6914
[animations] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
64064df
[camera] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
157a932
[camera] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
8109fb3
[camera_android_camerax] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
bc09c33
[camera_avfoundation] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
dfc6124
[google_sign_in_web] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
57f7be9
[two_dimensional_scrollables] Refactor `Radio` widgets in example
alexskobozev Oct 1, 2025
7b2db36
Fix lints in animations example
alexskobozev Oct 1, 2025
fe84be7
[two_dimensional_scrollables] Fix lints in examples
alexskobozev Oct 1, 2025
b813cf9
[camera_avfoundation] Format example `main.dart`
alexskobozev Oct 1, 2025
5bcf490
Adds miscellaneous formatting fixes
alexskobozev Oct 1, 2025
c6cdb22
Merge remote-tracking branch 'upstream/main' into handle_deprecated_r…
alexskobozev Oct 2, 2025
f6b2de3
Update changelogs
alexskobozev Oct 2, 2025
09df509
Revert "Update changelogs"
alexskobozev Oct 3, 2025
7b2347e
Merge remote-tracking branch 'upstream/main' into handle_deprecated_r…
alexskobozev Oct 3, 2025
6c5c615
[google_sign_in_web] Disable RadioListTile when onChanged is null
alexskobozev Oct 3, 2025
3234a2b
[camera_avfoundation] Disable camera selection during recording
alexskobozev Oct 3, 2025
aaba578
Update changelogs
alexskobozev Oct 3, 2025
5e347e4
[google_sign_in_web] Simplify `onChanged` callback in example
alexskobozev Oct 6, 2025
3ded134
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 6, 2025
2a923fe
[google_sign_in_web] Update onChanged callback in example: pass it as…
alexskobozev Oct 7, 2025
71f6c80
Merge remote-tracking branch 'origin/handle_deprecated_radio_examples…
alexskobozev Oct 7, 2025
0839417
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 8, 2025
eceac1f
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 12, 2025
39e0367
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 16, 2025
ddc19d5
Update versions
alexskobozev Oct 16, 2025
764aef8
fix version match
alexskobozev Oct 17, 2025
abda454
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 17, 2025
587bbde
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 20, 2025
5e92e4b
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 20, 2025
a0f6243
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 21, 2025
ed108d7
update version
alexskobozev Oct 21, 2025
7c0ca21
Merge branch 'main' into handle_deprecated_radio_examples
alexskobozev Oct 22, 2025
8eba7ed
Update versions
alexskobozev Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds miscellaneous formatting fixes
  • Loading branch information
alexskobozev committed Oct 1, 2025
commit 5bcf490ea4c7785a269ca866bf50dfc2d720ee48
114 changes: 86 additions & 28 deletions packages/camera/camera_avfoundation/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(
color: controller != null && controller!.value.isRecordingVideo
color:
controller != null && controller!.value.isRecordingVideo
? Colors.redAccent
: Colors.grey,
width: 3.0,
Expand All @@ -154,7 +155,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
_modeControlRowWidget(),
Padding(
padding: const EdgeInsets.all(5.0),
child: Row(children: <Widget>[_cameraTogglesRowWidget(), _thumbnailWidget()]),
child: Row(
children: <Widget>[_cameraTogglesRowWidget(), _thumbnailWidget()],
),
),
],
),
Expand All @@ -168,7 +171,11 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
if (cameraController == null || !cameraController.value.isInitialized) {
return const Text(
'Tap a camera',
style: TextStyle(color: Colors.white, fontSize: 24.0, fontWeight: FontWeight.w900),
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.w900,
),
);
} else {
return Listener(
Expand All @@ -182,7 +189,8 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
behavior: HitTestBehavior.opaque,
onScaleStart: _handleScaleStart,
onScaleUpdate: _handleScaleUpdate,
onTapDown: (TapDownDetails details) => onViewFinderTap(details, constraints),
onTapDown: (TapDownDetails details) =>
onViewFinderTap(details, constraints),
);
},
),
Expand All @@ -201,9 +209,15 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
return;
}

_currentScale = (_baseScale * details.scale).clamp(_minAvailableZoom, _maxAvailableZoom);
_currentScale = (_baseScale * details.scale).clamp(
_minAvailableZoom,
_maxAvailableZoom,
);

await CameraPlatform.instance.setZoomLevel(controller!.cameraId, _currentScale);
await CameraPlatform.instance.setZoomLevel(
controller!.cameraId,
_currentScale,
);
}

/// Display the thumbnail of the captured image or video.
Expand All @@ -228,9 +242,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
// pointing to a location within the browser. It may be displayed
// either with Image.network or Image.memory after loading the image
// bytes to memory.
kIsWeb ? Image.network(imageFile!.path) : Image.file(File(imageFile!.path)))
kIsWeb
? Image.network(imageFile!.path)
: Image.file(File(imageFile!.path)))
: Container(
decoration: BoxDecoration(border: Border.all(color: Colors.pink)),
decoration: BoxDecoration(
border: Border.all(color: Colors.pink),
),
child: Center(
child: AspectRatio(
aspectRatio: localVideoController.value.aspectRatio,
Expand Down Expand Up @@ -263,12 +281,16 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
IconButton(
icon: const Icon(Icons.exposure),
color: Colors.blue,
onPressed: controller != null ? onExposureModeButtonPressed : null,
onPressed: controller != null
? onExposureModeButtonPressed
: null,
),
IconButton(
icon: const Icon(Icons.filter_center_focus),
color: Colors.blue,
onPressed: controller != null ? onFocusModeButtonPressed : null,
onPressed: controller != null
? onFocusModeButtonPressed
: null,
),
]
: <Widget>[],
Expand All @@ -284,7 +306,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
: Icons.screen_rotation,
),
color: Colors.blue,
onPressed: controller != null ? onCaptureOrientationLockButtonPressed : null,
onPressed: controller != null
? onCaptureOrientationLockButtonPressed
: null,
),
],
),
Expand All @@ -304,28 +328,36 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
children: <Widget>[
IconButton(
icon: const Icon(Icons.flash_off),
color: controller?.value.flashMode == FlashMode.off ? Colors.orange : Colors.blue,
color: controller?.value.flashMode == FlashMode.off
? Colors.orange
: Colors.blue,
onPressed: controller != null
? () => onSetFlashModeButtonPressed(FlashMode.off)
: null,
),
IconButton(
icon: const Icon(Icons.flash_auto),
color: controller?.value.flashMode == FlashMode.auto ? Colors.orange : Colors.blue,
color: controller?.value.flashMode == FlashMode.auto
? Colors.orange
: Colors.blue,
onPressed: controller != null
? () => onSetFlashModeButtonPressed(FlashMode.auto)
: null,
),
IconButton(
icon: const Icon(Icons.flash_on),
color: controller?.value.flashMode == FlashMode.always ? Colors.orange : Colors.blue,
color: controller?.value.flashMode == FlashMode.always
? Colors.orange
: Colors.blue,
onPressed: controller != null
? () => onSetFlashModeButtonPressed(FlashMode.always)
: null,
),
IconButton(
icon: const Icon(Icons.highlight),
color: controller?.value.flashMode == FlashMode.torch ? Colors.orange : Colors.blue,
color: controller?.value.flashMode == FlashMode.torch
? Colors.orange
: Colors.blue,
onPressed: controller != null
? () => onSetFlashModeButtonPressed(FlashMode.torch)
: null,
Expand Down Expand Up @@ -362,11 +394,15 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
TextButton(
style: styleAuto,
onPressed: controller != null
? () => onSetExposureModeButtonPressed(ExposureMode.auto)
? () =>
onSetExposureModeButtonPressed(ExposureMode.auto)
: null,
onLongPress: () {
if (controller != null) {
CameraPlatform.instance.setExposurePoint(controller!.cameraId, null);
CameraPlatform.instance.setExposurePoint(
controller!.cameraId,
null,
);
showInSnackBar('Resetting exposure point');
}
},
Expand All @@ -375,13 +411,17 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
TextButton(
style: styleLocked,
onPressed: controller != null
? () => onSetExposureModeButtonPressed(ExposureMode.locked)
? () => onSetExposureModeButtonPressed(
ExposureMode.locked,
)
: null,
child: const Text('LOCKED'),
),
TextButton(
style: styleLocked,
onPressed: controller != null ? () => controller!.setExposureOffset(0.0) : null,
onPressed: controller != null
? () => controller!.setExposureOffset(0.0)
: null,
child: const Text('RESET OFFSET'),
),
],
Expand All @@ -396,7 +436,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
min: _minAvailableExposureOffset,
max: _maxAvailableExposureOffset,
label: _currentExposureOffset.toString(),
onChanged: _minAvailableExposureOffset == _maxAvailableExposureOffset
onChanged:
_minAvailableExposureOffset ==
_maxAvailableExposureOffset
? null
: setExposureOffset,
),
Expand All @@ -412,7 +454,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>

Widget _focusModeControlRowWidget() {
final ButtonStyle styleAuto = TextButton.styleFrom(
foregroundColor: controller?.value.focusMode == FocusMode.auto ? Colors.orange : Colors.blue,
foregroundColor: controller?.value.focusMode == FocusMode.auto
? Colors.orange
: Colors.blue,
);
final ButtonStyle styleLocked = TextButton.styleFrom(
foregroundColor: controller?.value.focusMode == FocusMode.locked
Expand All @@ -438,7 +482,10 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
: null,
onLongPress: () {
if (controller != null) {
CameraPlatform.instance.setFocusPoint(controller!.cameraId, null);
CameraPlatform.instance.setFocusPoint(
controller!.cameraId,
null,
);
}
showInSnackBar('Resetting focus point');
},
Expand Down Expand Up @@ -516,10 +563,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
),
IconButton(
icon: const Icon(Icons.pause_presentation),
color: cameraController != null && cameraController.value.isPreviewPaused
color:
cameraController != null && cameraController.value.isPreviewPaused
? Colors.red
: Colors.blue,
onPressed: cameraController == null ? null : onPausePreviewButtonPressed,
onPressed: cameraController == null
? null
: onPausePreviewButtonPressed,
),
],
);
Expand Down Expand Up @@ -567,7 +617,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();

void showInSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message)));
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(message)));
}

void onViewFinderTap(TapDownDetails details, BoxConstraints constraints) {
Expand All @@ -593,7 +645,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
}
}

Future<void> _initializeCameraController(CameraDescription cameraDescription) async {
Future<void> _initializeCameraController(
CameraDescription cameraDescription,
) async {
final CameraController cameraController = CameraController(
cameraDescription,
kIsWeb ? ResolutionPreset.max : ResolutionPreset.medium,
Expand All @@ -618,10 +672,14 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
? <Future<Object?>>[
CameraPlatform.instance
.getMinExposureOffset(cameraController.cameraId)
.then((double value) => _minAvailableExposureOffset = value),
.then(
(double value) => _minAvailableExposureOffset = value,
),
CameraPlatform.instance
.getMaxExposureOffset(cameraController.cameraId)
.then((double value) => _maxAvailableExposureOffset = value),
.then(
(double value) => _maxAvailableExposureOffset = value,
),
]
: <Future<Object?>>[],
CameraPlatform.instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ class _TableExplorerState extends State<TableExplorer> {
title: Text(_getTitle()),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(50),
child: Padding(padding: const EdgeInsets.all(8.0), child: _getRadioRow()),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: _getRadioRow(),
),
),
),
body: _getTable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class _TreeExplorerState extends State<TreeExplorer> {
title: Text(_getTitle()),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(50),
child: Padding(padding: const EdgeInsets.all(8.0), child: _getRadioRow()),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: _getRadioRow(),
),
),
),
body: _getTree(),
Expand Down