Skip to content

Instantly share code, notes, and snippets.

@victor-carv
Last active October 27, 2022 19:58
Show Gist options
  • Save victor-carv/7bd895a569c54c440244a984c6ae87af to your computer and use it in GitHub Desktop.
Save victor-carv/7bd895a569c54c440244a984c6ae87af to your computer and use it in GitHub Desktop.
mellow-diamond-8925
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