Skip to content

Commit 34683ac

Browse files
authored
Migrating styleFrom API to new version. (#4540)
Updates the styleFrom API to use `backgroundColor` and `foregroundColor` instead of deprecated methods (`primary`, `onPrimary`). Fixes [#105724](flutter/flutter#105724)
1 parent ac41376 commit 34683ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+127
-214
lines changed

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.5+3
2+
3+
* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.
4+
15
## 0.10.5+2
26

37
* Fixes unawaited_futures violations.

packages/camera/camera/example/lib/main.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
365365

366366
Widget _exposureModeControlRowWidget() {
367367
final ButtonStyle styleAuto = TextButton.styleFrom(
368-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
369-
// ignore: deprecated_member_use
370-
primary: controller?.value.exposureMode == ExposureMode.auto
368+
foregroundColor: controller?.value.exposureMode == ExposureMode.auto
371369
? Colors.orange
372370
: Colors.blue,
373371
);
374372
final ButtonStyle styleLocked = TextButton.styleFrom(
375-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
376-
// ignore: deprecated_member_use
377-
primary: controller?.value.exposureMode == ExposureMode.locked
373+
foregroundColor: controller?.value.exposureMode == ExposureMode.locked
378374
? Colors.orange
379375
: Colors.blue,
380376
);
@@ -452,16 +448,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
452448

453449
Widget _focusModeControlRowWidget() {
454450
final ButtonStyle styleAuto = TextButton.styleFrom(
455-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
456-
// ignore: deprecated_member_use
457-
primary: controller?.value.focusMode == FocusMode.auto
451+
foregroundColor: controller?.value.focusMode == FocusMode.auto
458452
? Colors.orange
459453
: Colors.blue,
460454
);
461455
final ButtonStyle styleLocked = TextButton.styleFrom(
462-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
463-
// ignore: deprecated_member_use
464-
primary: controller?.value.focusMode == FocusMode.locked
456+
foregroundColor: controller?.value.focusMode == FocusMode.locked
465457
? Colors.orange
466458
: Colors.blue,
467459
);

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
44
Dart.
55
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
7-
version: 0.10.5+2
7+
version: 0.10.5+3
88

99
environment:
1010
sdk: ">=2.18.0 <4.0.0"

packages/camera/camera_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.8+6
2+
3+
* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.
4+
15
## 0.10.8+5
26

37
* Provides a default exposure point if null.

packages/camera/camera_android/example/lib/main.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,16 +368,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
368368

369369
Widget _exposureModeControlRowWidget() {
370370
final ButtonStyle styleAuto = TextButton.styleFrom(
371-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
372-
// ignore: deprecated_member_use
373-
primary: controller?.value.exposureMode == ExposureMode.auto
371+
foregroundColor: controller?.value.exposureMode == ExposureMode.auto
374372
? Colors.orange
375373
: Colors.blue,
376374
);
377375
final ButtonStyle styleLocked = TextButton.styleFrom(
378-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
379-
// ignore: deprecated_member_use
380-
primary: controller?.value.exposureMode == ExposureMode.locked
376+
foregroundColor: controller?.value.exposureMode == ExposureMode.locked
381377
? Colors.orange
382378
: Colors.blue,
383379
);
@@ -456,16 +452,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
456452

457453
Widget _focusModeControlRowWidget() {
458454
final ButtonStyle styleAuto = TextButton.styleFrom(
459-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
460-
// ignore: deprecated_member_use
461-
primary: controller?.value.focusMode == FocusMode.auto
455+
foregroundColor: controller?.value.focusMode == FocusMode.auto
462456
? Colors.orange
463457
: Colors.blue,
464458
);
465459
final ButtonStyle styleLocked = TextButton.styleFrom(
466-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
467-
// ignore: deprecated_member_use
468-
primary: controller?.value.focusMode == FocusMode.locked
460+
foregroundColor: controller?.value.focusMode == FocusMode.locked
469461
? Colors.orange
470462
: Colors.blue,
471463
);

packages/camera/camera_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
55

6-
version: 0.10.8+5
6+
version: 0.10.8+6
77

88
environment:
99
sdk: ">=2.18.0 <4.0.0"

packages/camera/camera_android_camerax/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.0+13
2+
3+
* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.
4+
15
## 0.5.0+12
26

37
* Wraps classes needed to implement resolution configuration for image capture, image analysis, and preview.

packages/camera/camera_android_camerax/example/lib/main.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,16 +357,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
357357

358358
Widget _exposureModeControlRowWidget() {
359359
final ButtonStyle styleAuto = TextButton.styleFrom(
360-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
361-
// ignore: deprecated_member_use
362-
primary: controller?.value.exposureMode == ExposureMode.auto
360+
foregroundColor: controller?.value.exposureMode == ExposureMode.auto
363361
? Colors.orange
364362
: Colors.blue,
365363
);
366364
final ButtonStyle styleLocked = TextButton.styleFrom(
367-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
368-
// ignore: deprecated_member_use
369-
primary: controller?.value.exposureMode == ExposureMode.locked
365+
foregroundColor: controller?.value.exposureMode == ExposureMode.locked
370366
? Colors.orange
371367
: Colors.blue,
372368
);
@@ -439,16 +435,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
439435

440436
Widget _focusModeControlRowWidget() {
441437
final ButtonStyle styleAuto = TextButton.styleFrom(
442-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
443-
// ignore: deprecated_member_use
444-
primary: controller?.value.focusMode == FocusMode.auto
438+
foregroundColor: controller?.value.focusMode == FocusMode.auto
445439
? Colors.orange
446440
: Colors.blue,
447441
);
448442
final ButtonStyle styleLocked = TextButton.styleFrom(
449-
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
450-
// ignore: deprecated_member_use
451-
primary: controller?.value.focusMode == FocusMode.locked
443+
foregroundColor: controller?.value.focusMode == FocusMode.locked
452444
? Colors.orange
453445
: Colors.blue,
454446
);

packages/camera/camera_android_camerax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_android_camerax
22
description: Android implementation of the camera plugin using the CameraX library.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.5.0+12
5+
version: 0.5.0+13
66

77
environment:
88
sdk: ">=2.19.0 <4.0.0"

packages/camera/camera_avfoundation/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 0.9.13+3
22

3+
* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.
34
* Fixes unawaited_futures violations.
45

56
## 0.9.13+2

0 commit comments

Comments
 (0)