Created
July 3, 2018 11:55
-
-
Save SteveAlexander/92a2f11584456e529f67e1453dd18063 to your computer and use it in GitHub Desktop.
reproducing https://github.com/flutter/flutter/issues/11895
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'; | |
void main() { | |
runApp(new MaterialApp( | |
home: new DefaultTabController( | |
length: 3, | |
child: new SafeArea( | |
child: new Scaffold( | |
bottomNavigationBar: new Container( | |
child: new TabBar( | |
labelColor: Colors.black, | |
labelStyle: TextStyle(fontSize: 20.0), | |
tabs: [ | |
Text('foo'), | |
Text('bar'), | |
Text('baz'), | |
] | |
), | |
), | |
body: new TabBarView( | |
children: [ | |
new FooPage(), | |
new BarPage(), | |
new BazPage(), | |
] | |
) | |
) | |
) | |
) | |
) | |
); | |
} | |
class FooPage extends StatefulWidget { | |
@override | |
FooState createState() => new FooState(); | |
} | |
class FooState extends State<FooPage> with AutomaticKeepAliveClientMixin<FooPage> { | |
@override | |
bool get wantKeepAlive => true; | |
@override | |
Widget build(BuildContext context) { | |
return new Center( | |
child: new Text('foo') | |
); | |
} | |
} | |
class BarPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new Center( | |
child: new Text('bar') | |
); | |
} | |
} | |
class BazPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new Center( | |
child: new Text('baz') | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment