Skip to content

Commit

Permalink
nested listview in an expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
ashum68 committed Jul 19, 2024
1 parent 403fb21 commit 9b2d055
Showing 1 changed file with 81 additions and 79 deletions.
160 changes: 81 additions & 79 deletions flutter_app/lib/widgets/waypoint_queue_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,93 +93,95 @@ class WaypointQueueState extends State<WaypointQueue> {

@override
Widget build(BuildContext context) {
return ListView(
children: [
const Text(
'Waypoint Queue',
style: TextStyle(fontWeight: FontWeight.bold),
),
DataTable(
columns: const [
DataColumn(label: Text('Latitude')),
DataColumn(label: Text('Longitude')),
DataColumn(label: Text('Altitude')),
],
rows: widget.queueWaypoints.waypointQueue
.map(
((element) => DataRow(
cells: <DataCell>[
DataCell(Text(element.x.toString())),
DataCell(Text(element.y.toString())),
DataCell(Text(element.z.toString())),
],
)),
)
.toList(),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _sendNextWaypointInQueue,
child: const Text('Send Next Waypoint in Queue to Drone')),
const SizedBox(height: 16),
const Text(
'Enter a Waypoint Below',
style: TextStyle(fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Latitude',
return Expanded(
child: ListView(
children: [
const Text(
'Waypoint Queue',
style: TextStyle(fontWeight: FontWeight.bold),
),
DataTable(
columns: const [
DataColumn(label: Text('Latitude')),
DataColumn(label: Text('Longitude')),
DataColumn(label: Text('Altitude')),
],
rows: widget.queueWaypoints.waypointQueue
.map(
((element) => DataRow(
cells: <DataCell>[
DataCell(Text(element.x.toString())),
DataCell(Text(element.y.toString())),
DataCell(Text(element.z.toString())),
],
)),
)
.toList(),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _sendNextWaypointInQueue,
child: const Text('Send Next Waypoint in Queue to Drone')),
const SizedBox(height: 16),
const Text(
'Enter a Waypoint Below',
style: TextStyle(fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Latitude',
),
controller: _latitudeInput,
),
controller: _latitudeInput,
),
),
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Longitude',
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Longitude',
),
controller: _longitudeInput,
),
controller: _longitudeInput,
),
),
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Altitude',
SizedBox(
width: 120,
height: 40,
child: TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Altitude',
),
controller: _altitudeInput,
),
controller: _altitudeInput,
),
),
],
),
),
const SizedBox(height: 16),
OverflowBar(spacing: 10, children: [
ElevatedButton(
onPressed: _queueWaypoint,
child: const Text('Add Waypoint to Queue'),
],
),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _queueWaypointWithoutQueue,
child: const Text('Send Waypoint Immediately'),
),
]),
],
OverflowBar(spacing: 10, children: [
ElevatedButton(
onPressed: _queueWaypoint,
child: const Text('Add Waypoint to Queue'),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _queueWaypointWithoutQueue,
child: const Text('Send Waypoint Immediately'),
),
]),
],
),
);
}
}

0 comments on commit 9b2d055

Please sign in to comment.