Created
July 25, 2022 19:51
-
-
Save jonahwilliams/49294243b975d3cae139df4807f484c9 to your computer and use it in GitHub Desktop.
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
// Copyright 2014 The Flutter Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
debugDefaultTargetPlatformOverride = TargetPlatform.android; | |
runApp(MaterialApp( | |
home: ExampleApp(), | |
routes: { | |
'foo': (ctx) => Target(), | |
}, | |
)); | |
} | |
class ExampleApp extends StatelessWidget { | |
const ExampleApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: TextButton( | |
child: Text('Navigate'), | |
onPressed: () { | |
Navigator.of(context).pushNamed('foo'); | |
}, | |
))); | |
} | |
} | |
class Target extends StatelessWidget { | |
const Target({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: TextButton( | |
child: Text('Back'), | |
onPressed: () { | |
Navigator.of(context).pop(); | |
}, | |
))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment