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

Camera Widget Implementation #31

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

bantuerfei0
Copy link

Implemented the camera widget, code directly from camera_universal package with naming changed to match context

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good! I'll need you to factor out the camera widget into it's own file, see the other widgets in the widgets directory to see how we handle comments and general style. You also need to write unit tests for the widget, this could also be super easy, you only need to check for existence and attributes. Also can create a thread for this in the PR channel in Discord and post an image of it working? I don't get a camera feed on my PC but I'm pretty sure it's because I have my webcam configured weird.

@@ -32,7 +32,7 @@ class MavlinkCommunication {
switch (_connectionType) {
case MavlinkCommunicationType.tcp:
log('[$moduleName] Trying to start TCP connection');
_startupTcpPort(connectionAddress, tcpPort);
//_startupTcpPort(connectionAddress, tcpPort);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out? Might be a mistake please undo this.

@override
Widget build(BuildContext context) {
return Scaffold(
body: Camera(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

factor out Camera and it's controller to a separate widget in the widgets directory. I know it's kinda pedantic but we want the most flexibility possible to react to pilot feedback.

@BalajiLeninrajan
Copy link
Contributor

Is there any updates on this?

Copy link
Contributor

@BalajiLeninrajan BalajiLeninrajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code looks good! It doesn't run on my PC but that might be because I have a weird config. You should be good to merge after you tend to the nitpicks I left and test/get some one to test on the WARG laptop

@@ -0,0 +1 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to complete this file to pass CI/CD

import 'package:imacs/widgets/nav_bar_widget.dart';
import 'package:imacs/widgets/camera_widget.dart';

class CameraScreen extends StatelessWidget {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add doc strings to file, see other files for examples

const PlaceholderScreen(title: 'Logs'),
'/camera': (BuildContext context) =>
const PlaceholderScreen(title: 'Camera'),
'/logs': (BuildContext context) => const LogDisplayerScreen(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the logs screen as a placeholder for now

import 'package:camera_universal/camera_universal.dart';

/// Widget to display camera feed
class CameraWidget extends StatefulWidget {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the doc string more descriptive


/// Widget to display camera feed
class CameraWidget extends StatefulWidget {
final CameraController cameraController = CameraController();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is never used, you can remove this and make the constructor const

task();
}

Future<void> task() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename function to be more descriptive and add doc string

return Scaffold(
body: Camera(
cameraController: cameraController,
onCameraNotInit: (context) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add log messages to each of the fail states

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

Successfully merging this pull request may close these issues.

2 participants