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

Create waypoint queue widget #25

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

Conversation

ashum68
Copy link

@ashum68 ashum68 commented Jul 15, 2024

No description provided.

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.

Pretty good so far! Try looking into doing some data validation with the inputFormatters attr of Textfield, it makes sure the input matches a regex.

void _queueWaypoint() {
_getWaypointsFromInput();
widget.queueWaypoints.queueWaypoint(
widget.systemId, widget.componentId, _latitude, _longitude, _altitude);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a , after _altitude

void _queueWaypointWithoutQueue() {
_getWaypointsFromInput();
widget.queueWaypoints.sendWaypointWithoutQueue(
widget.systemId, widget.componentId, _latitude, _longitude, _altitude);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a , after _altitude

widget.queueWaypoints.queueWaypoint(
widget.systemId, widget.componentId, _latitude, _longitude, _altitude);
setState(() {
_widgetKey.currentState?.reassemble();
Copy link
Contributor

Choose a reason for hiding this comment

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

reassemble only runs on debug not builds, you might want to test the widget without this

Copy link
Author

Choose a reason for hiding this comment

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

without this, the widget does not update the table when a waypoint is added. what other method could I use to refresh the table so that it repopulates everything in the queue?

),
),
const SizedBox(height: 16),
ElevatedButton(
Copy link
Contributor

Choose a reason for hiding this comment

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

Try putting the last two ElevatedButtons in an OverflowBar widget with a set spacing attr

const SizedBox(height: 16),
ElevatedButton(
onPressed: _queueWaypoint,
child: const Text('Add Waypoint to Queue')),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add , between ))

const SizedBox(height: 16),
ElevatedButton(
onPressed: _queueWaypointWithoutQueue,
child: const Text('Send Waypoint Immediately')),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add , between ))

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.

Sorry this took so long, I was trying (and failing 🥲 ) to debug the test. I have more time on my hand this week so hopefully I can figure out what's going on. You can work on the other comments in the meantime. Otherwise it looks pretty good!

'Waypoint Queue',
style: TextStyle(fontWeight: FontWeight.bold),
),
Expanded(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would caution against using Expanded, could cause some weirdness when putting this next to other widgets


@override
Widget build(BuildContext context) {
return Column(
Copy link
Contributor

Choose a reason for hiding this comment

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

Temporarily wrap this in a SizedBox with a fixed height and width for testing and showcase. It will be merged this way but we'll change it when integrating widget together (which is pretty far down the line)

}

@override
Widget build(BuildContext context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to center the elements

child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using SizedBox for the TextFields, try to make them dynamically fill the size they have. Only start implementing this change once you wrap everything in a SizedBox with fixed width though, otherwise it won't render.

border: OutlineInputBorder(),
hintText: 'Latitude',
),
controller: _latitudeInput,
Copy link
Contributor

Choose a reason for hiding this comment

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

consider adding inputFormatters to the 'TextFields'. These use Regex, so you'll need find or create one that only accepts valid rational numbers.

widget.queueWaypoints.sendNextWaypointInQueue();
setState(() {});
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I've confirmed this with Aaron, you can send all the waypoints at once and mavlink will just kinda figure it out. The best way to do this is to create a method in the queueWaypoints class to handle this, lmk if you want to try doing that or if I should do that for you.

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