2024-01-10 14:36:14 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class PongMenu extends StatelessWidget {
|
2024-01-10 14:36:24 +01:00
|
|
|
// Constructor to initialize the PongMenu with required properties
|
2024-01-10 14:36:14 +01:00
|
|
|
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) {
|
2024-01-10 14:36:24 +01:00
|
|
|
// Get the size of the screen
|
2024-01-10 14:36:14 +01:00
|
|
|
final mq = MediaQuery.of(context).size;
|
2024-01-10 14:36:24 +01:00
|
|
|
// Calculate the height and width of the dialog
|
2024-01-10 14:36:14 +01:00
|
|
|
final dialogHeight = mq.height * 0.4;
|
|
|
|
final dialogWidth = mq.width * 0.8;
|
2024-01-10 14:36:24 +01:00
|
|
|
|
|
|
|
// Return a custom-styled Dialog with specified properties
|
2024-01-10 14:36:14 +01:00
|
|
|
return Dialog(
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
|
|
elevation: 0,
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
child: Container(
|
|
|
|
width: dialogWidth,
|
|
|
|
height: dialogHeight,
|
|
|
|
decoration: BoxDecoration(
|
2024-01-10 14:36:24 +01:00
|
|
|
color: const Color.fromARGB(255, 33, 33, 33),
|
2024-01-10 14:36:14 +01:00
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
2024-01-10 14:36:24 +01:00
|
|
|
// Display the title with custom styling
|
2024-01-10 14:36:14 +01:00
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 30,
|
|
|
|
fontWeight: FontWeight.bold,
|
2024-01-10 14:36:24 +01:00
|
|
|
color: Colors.white,
|
2024-01-10 14:36:14 +01:00
|
|
|
),
|
|
|
|
),
|
2024-01-10 14:36:24 +01:00
|
|
|
// Display the subTitle with custom styling
|
2024-01-10 14:36:14 +01:00
|
|
|
Text(
|
|
|
|
subTitle,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 30,
|
|
|
|
fontWeight: FontWeight.bold,
|
2024-01-10 14:36:24 +01:00
|
|
|
color: Colors.white,
|
2024-01-10 14:36:14 +01:00
|
|
|
),
|
|
|
|
),
|
2024-01-10 14:36:24 +01:00
|
|
|
// Display the child widget
|
2024-01-10 14:36:14 +01:00
|
|
|
child,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|