@@ -225,43 +225,33 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
225
225
226
226
/// Display the thumbnail of the captured image or video.
227
227
Widget _thumbnailWidget () {
228
- final VideoPlayerController ? localVideoController = videoController;
229
-
230
- return Expanded (
231
- child: Align (
232
- alignment: Alignment .centerRight,
233
- child: Row (
234
- mainAxisSize: MainAxisSize .min,
235
- children: < Widget > [
236
- if (localVideoController == null && imageFile == null )
237
- Container ()
238
- else
239
- SizedBox (
240
- width: 64.0 ,
241
- height: 64.0 ,
242
- child: (localVideoController == null )
243
- ? (
244
- // The captured image on the web contains a network-accessible URL
245
- // pointing to a location within the browser. It may be displayed
246
- // either with Image.network or Image.memory after loading the image
247
- // bytes to memory.
248
- kIsWeb
249
- ? Image .network (imageFile! .path)
250
- : Image .file (File (imageFile! .path)))
251
- : Container (
252
- decoration: BoxDecoration (
253
- border: Border .all (color: Colors .pink)),
254
- child: Center (
255
- child: AspectRatio (
256
- aspectRatio:
257
- localVideoController.value.aspectRatio,
258
- child: VideoPlayer (localVideoController)),
259
- ),
260
- ),
228
+ return Row (
229
+ mainAxisSize: MainAxisSize .min,
230
+ children: < Widget > [
231
+ if (videoController case final VideoPlayerController controller? )
232
+ Container (
233
+ width: 64.0 ,
234
+ height: 64.0 ,
235
+ decoration: BoxDecoration (border: Border .all (color: Colors .pink)),
236
+ child: Center (
237
+ child: AspectRatio (
238
+ aspectRatio: controller.value.aspectRatio,
239
+ child: VideoPlayer (controller),
261
240
),
262
- ],
263
- ),
264
- ),
241
+ ),
242
+ )
243
+ else if (imageFile? .path case final String path)
244
+ Container (
245
+ width: 64.0 ,
246
+ height: 64.0 ,
247
+ decoration: BoxDecoration (border: Border .all (color: Colors .pink)),
248
+ // The captured image on the web contains a network-accessible URL
249
+ // pointing to a location within the browser. It may be displayed
250
+ // either with Image.network or Image.memory after loading the image
251
+ // bytes to memory.
252
+ child: kIsWeb ? Image .network (path) : Image .file (File (path)),
253
+ ),
254
+ ],
265
255
);
266
256
}
267
257
@@ -598,7 +588,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
598
588
}
599
589
}
600
590
601
- return Row (children: toggles);
591
+ return Expanded (
592
+ child: SizedBox (
593
+ height: 56.0 ,
594
+ child: ListView (scrollDirection: Axis .horizontal, children: toggles),
595
+ ),
596
+ );
602
597
}
603
598
604
599
String timestamp () => DateTime .now ().millisecondsSinceEpoch.toString ();
@@ -1048,6 +1043,9 @@ class CameraApp extends StatelessWidget {
1048
1043
}
1049
1044
}
1050
1045
1046
+ /// Getting available cameras for testing.
1047
+ @visibleForTesting
1048
+ List <CameraDescription > get cameras => _cameras;
1051
1049
List <CameraDescription > _cameras = < CameraDescription > [];
1052
1050
1053
1051
Future <void > main () async {
0 commit comments