Added some RepaintBoundary

This commit is contained in:
Vadim 2023-08-12 12:33:21 +02:00
parent 4917ee8aef
commit deb1ac3282
5 changed files with 119 additions and 95 deletions

View file

@ -49,6 +49,7 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
_isPressed = false;
});
},
child: RepaintBoundary(
child: SizedBox.fromSize(
size: const Size.square(Dimens.grid72),
child: Stack(
@ -77,6 +78,7 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
],
),
),
),
);
}
}

View file

@ -37,17 +37,13 @@ class MeteringBottomControls extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (onSwitchEvSourceType != null)
Expanded(
child: Center(
child: IconButton(
onPressed: onSwitchEvSourceType,
_SideIcon(
onPressed: onSwitchEvSourceType!,
icon: Icon(
context.listen<EvSourceType>() != EvSourceType.camera
? Icons.camera_rear
: Icons.wb_incandescent,
),
),
),
)
else
const Spacer(),
@ -56,14 +52,10 @@ class MeteringBottomControls extends StatelessWidget {
isMetering: isMetering,
onTap: onMeasure,
),
Expanded(
child: Center(
child: IconButton(
_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,
),
),
),
);
}
}

View file

@ -25,7 +25,8 @@ class CameraControls extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
return RepaintBoundary(
child: Column(
children: [
Expanded(
child: ExposureOffsetSlider(
@ -41,6 +42,7 @@ class CameraControls extends StatelessWidget {
onChanged: onZoomChanged,
),
],
),
);
}
}

View file

@ -22,7 +22,8 @@ class CameraPreview extends StatefulWidget {
class _CameraPreviewState extends State<CameraPreview> {
@override
Widget build(BuildContext context) {
return AspectRatio(
return RepaintBoundary(
child: AspectRatio(
aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
child: Center(
child: Stack(
@ -57,6 +58,7 @@ class _CameraPreviewState extends State<CameraPreview> {
],
),
),
),
);
}
}

View file

@ -72,7 +72,8 @@ class _ReadingValueBuilder extends StatelessWidget {
softWrap: false,
),
const SizedBox(height: Dimens.grid4),
AnimatedSwitcher(
RepaintBoundary(
child: AnimatedSwitcher(
duration: Dimens.switchDuration,
child: Text(
reading.value,
@ -81,6 +82,7 @@ class _ReadingValueBuilder extends StatelessWidget {
overflow: TextOverflow.ellipsis,
softWrap: false,
),
),
)
],
);