flutter_application_1/lib/widgets/second_page_widget.dart

51 lines
1.4 KiB
Dart
Raw Normal View History

2024-05-24 14:04:26 +02:00
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: <Widget>[
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
),
),
],
),
);
}
}