Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The screen propreties #27

Closed
DMCDoc opened this issue Dec 30, 2020 · 1 comment
Closed

The screen propreties #27

DMCDoc opened this issue Dec 30, 2020 · 1 comment

Comments

@DMCDoc
Copy link

DMCDoc commented Dec 30, 2020

hey! How are you ? I'm writting because I have a problem with your plugin.
The rotate is okay well almost, except that the method was called on null and receiver inull of course and I can't posissioned the widget because they are overflow. May be I need change one parameter but I dont know...

`import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:native_device_orientation/native_device_orientation.dart';

class Camera extends StatefulWidget {
final List cameras;
Camera({Key key, this.cameras}) : super(key: key);

@OverRide
_CameraState createState() => _CameraState();
}

class _CameraState extends State {
Future _initializeControllerFuture;
CameraController _controller;
Color colorbuttom = Colors.white54;

Future initCamera(CameraDescription camera) async {
_controller = CameraController(camera, ResolutionPreset.veryHigh);

_controller.addListener(() {
  if (mounted) {
    setState(() {});
  }
});
if (_controller.value.hasError) {
  print("camera error ${_controller.value.errorDescription}");
}

_initializeControllerFuture = _controller.initialize();

if (mounted) {
  setState(() {});
}

}

Future _cameraToggle() async {
await initCamera(widget.cameras[0]);
}

@OverRide
void initState() {
super.initState();

_cameraToggle();

}

@OverRide
void dispose() {
_controller.dispose();
super.dispose();
}

@OverRide
Widget build(BuildContext context) {
double screenwidth = MediaQuery.of(context).size.width;
double screenheight = MediaQuery.of(context).size.height;

return Scaffold(
  body: NativeDeviceOrientationReader(
    builder: (context) {
      final orientation =
          NativeDeviceOrientationReader.orientation(context);
      int turns;

      switch (orientation) {
        case NativeDeviceOrientation.landscapeLeft:
          turns = -1;

          break;
        case NativeDeviceOrientation.landscapeRight:
          turns = 1;
          break;
        case NativeDeviceOrientation.portraitDown:
          turns = 2;

          break;
        default:
          NativeDeviceOrientation.unknown;
          turns = 0;
      }

      return RotatedBox(
        quarterTurns: turns,
        child: Transform.scale(
          scale: 1 / _controller.value.aspectRatio,
          child: Center(
            child: AspectRatio(
              aspectRatio: _controller.value.aspectRatio,
              child: FutureBuilder(
                future: _initializeControllerFuture,
                builder: (context, snapshot) {
                  if (snapshot.connectionState == ConnectionState.done) {
                    return Center(
                      child: CameraPreview(
                        _controller,
                      ),
                    );
                  }
                  return Center(
                    child: Text("loading"),
                  );
                },
              ),
            ),
          ),
        ),
      );
    },
  ),
);

}
}
`
[Error - 20:31:54] Request textDocument/codeAction failed.
Message: An error occurred while handling textDocument/codeAction request
Code: -32001
[Error - 20:31:54] An error occurred while handling textDocument/codeAction request: NoSuchMethodError: The method 'packagesAvailableTo' was called on null.
Receiver: null
Tried calling: packagesAvailableTo("c:\src\flutter\.pub-cache\hosted\pub.dartlang.org\native_device_orientation-0.4.3\lib\native_device_orientation.dart")
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1 TransformSetManager.forLibrary (package:analysis_server/src/services/correction/fix/data_driven/transform_set_manager.dart:28:30)
#2 DataDriven._availableTransformSetsForLibrary (package:analysis_server/src/services/correction/dart/data_driven.dart:71:41)
#3 DataDriven.producers. (package:analysis_server/src/services/correction/dart/data_driven.dart:31:21)
#4 _SyncIterator.moveNext (dart:core-patch/core_patch.dart:165:25)
#5 FixProcessor._addFromProducers (package:analysis_server/src/services/correction/fix_internal.dart:1137:46)

#6 FixProcessor.compute (package:analysis_server/src/services/correction/fix_internal.dart:1071:11)
#7 DartFixContributor.computeFixes (package:analysis_server/src/services/correction/fix_internal.dart:174:35)
#8 CodeActionHandler._getFixActions (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:244:46)
#9 CodeActionHandler._getCodeActions (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:205:7)
#10 CodeActionHandler.handle... (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:73:18)
#11 ErrorOr.mapResult (package:analysis_server/lsp_protocol/protocol_special.dart:255:12)
#12 CodeActionHandler.handle.. (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:70:26)
#13 ErrorOr.mapResult (package:analysis_server/lsp_protocol/protocol_special.dart:255:12)
#14 CodeActionHandler.handle. (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:69:26)
#15 ErrorOr.mapResult (package:analysis_server/lsp_protocol/protocol_special.dart:255:12)
#16 CodeActionHandler.handle (package:analysis_server/src/lsp/handlers/handler_code_actions.dart:66:17)
#17 _rootRunUnary (dart:async/zone.dart:1198:47)
#18 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#19 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#20 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#21 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#22 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#23 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#24 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#25 Handler.requireResolvedUnit (package:analysis_server/src/lsp/handlers/handlers.dart)
#26 _rootRunUnary (dart:async/zone.dart:1198:47)
#27 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#28 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#29 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#30 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#31 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#32 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7)
#33 _rootRun (dart:async/zone.dart:1190:13)
#34 _CustomZone.run (dart:async/zone.dart:1093:19)
#35 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#36 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
#37 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#38 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#39 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#40 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

If you can help me...😉 thanks a lot and good happy hollidays 🎂

@rmtmckenzie
Copy link
Owner

I think should hopefully be resolved, closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants