Created with <3 with dartpad.dev.
Last active
October 27, 2022 19:58
-
-
Save victor-carv/7bd895a569c54c440244a984c6ae87af to your computer and use it in GitHub Desktop.
mellow-diamond-8925
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( | |
restorationScopeId: 'app', | |
title: _title, | |
home: MyStatelessWidget(), | |
); | |
} | |
} | |
class MyStatelessWidget extends StatelessWidget { | |
const MyStatelessWidget({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: OutlinedButton( | |
onPressed: () { | |
Navigator.of(context).restorablePush(_dialogBuilder); | |
}, | |
child: const Text('Open Dialog'), | |
), | |
), | |
); | |
} | |
static Route<Object?> _dialogBuilder( | |
BuildContext context, Object? arguments) { | |
return RawDialogRoute<void>( | |
pageBuilder: ( | |
BuildContext context, | |
Animation<double> animation, | |
Animation<double> secondaryAnimation, | |
) { | |
return Column(children: [Text('J'), Text('A'), Text('D'), Text('S'), Text('O'), Text('N')]); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment