diff --git a/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart b/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart index 99bd2ae..570093e 100644 --- a/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart +++ b/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart @@ -49,32 +49,34 @@ class _MeteringMeasureButtonState extends State { _isPressed = false; }); }, - child: SizedBox.fromSize( - size: const Size.square(Dimens.grid72), - child: Stack( - children: [ - Center( - child: AnimatedScale( - duration: Dimens.durationS, - scale: _isPressed ? 0.9 : 1.0, - child: FilledCircle( - color: Theme.of(context).colorScheme.onSurface, - size: Dimens.grid72 - Dimens.grid8, - child: Center( - child: widget.ev != null ? _EvValueText(ev: widget.ev!) : null, + child: RepaintBoundary( + child: SizedBox.fromSize( + size: const Size.square(Dimens.grid72), + child: Stack( + children: [ + Center( + child: AnimatedScale( + duration: Dimens.durationS, + scale: _isPressed ? 0.9 : 1.0, + child: FilledCircle( + color: Theme.of(context).colorScheme.onSurface, + size: Dimens.grid72 - Dimens.grid8, + child: Center( + child: widget.ev != null ? _EvValueText(ev: widget.ev!) : null, + ), ), ), ), - ), - Positioned.fill( - child: CircularProgressIndicator( - /// This key is needed to make indicator start from the same point every time - key: ValueKey(widget.isMetering), - color: Theme.of(context).colorScheme.onSurface, - value: widget.isMetering ? null : 1, + Positioned.fill( + child: CircularProgressIndicator( + /// This key is needed to make indicator start from the same point every time + key: ValueKey(widget.isMetering), + color: Theme.of(context).colorScheme.onSurface, + value: widget.isMetering ? null : 1, + ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart index 9989494..8c3a41a 100644 --- a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart +++ b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart @@ -37,16 +37,12 @@ class MeteringBottomControls extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ if (onSwitchEvSourceType != null) - Expanded( - child: Center( - child: IconButton( - onPressed: onSwitchEvSourceType, - icon: Icon( - context.listen() != EvSourceType.camera - ? Icons.camera_rear - : Icons.wb_incandescent, - ), - ), + _SideIcon( + onPressed: onSwitchEvSourceType!, + icon: Icon( + context.listen() != EvSourceType.camera + ? Icons.camera_rear + : Icons.wb_incandescent, ), ) else @@ -56,13 +52,9 @@ class MeteringBottomControls extends StatelessWidget { isMetering: isMetering, onTap: onMeasure, ), - Expanded( - child: Center( - child: IconButton( - onPressed: onSettings, - icon: const Icon(Icons.settings), - ), - ), + _SideIcon( + onPressed: onSettings, + icon: const Icon(Icons.settings), ), ], ), @@ -72,3 +64,27 @@ class MeteringBottomControls extends StatelessWidget { ); } } + +class _SideIcon extends StatelessWidget { + final Icon icon; + final VoidCallback onPressed; + + const _SideIcon({ + required this.icon, + required this.onPressed, + }); + + @override + Widget build(BuildContext context) { + return Expanded( + child: Center( + child: RepaintBoundary( + child: IconButton( + onPressed: onPressed, + icon: icon, + ), + ), + ), + ); + } +} diff --git a/lib/screens/metering/components/camera_container/components/camera_controls/widget_camera_controls.dart b/lib/screens/metering/components/camera_container/components/camera_controls/widget_camera_controls.dart index 493bbef..cdbc23b 100644 --- a/lib/screens/metering/components/camera_container/components/camera_controls/widget_camera_controls.dart +++ b/lib/screens/metering/components/camera_container/components/camera_controls/widget_camera_controls.dart @@ -25,22 +25,24 @@ class CameraControls extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - children: [ - Expanded( - child: ExposureOffsetSlider( - range: exposureOffsetRange, - value: exposureOffsetValue, - onChanged: onExposureOffsetChanged, + return RepaintBoundary( + child: Column( + children: [ + Expanded( + child: ExposureOffsetSlider( + range: exposureOffsetRange, + value: exposureOffsetValue, + onChanged: onExposureOffsetChanged, + ), ), - ), - const SizedBox(height: Dimens.grid24), - ZoomSlider( - range: zoomRange, - value: zoomValue, - onChanged: onZoomChanged, - ), - ], + const SizedBox(height: Dimens.grid24), + ZoomSlider( + range: zoomRange, + value: zoomValue, + onChanged: onZoomChanged, + ), + ], + ), ); } } diff --git a/lib/screens/metering/components/camera_container/components/camera_preview/widget_camera_preview.dart b/lib/screens/metering/components/camera_container/components/camera_preview/widget_camera_preview.dart index 288c678..5b57521 100644 --- a/lib/screens/metering/components/camera_container/components/camera_preview/widget_camera_preview.dart +++ b/lib/screens/metering/components/camera_container/components/camera_preview/widget_camera_preview.dart @@ -22,39 +22,41 @@ class CameraPreview extends StatefulWidget { class _CameraPreviewState extends State { @override Widget build(BuildContext context) { - return AspectRatio( - aspectRatio: PlatformConfig.cameraPreviewAspectRatio, - child: Center( - child: Stack( - children: [ - const CameraViewPlaceholder(error: null), - AnimatedSwitcher( - duration: Dimens.switchDuration, - child: widget.controller != null - ? ValueListenableBuilder( - valueListenable: widget.controller!, - builder: (_, __, ___) => widget.controller!.value.isInitialized - ? Stack( - alignment: Alignment.bottomCenter, - children: [ - CameraView(controller: widget.controller!), - if (MeteringScreenLayout.featureOf( - context, - MeteringScreenLayoutFeature.histogram, - )) - Positioned( - left: Dimens.grid8, - right: Dimens.grid8, - bottom: Dimens.grid16, - child: CameraHistogram(controller: widget.controller!), - ), - ], - ) - : const SizedBox.shrink(), - ) - : CameraViewPlaceholder(error: widget.error), - ), - ], + return RepaintBoundary( + child: AspectRatio( + aspectRatio: PlatformConfig.cameraPreviewAspectRatio, + child: Center( + child: Stack( + children: [ + const CameraViewPlaceholder(error: null), + AnimatedSwitcher( + duration: Dimens.switchDuration, + child: widget.controller != null + ? ValueListenableBuilder( + valueListenable: widget.controller!, + builder: (_, __, ___) => widget.controller!.value.isInitialized + ? Stack( + alignment: Alignment.bottomCenter, + children: [ + CameraView(controller: widget.controller!), + if (MeteringScreenLayout.featureOf( + context, + MeteringScreenLayoutFeature.histogram, + )) + Positioned( + left: Dimens.grid8, + right: Dimens.grid8, + bottom: Dimens.grid16, + child: CameraHistogram(controller: widget.controller!), + ), + ], + ) + : const SizedBox.shrink(), + ) + : CameraViewPlaceholder(error: widget.error), + ), + ], + ), ), ), ); diff --git a/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart b/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart index 3254456..8a5f993 100644 --- a/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart +++ b/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart @@ -72,14 +72,16 @@ class _ReadingValueBuilder extends StatelessWidget { softWrap: false, ), const SizedBox(height: Dimens.grid4), - AnimatedSwitcher( - duration: Dimens.switchDuration, - child: Text( - reading.value, - style: textTheme.titleMedium?.copyWith(color: textColor), - maxLines: 1, - overflow: TextOverflow.ellipsis, - softWrap: false, + RepaintBoundary( + child: AnimatedSwitcher( + duration: Dimens.switchDuration, + child: Text( + reading.value, + style: textTheme.titleMedium?.copyWith(color: textColor), + maxLines: 1, + overflow: TextOverflow.ellipsis, + softWrap: false, + ), ), ) ],