Skip to content

Commit 10ee5ca

Browse files
committed
🐛 Make ThemeData properly wraps the content
1 parent c857f7e commit 10ee5ca

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

lib/src/states/camera_picker_state.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ class CameraPickerState extends State<CameraPicker>
15151515
showProgressIndicator && isShootingButtonAnimate,
15161516
duration: pickerConfig.maximumRecordingDuration!,
15171517
size: size,
1518-
ringsColor: theme.indicatorColor,
1518+
ringsColor: Theme.of(context).indicatorColor,
15191519
ringsWidth: 3,
15201520
),
15211521
),
@@ -1536,7 +1536,7 @@ class CameraPickerState extends State<CameraPicker>
15361536
required double gap,
15371537
}) {
15381538
final bool isLocked = mode == ExposureMode.locked;
1539-
final Color? color = isLocked ? _lockedColor : theme.iconTheme.color;
1539+
final color = isLocked ? _lockedColor : Theme.of(context).iconTheme.color;
15401540
final Widget lineWidget = ValueListenableBuilder<bool>(
15411541
valueListenable: isFocusPointDisplays,
15421542
builder: (_, bool value, Widget? child) => AnimatedOpacity(
@@ -1716,7 +1716,7 @@ class CameraPickerState extends State<CameraPicker>
17161716
size: pointWidth,
17171717
color: cameraValue.exposureMode == ExposureMode.locked
17181718
? _lockedColor
1719-
: theme.iconTheme.color!,
1719+
: Theme.of(context).iconTheme.color,
17201720
),
17211721
),
17221722
),

lib/src/states/camera_picker_viewer_state.dart

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class CameraPickerViewerState extends State<CameraPickerViewer> {
289289
minWidth: 20,
290290
height: 32,
291291
padding: const EdgeInsets.symmetric(horizontal: 20),
292-
color: theme.colorScheme.secondary,
292+
color: Theme.of(context).colorScheme.secondary,
293293
shape: RoundedRectangleBorder(
294294
borderRadius: BorderRadius.circular(3),
295295
),
@@ -298,7 +298,7 @@ class CameraPickerViewerState extends State<CameraPickerViewer> {
298298
child: Text(
299299
Singleton.textDelegate.confirm,
300300
style: TextStyle(
301-
color: theme.textTheme.bodyLarge?.color,
301+
color: Theme.of(context).textTheme.bodyLarge?.color,
302302
fontSize: 17,
303303
fontWeight: FontWeight.normal,
304304
),
@@ -402,15 +402,20 @@ class CameraPickerViewerState extends State<CameraPickerViewer> {
402402
deletePreviewFileIfConfigured();
403403
}
404404
},
405-
child: Material(
406-
color: Colors.black,
407-
child: Stack(
408-
fit: StackFit.expand,
409-
children: <Widget>[
410-
buildPreview(context),
411-
buildForeground(context),
412-
if (isSavingEntity) buildLoading(context),
413-
],
405+
child: Theme(
406+
data: theme,
407+
child: Builder(
408+
builder: (context) => Material(
409+
color: Colors.black,
410+
child: Stack(
411+
fit: StackFit.expand,
412+
children: <Widget>[
413+
buildPreview(context),
414+
buildForeground(context),
415+
if (isSavingEntity) buildLoading(context),
416+
],
417+
),
418+
),
414419
),
415420
),
416421
);

lib/src/widgets/camera_focus_point.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class CameraFocusPoint extends StatelessWidget {
1313
});
1414

1515
final double size;
16-
final Color color;
16+
final Color? color;
1717

1818
@override
1919
Widget build(BuildContext context) {
@@ -51,7 +51,7 @@ final class CameraFocusPointPainter extends CustomPainter {
5151
final double size;
5252
final double radius;
5353
final double strokeWidth;
54-
final Color color;
54+
final Color? color;
5555

5656
Radius get _circularRadius => Radius.circular(radius);
5757

@@ -61,8 +61,10 @@ final class CameraFocusPointPainter extends CustomPainter {
6161
final double lineLength = dividedSize.width - radius;
6262
final Paint paint = Paint()
6363
..style = PaintingStyle.stroke
64-
..color = color
6564
..strokeWidth = strokeWidth;
65+
if (color != null) {
66+
paint.color = color!;
67+
}
6668

6769
final Path path = Path()
6870
// Move to the start of the arc-line group at the left-top.

0 commit comments

Comments
 (0)