Posts

Showing posts with the label flutter

Adding tab labels to TabView in Flutter

Adding tab labels to TabView in Flutter I'm trying to extend the TabView proposed as an answer here. Specifically, instead of the grey dots, I would like to have category labels, and load as a tab content a widget corresponding to that category. I tried following the docs, but if I change something in the AppBar it just gives me a reendering error. 2 Answers 2 You can achieve what you wanted via TabController widget. I found a simple example of TabBar here. You can achieve what you wanted via DefaultTabController widget. You can see the example here with only the icons. And here is the modified version of it with titles. TabBar part is for the tab and it's specifications. TabBarView is for the interior view. DefaultTabController TabBar TabBarView class TabBarDemo extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: DefaultTabCon...

Flutter Stack size to sibling

Flutter Stack size to sibling Is there a way to size a stack child automatically to its largest sibling? I.e. if I have a Stack with a ListTile and a Container on top, how do I make sure the Container covers the entire ListTile ? Stack ListTile Container Container ListTile Example: new Stack(children: <Widget>[ new ListTile( leading: new AssetImage('foo.jpg'), title: new Text('Bar'), subtitle: new Text('yipeee'), isThreeLine: true, ), new Container(color: Colors.grey, child: new Text('foo')) ], ) I tried to make it work with Row , Column and Expanded but am running into problems with unbounded constraints. Row Column Expanded Is there a way to size the Container (or any other widget such as a GestureDetector ) to its largest sibling in the stack? Container GestureDetector pub.dartlang.org/packages/after_layout might be able to help you ...