Skip to content

Instantly share code, notes, and snippets.

@Nash0x7E2
Created September 23, 2019 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nash0x7E2/db008ff5028e5fc9824f8cc1ce4c7bb4 to your computer and use it in GitHub Desktop.
Save Nash0x7E2/db008ff5028e5fc9824f8cc1ce4c7bb4 to your computer and use it in GitHub Desktop.
Sample code demonstrating back navigation bug in Flutter 1.10.5
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Cupertino Page Transition test'),
),
body: ListView(
children: List.generate(
40,
(int index) {
return ListTile(
title: Text('Item $index'),
onTap: () => Navigator.of(context).push(CupertinoPageDemo.route()),
);
},
),
),
);
}
}
class CupertinoPageDemo extends StatelessWidget {
static Route<dynamic> route() {
return CupertinoPageRoute(
builder: (BuildContext context) {
return CupertinoPageDemo();
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: const Text('Second Page'),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment