imagePreviewButton method
Implementation
Widget imagePreviewButton() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
buttons(
icon: Icon(Icons.close, size: iconSize, color: iconColor),
backgroundColor: Colors.white.withValues(alpha: 0.1),
onPressed: () {
widget._controller.cameraController?.pausePreview();
Navigator.pop(context, widget._controller.files);
},
),
isRecording ? timerWidget(seconds) : const SizedBox(),
Row(
children: [
widget._controller.allowFlashControl
? SizedBox(
height: 52,
width: 52,
child: PageView.builder(
scrollDirection: Axis.vertical,
physics: const NeverScrollableScrollPhysics(),
controller: _flashPageController,
itemCount: flashIcons.length,
itemBuilder: (context, index) {
return IconButton(
onPressed: () {
try{
final page = (index + 1) % flashIcons.length;
_flashPageController.animateToPage(page,
duration: const Duration(milliseconds: 400),
curve: Curves.ease);
widget._controller.cameraController
?.setFlashMode(flashModes.elementAt(page));
} catch(e){
debugPrint("CameraException: ${e}");
}
},
icon: Icon(flashIcons.elementAt(index)),
color: Colors.white);
},
),
)
: SizedBox(width: iconSize),
widget._controller.autoCaptureInterval != -1
? IconButton(
onPressed: () {
setState(() {
widget._controller.intervalPause =
!widget._controller.intervalPause;
});
},
icon: Icon(
widget._controller.intervalPause
? Icons.timer_off
: Icons.timer,
color: Colors.white,
),
)
: const SizedBox.shrink(),
],
),
],
),
);
}