import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SecondPage extends StatelessWidget { final String title; final Widget widgetToShow; const SecondPage({ super.key, required this.title, required this.widgetToShow }); @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( slivers: [ SliverToBoxAdapter( child: Container( padding: EdgeInsets.only(left: 10, right: 10, top: MediaQuery.of(context).padding.top + 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( icon: const Icon(CupertinoIcons.chevron_left, size: 15), // Zurück-Pfeil onPressed: () { Navigator.pop(context); }, ), Text( title, style: const TextStyle(fontWeight: FontWeight.bold), ), const SizedBox(width: 40), // Platzhalter für zentrierte Ausrichtung ], ), ), ), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.all(10.0), child: widgetToShow, // Anzeigen des mitgegebenen Widgets ), ), ], ), ); } }