Skip to content

Instantly share code, notes, and snippets.

@JohanScheepers
Created March 6, 2025 20:25
Show Gist options
  • Save JohanScheepers/34c2353fc5271e8611bc5170134950aa to your computer and use it in GitHub Desktop.
Save JohanScheepers/34c2353fc5271e8611bc5170134950aa to your computer and use it in GitHub Desktop.
Popup
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Eligibility Confirmation App',
theme: ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.grey[900], // Dark background
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool _isConfirmed = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Eligibility Checker'),
backgroundColor: Colors.grey[850], //Dark AppBar color
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: () {
_showEligibilityConfirmationDialog(context);
},
child: const Text('Check Advanced Bracket Eligibility'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[200], // Adjust color as needed
),
),
SizedBox(height: 20),
Text(
_isConfirmed
? 'Eligibility Confirmed!'
: 'Eligibility Not Confirmed',
style: TextStyle(
color: _isConfirmed ? Colors.greenAccent : Colors.redAccent,
fontSize: 20,
),
),
],
),
),
);
}
Future<void> _showEligibilityConfirmationDialog(BuildContext context) async {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: Colors.grey[800], // Dark background for the dialog
shape: RoundedRectangleBorder( // Add this to round the AlertDialog corners
borderRadius: BorderRadius.circular(10.0),
),
content: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.amber[800]!, width: 1), // Border
borderRadius: BorderRadius.circular(10.0), // Match AlertDialog corners
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min, // Important for correct sizing
children: [
Container(
decoration: BoxDecoration(
color: Colors.amber[800], // Yellow background for the title
borderRadius: BorderRadius.circular(5),
),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.warning, color: Colors.black), // Warning icon
const SizedBox(width: 5),
const Text(
'Eligibility Confirmation',
style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
),
],
),
),
const SizedBox(height: 10),
const Text(
'The "Advanced" bracket requires an official ranking. By selecting this, you confirm that you meet the requirements.',
style: TextStyle(color: Colors.white),
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child: const Text('Cancel', style: TextStyle(color: Colors.white)),
onPressed: () {
Navigator.of(context).pop();
},
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[700], // Adjust color as needed
),
child: const Text('Confirm', style: TextStyle(color: Colors.white)),
onPressed: () {
setState(() {
_isConfirmed = true;
});
Navigator.of(context).pop();
},
),
],
),
],
),
),
),
);
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment