This commit is contained in:
2024-10-19 14:17:37 +02:00
parent 9f98189983
commit ec76a028cb
53 changed files with 495 additions and 607 deletions

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'expectation_input_page.dart';
import 'edit_clearance_page.dart'; // Import the edit clearance page
// Import the edit clearance page
import '../widgets/clearance_field.dart';
class FinalClearanceDisplay extends StatefulWidget {
@@ -44,33 +44,6 @@ class FinalClearanceDisplayState extends State<FinalClearanceDisplay> {
}
// Navigate to Edit Clearance Page and handle returned data
Future<void> _navigateToEditClearance() async {
final result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EditClearancePage(
clearanceLimit: clearanceLimit,
route: route,
altitude: altitude,
squawk: squawk,
frequency: frequency,
isDarkMode: widget.isDarkMode,
toggleDarkMode: widget.toggleDarkMode,
),
),
);
// If the result contains updated data, update the state with the new values
if (result != null && mounted) {
setState(() {
clearanceLimit = result['clearanceLimit'];
route = result['route'];
altitude = result['altitude'];
squawk = result['squawk'];
frequency = result['frequency'];
});
}
}
// Navigate back to the first page (ExpectationInputPage)
void _navigateHome(BuildContext context) {
@@ -97,18 +70,7 @@ class FinalClearanceDisplayState extends State<FinalClearanceDisplay> {
_navigateHome(context);
},
),
actions: [
IconButton(
icon: const Icon(Icons.edit), // Edit button
onPressed: _navigateToEditClearance,
),
IconButton(
icon: Icon(widget.isDarkMode ? Icons.dark_mode : Icons.light_mode),
onPressed: () {
widget.toggleDarkMode();
},
),
],
actions: const [],
),
body: Center(
child: SingleChildScrollView(