Skip to content

Instantly share code, notes, and snippets.

@ercantomac
Created July 14, 2021 18:09
Show Gist options
  • Save ercantomac/e27cbca966a19bf8ba96d8841a814b8a to your computer and use it in GitHub Desktop.
Save ercantomac/e27cbca966a19bf8ba96d8841a814b8a to your computer and use it in GitHub Desktop.
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