import 'package:flutter/material.dart';
import 'package:get/get.dart';
import './print_controller.dart';

class PrintPage extends GetView<PrintController> {
  static const namedRoute = '/print-pdf-page';
  const PrintPage({super.key});

  @override
  Widget build(BuildContext context) {
    var printCtrl = controller;
    return PopScope(
      canPop: false,
      child: SafeArea(
        child: Scaffold(
          appBar: AppBar(
            title: const Text('PDF-Bericht'),
            centerTitle: true,
            actions: [
              IconButton(
                icon: const Icon(Icons.list, color: Colors.white),
                onPressed: () {
                  // Handle logout logic here
                  printCtrl.goToTankListPage();
                },
              ),
            ],
          ),
          body: Center(
            child: ElevatedButton(
              // Ruft die Controller-Methode auf
              onPressed: () => printCtrl.printPdfReport(),
              child: const Text('PDF erstellen & drucken'),
            ),
          ),
        ),
      ),
    );
  }
}
