takePicOld method

dynamic takePicOld(
  1. dynamic formname,
  2. dynamic item,
  3. dynamic id,
  4. dynamic context,
  5. dynamic isSelfie,
)

Implementation

takePicOld(formname, item, id, context, isSelfie) async {
  myLogAll('takePicOld');
  WidgetsFlutterBinding.ensureInitialized();
  //late Future<void> initializeControllerFuture;

  availableCameras().then((value) {
    if (isSelfie) {
      _camera = value.last;
    } else {
      _camera = value.first;
    }
    _cameraController = CameraController(
      // Get a specific camera from the list of available cameras.
      _camera,
      // Define the resolution to use.
      ResolutionPreset.medium,
    );

    _initializeControllerFuture = _cameraController.initialize();

    /*_cameraWidget = const SizedBox(
        height: 200.0, width: 100.0, child: CircularProgressIndicator());*/
    showScreenPage([
      {
        gName: formname,
        gType: gScreen,
        gItems: {
          0: {
            gItem:
                '{"$gType":"$gLabel","$gValue":"Take picture","$gFontSize":24.0}'
          },
          // 1: {gItem: '{"$gType":"$gPhoto","$gValue":$isSelfie}'}
        }
      }
    ], context);
    /*FutureBuilder<void>(
      future: initializeControllerFuture,
      builder: (context, snapshot) {
        if (snapshot.connectionState == ConnectionState.done) {
          // If the Future is complete, display the preview.
          return CameraPreview(_cameraController);
        } else {
          // Otherwise, display a loading indicator.
          /*return const SizedBox(
              height: 200.0,
              width: 100.0,
              child: Center(child: CircularProgressIndicator()));*/
          return const Expanded(child: CircularProgressIndicator());
          /*return const SizedBox(
              height: 200.0,
              width: 100.0,
              child: Flexible(child: CircularProgressIndicator()));*/
        }
      },
    );*/
  });
}