Created with <3 with dartpad.dev.
Created
October 27, 2022 20:06
-
-
Save victor-carv/341cd22e132f9086354e98369504e4c5 to your computer and use it in GitHub Desktop.
yawning-end-2583
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
static const String _title = 'Flutter Code Sample'; | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
title: _title, | |
home: MyStatelessWidget(), | |
); | |
} | |
} | |
class MyStatelessWidget extends StatelessWidget { | |
const MyStatelessWidget({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: OutlinedButton( | |
onPressed: () { | |
showGeneralDialog( | |
context: context, | |
pageBuilder: (BuildContext buildContext, | |
Animation<double> animation, | |
Animation<double> secondaryAnimation) { | |
return Wrap( | |
children: <Widget>[ | |
Center( | |
child: Container( | |
width: MediaQuery.of(context).size.width * 0.5, | |
height: MediaQuery.of(context).size.width * 0.5, | |
color: Colors.orange, | |
child: Column(children: [ | |
Text('J'), | |
Text('A'), | |
Text('D'), | |
Text('S'), | |
Text('O'), | |
Text('N') | |
])), | |
) | |
], | |
); | |
}, | |
barrierDismissible: true, | |
barrierLabel: | |
MaterialLocalizations.of(context).modalBarrierDismissLabel, | |
barrierColor: Colors.black.withOpacity(0.5), | |
transitionDuration: const Duration(milliseconds: 200), | |
); | |
}, | |
child: const Text('Open Dialog'), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment