102 lines
2.8 KiB
Dart
102 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'expectation_input_page.dart';
|
|
import '../widgets/clearance_field.dart';
|
|
|
|
class FinalClearanceDisplay extends StatefulWidget {
|
|
final String clearanceLimit;
|
|
final String route;
|
|
final String altitude;
|
|
final String squawk;
|
|
final String frequency;
|
|
final bool isDarkMode;
|
|
final Function toggleDarkMode;
|
|
|
|
const FinalClearanceDisplay({
|
|
super.key,
|
|
required this.clearanceLimit,
|
|
required this.route,
|
|
required this.altitude,
|
|
required this.squawk,
|
|
required this.frequency,
|
|
required this.isDarkMode,
|
|
required this.toggleDarkMode,
|
|
});
|
|
|
|
@override
|
|
FinalClearanceDisplayState createState() => FinalClearanceDisplayState();
|
|
}
|
|
|
|
class FinalClearanceDisplayState extends State<FinalClearanceDisplay> {
|
|
late String clearanceLimit;
|
|
late String route;
|
|
late String altitude;
|
|
late String squawk;
|
|
late String frequency;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
clearanceLimit = widget.clearanceLimit;
|
|
route = widget.route;
|
|
altitude = widget.altitude;
|
|
squawk = widget.squawk;
|
|
frequency = widget.frequency;
|
|
}
|
|
|
|
// Navigate back to the first page (ExpectationInputPage)
|
|
void _navigateHome(BuildContext context) {
|
|
Navigator.pushAndRemoveUntil(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => ExpectationInputPage(
|
|
isDarkMode: widget.isDarkMode,
|
|
toggleDarkMode: widget.toggleDarkMode,
|
|
),
|
|
),
|
|
(Route<dynamic> route) => false,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('IFR Buddy'),
|
|
leading: IconButton(
|
|
icon: const Icon(Icons.home), // Home button
|
|
onPressed: () {
|
|
_navigateHome(context);
|
|
},
|
|
),
|
|
actions: const [],
|
|
),
|
|
body: Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Card(
|
|
elevation: 4,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Text(
|
|
'Clearance Summary',
|
|
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 20),
|
|
buildClearanceField('Clearance Limit', clearanceLimit),
|
|
buildClearanceField('Route', route),
|
|
buildClearanceField('Altitude', altitude),
|
|
buildClearanceField('Frequency', frequency),
|
|
buildClearanceField('Transponder (Squawk)', squawk),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |