How can I achieve the multi-Line view on Text and Multi-Line TextField that can auto size the container at the bottom.
Edit:And align them properly
You have this in the following question:
Is there a way to dynamically change the Flutter TextField's maxLines?
Set this on your code:
new TextField(
maxLines: null,
keyboardType: TextInputType.multiline,
);
Related
The top section can grow and shrink based on data coming from server, the middle section is map and takes whole height available while keeping some space for a button. Any ideas how can I achieve this?
You can use Column combined with Expanded
Column(
children: [
Text('Top'),
Expanded(child: Container(color: Colors.red)),
Text('bottom'),
],
)
I dont really understand what you want but If you want to show data no matter the size of the data you wanted the show
you can use SingleChildScrollView
return SingleChildScrollView(
child: YourGrowAbleWidgetHere()
),
able the scroll
I'm making layout inside the ListView with Stack widget, but the problem is the position. Everytime I add another widget, it's always started at the TopLeft. That's why i used Symmetrical Padding. At first, it still easy, but after three widgets, i feel it's really troublesome to use Symmetrical Padding with height more than 255.0
Padding(
padding: const EdgeInsets.symmetric(vertical: 235.0)),
And, this is the short version of my layout code:
return AnimatedBuilder{
builder: (BuildContext context, Widget child) {
return Scaffold(
//BODY
body: ListView(
children: <Widget>[
new Container(
child: new Stack(
children: <Widget>[
//THE WIDGET
new Container(),
new Transform(),
new FadeTransition(),
new FadeTransition(),
new Text(),
Any help would greatly appreciated!
The Answer is in your Question Title - Use Positioned Widget for positioning widget under Stack
Now this Widget is Specifically Designed to use under Stack.
As Per Documentation:
A Positioned widget must be a descendant of a Stack, and the path from the Positioned widget to its enclosing Stack must contain only StatelessWidgets or StatefulWidgets (not other kinds of widgets, like RenderObjectWidgets).
If a widget is wrapped in a Positioned, then it is a positioned widget in its Stack. If the top property is non-null, the top edge of this child will be positioned top layout units from the top of the stack widget. The right, bottom, and left properties work analogously.
Here's my problem:
How can I create a card for each item where I don't have to worry about the number of Fields that will be on each Item without Overflowing?
From what I understand the card in this case is a square box.
Overflow errors on the UI are usually occurs when the children inside the widget exceeds their parent's dimension, unless the children inside the parent widget was wrapped with a Scrollable. A workaround that you can apply here is by using IntrinsicHeight as a parent widget to dynamically adjust its dimension base from its child widget, and use ConstrainedBox as IntrinsicHeight widget's child to set a minimum dimension for the items.
IntrinsicHeight(
child: ConstrainedBox(
constraints: const BoxConstraints(
/// Set minimum height for the item
minHeight: 100,
),
/// child widget with dynamic height goes here
child: Container(),
),
),
Or if you're looking for a staggered Grid, there's a plugin for this use case: flutter_staggered_grid_view
Using showDialog(...builder: ...), I am unable to size the content of SomeWidget.
What is happening
No matter what widgets I try to insert into the builder I cannot control sizing.
showDialog(context: context, builder: (context) => Container(
color: Colors.white,
width: 10.0,
height: 10.0,
));
No matter which values I insert into width and height, the dialog always displays full screen. The Container in this case will take up all available space. The code I posted above will result in the following:
Full size screenshot showing an Android screen, where everything except for the navigation bar, status bar and debug tag is filled out with white. (the SafeArea you can see comes from here)
Padding
Doing the same but surrounding it with a Padding and applying padding will work as sizing. Applying padding will remove parts from the side of the Container. This is the only successful way I have come up with. E.g. SizedBox or ConstrainedBox do not make a difference.
What I would like to see
Both CupertinoAlertDialog and Material AlertDialog can be inserted as a widget to the builder of showDialog and will not fill up the whole screen.
I tried figuring out what those two widgets are doing differently than me, but to me it looks like they are also using Container sizing or ConstrainedBox as sizing, which both did not work for me.
The problem is: Size itself is not enough of an information to actually render it on screen.
Flutter needs a way to know how to align that 10x10 box inside the screen.
A Center should do the trick:
showDialog(
builder: (context) {
return Center(
child: Container(),
)
}
)
AlertDialog and similar do the same for you implicitly.
You need to wrap the Container Widget with Center Widget.
Updated Code :
showDialog(
context: context,
builder: (context) => Center(
child: Container(
color: Colors.white,
width: 10.0,
height: 10.0,
),
),
);
Using Vaadin 7 , I am trying to display "tooltip" (only) if the text in a grid cell is truncatedĀ (with ellipsisĀ "...") ?
How can I find out if the text in the cell is truncated ?
I tried to find out the width of the column( comparing it to the length of the string in a cell). But the width of the column always returns "-1.0".
Thanks