Created
April 1, 2018 16:16
-
-
Save nuxibyte/9abd551217eb3781b67e0f04f2b34fe4 to your computer and use it in GitHub Desktop.
textfieldtab
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
import 'package:flutter/material.dart'; | |
import 'package:flutter/cupertino.dart'; | |
void main() => runApp(new MaterialApp(home: new MyHomePage())); | |
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key}) : super(key: key); | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
Widget createTextFieldListView(){ | |
return new ListView( | |
shrinkWrap: true, | |
reverse: true, | |
children: <Widget>[ | |
new TextField( | |
decoration: new InputDecoration(hintText: "Add text here"), | |
), | |
new AspectRatio( | |
aspectRatio: 1.0, | |
child: new Container( | |
color: Colors.green, | |
), | |
), | |
].toList(), | |
); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return new CupertinoTabScaffold( | |
tabBar: new CupertinoTabBar( | |
items: <BottomNavigationBarItem>[ | |
new BottomNavigationBarItem(icon: new Icon(Icons.home), title: new Text("One")), | |
new BottomNavigationBarItem(icon: new Icon(Icons.home), title: new Text("Two")), | |
new BottomNavigationBarItem(icon: new Icon(Icons.home), title: new Text("Three")), | |
], | |
), | |
tabBuilder: (BuildContext context, int index) { | |
return new CupertinoTabView(builder: (BuildContext context){ | |
return new CupertinoPageScaffold( | |
navigationBar: new CupertinoNavigationBar(), | |
child: createTextFieldListView(), | |
); | |
}); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment