Created
July 14, 2021 18:09
-
-
Save ercantomac/e27cbca966a19bf8ba96d8841a814b8a to your computer and use it in GitHub Desktop.
This file contains 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'; | |
import 'package:flutter/cupertino.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
pageTransitionsTheme: const PageTransitionsTheme(builders: { | |
TargetPlatform.android: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.windows: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.fuchsia: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), | |
}), | |
), | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Column(mainAxisSize: MainAxisSize.min, children: [ | |
OutlinedButton.icon( | |
onPressed: () async { | |
Navigator.of(context) | |
.push(MaterialPageRoute(builder: (_) => SecondPage())); | |
}, | |
icon: const Icon( | |
Icons.add_rounded, | |
size: 32.0, | |
), | |
label: const Text( | |
'SECOND PAGE CUPERTINO', | |
), | |
), | |
]), | |
); | |
} | |
} | |
class SecondPage extends StatelessWidget { | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container( | |
color: Colors.red, | |
child: OutlinedButton.icon( | |
onPressed: () async { | |
Navigator.of(context).pop(); | |
}, | |
icon: const Icon( | |
Icons.add_rounded, | |
size: 32.0, | |
), | |
label: const Text( | |
'Back', | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment