From 9a29fd5a820022a567d4fc789287885f848e912e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20L=C3=B6ffler?= <1911374@stud.hs-mannheim.de> Date: Wed, 10 Jan 2024 14:50:22 +0100 Subject: [PATCH] Upload files to "Pong/lib" --- Pong/lib/pong_menu.dart | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Pong/lib/pong_menu.dart diff --git a/Pong/lib/pong_menu.dart b/Pong/lib/pong_menu.dart new file mode 100644 index 0000000..e2f6fe1 --- /dev/null +++ b/Pong/lib/pong_menu.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; + +class PongMenu extends StatelessWidget { + // Constructor to initialize the PongMenu with required properties + const PongMenu({ + super.key, + required this.title, + required this.subTitle, + required this.child, + }); + + final String title; + final String subTitle; + final Widget child; + + @override + Widget build(BuildContext context) { + // Get the size of the screen + final mq = MediaQuery.of(context).size; + // Calculate the height and width of the dialog + final dialogHeight = mq.height * 0.4; + final dialogWidth = mq.width * 0.8; + + // Return a custom-styled Dialog with specified properties + return Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + elevation: 0, + backgroundColor: Colors.transparent, + child: Container( + width: dialogWidth, + height: dialogHeight, + decoration: BoxDecoration( + color: const Color.fromARGB(255, 33, 33, 33), + borderRadius: BorderRadius.circular(25), + ), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + // Display the title with custom styling + Text( + title, + style: const TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + // Display the subTitle with custom styling + Text( + subTitle, + style: const TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + // Display the child widget + child, + ], + ), + ), + ); + } +}