Skip to content

Instantly share code, notes, and snippets.

@redbluenat
Created March 31, 2019 16:57
Show Gist options
  • Save redbluenat/e9ec489e9c39caef11e084342df8c4b7 to your computer and use it in GitHub Desktop.
Save redbluenat/e9ec489e9c39caef11e084342df8c4b7 to your computer and use it in GitHub Desktop.
Widget cameraOptionsWidget() {
return Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
showCamera ? cameraTogglesRowWidget() : Container(),
],
),
);
}
Widget cameraTogglesRowWidget() {
final List<Widget> toggles = <Widget>[];
if (cameras != null) {
if (cameras.isEmpty) {
return const Text('No camera found');
} else {
for (CameraDescription cameraDescription in cameras) {
toggles.add(
SizedBox(
width: 90.0,
child: RadioListTile<CameraDescription>(
title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
groupValue: controller?.description,
value: cameraDescription,
onChanged: controller != null ? onNewCameraSelected : null,
),
),
);
}
}
}
return Row(children: toggles);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment