flutter-layout

Flutter: Column align items to have the same width

孤街浪徒 提交于 2020-05-26 04:11:08
问题 I'm trying to align the widgets inside the column to be in the center with CrossAxisAlignment.center but I also want that the Widgets have the same width. How can I achieve this? 回答1: you can get something similar to that by setting the CrossAxisAlignment to stretch and then wrap the Column in a IntrinsicWidth and if you want to give them a specific width use the stepWidth property Center( child: IntrinsicWidth( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>

How to add the widgets dynamically to column in Flutter?

此生再无相见时 提交于 2020-05-25 07:47:26
问题 I have added a few widgets inside the ListView . So that I can scroll all widgets. Now I required to add one more widget to the ListView to load the list of comments. I can not add the ListView inside the ListView . And moreover, I do not require the separate scroll for my comments. It should be scroll along with the widgets inside the ListView . So I planned to add the Column instead of ListView . Could any help to add my comments dynamically in the Columns ? new Expanded( child: new

Flutter navigation for part of screen

假装没事ソ 提交于 2020-05-25 07:15:13
问题 How can I push a widget in the frame of another widget? For example I have a Column with 2 Containers where every Container takes half of the screen. I'd like to make a navigation e.g. only in the bottom container. The same logic as in iOS when the container view has it's own UINavigationController. As I understood MaterialPageRoute can push widgets only to fullscreen and there aren't any other Route classes, except abstract ones. Maybe I should make my own subclass of ModalRoute

Flutter navigation for part of screen

…衆ロ難τιáo~ 提交于 2020-05-25 07:14:12
问题 How can I push a widget in the frame of another widget? For example I have a Column with 2 Containers where every Container takes half of the screen. I'd like to make a navigation e.g. only in the bottom container. The same logic as in iOS when the container view has it's own UINavigationController. As I understood MaterialPageRoute can push widgets only to fullscreen and there aren't any other Route classes, except abstract ones. Maybe I should make my own subclass of ModalRoute

Flutter Multiline for text

别来无恙 提交于 2020-05-25 05:51:33
问题 All I need is my text to be multi-line. Am giving the property of maxLines but its still getting RenderFlex overflowed error to the right as the next is not going to 2nd line, Align( alignment: Alignment.bottomCenter, child: new ButtonBar( alignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: EdgeInsets.all(20.0), child: new Text( "This is a very bigggggggg text !!!",textDirection: TextDirection.ltr, style: new TextStyle(fontSize: 20.0, color: Colors.white), maxLines: 2,

How to hide android's bottom navigation bar in flutter

孤街醉人 提交于 2020-05-25 04:52:07
问题 I'm really new in flutter and also in Android dev, but is it possible to hide the bottom navigation bar (see which item do i mean below) programmatically? 回答1: Try this: SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]); Document 回答2: Use SystemChrome.setEnabledSystemUIOverlays([]) to hide the status bar and the navigation bar. 来源: https://stackoverflow.com/questions/52365173/how-to-hide-androids-bottom-navigation-bar-in-flutter

Space between Column's children in Flutter

為{幸葍}努か 提交于 2020-05-24 20:08:29
问题 I have a Column widget with two TextField widgets as children and I want to have some space between both of them. I already tried mainAxisAlignment: MainAxisAlignment.spaceAround , but the result was not what I wanted. 回答1: You can use Padding widget in between those two widget or wrap those widgets with Padding widget. Update SizedBox widget can be use in between two widget to add space between two widget and it makes code more readable than padding widget. Ex: Column( children: <Widget>[

Space between Column's children in Flutter

爷,独闯天下 提交于 2020-05-24 20:08:21
问题 I have a Column widget with two TextField widgets as children and I want to have some space between both of them. I already tried mainAxisAlignment: MainAxisAlignment.spaceAround , but the result was not what I wanted. 回答1: You can use Padding widget in between those two widget or wrap those widgets with Padding widget. Update SizedBox widget can be use in between two widget to add space between two widget and it makes code more readable than padding widget. Ex: Column( children: <Widget>[

How to get the SliverPersistentHeader to “overgrow”

与世无争的帅哥 提交于 2020-05-24 15:55:11
问题 I'm using a SliverPersistentHeader in my CustomScrollView to have a persistent header that shrinks and grows when the user scrolls, but when it reaches its maximum size it feels a bit stiff since it doesn't "overgrow". Here is a video of the behaviour I want (from the Spotify app) and the behaviour I have: . 回答1: While looking for a solution for this problem, I came across three different ways to solve it: Create a Stack that contains the CustomScrollView and a header widget (overlaid on top

How to get the SliverPersistentHeader to “overgrow”

余生长醉 提交于 2020-05-24 15:54:07
问题 I'm using a SliverPersistentHeader in my CustomScrollView to have a persistent header that shrinks and grows when the user scrolls, but when it reaches its maximum size it feels a bit stiff since it doesn't "overgrow". Here is a video of the behaviour I want (from the Spotify app) and the behaviour I have: . 回答1: While looking for a solution for this problem, I came across three different ways to solve it: Create a Stack that contains the CustomScrollView and a header widget (overlaid on top