ButtonStyle not reducing padding - flutter

I'm trying to get my TextButtons smaller to make more room on the Row.
TextButton( // Reply button
child: Text('Reply'),
style: ButtonStyle(
padding: MaterialStateProperty.all<EdgeInsets>(EdgeInsets.fromLTRB(0, 0, 0, 0)),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
)
)
Here's what it looks like in the Inspector
Is there any way to get the buttons and the icon up close and personal with each other and get rid of those yellow lines? I must be missing something. Is there a margin property I'm missing?
Any help would be greatly appreciated.

Wrap your text button inside an sized box . It will reduce its size.Give dimensions of sized box according to your requirements.

Related

Flutter: characters' width is automatically reduced when the text reach TextField's other end

I'm trying to make a TextField that has the following feature:
The text inside such TextField can have its characters' width automatically reduced (but those characters' height is not affected) when the typed text reaches the right side of the TextField (given textAlign is TextAlign.left). If we keep typing, the width will just become smaller and smaller but the whole text will still be visible.
Below is an illustration of what I'm trying to accomplish.
How can I do that? Any help is appreciated.
You can use auto_size_text_field package, like this:
AutoSizeTextField(
controller: _controller,
minFontSize: 26,
style: TextStyle(fontSize: 60),
textAlign: TextAlign.left,
fullwidth: false,
)

How to fix "BOTTOM OVERFLOWED XXX" without scroll -related widgets

I want to locate each widgets across the height of the screen without scroll widget (It means the total height of screen is always fixed), but do not know to implement those widget generally.
For example, height of Iphone 13 is 2532 pixel but 13 pro max is 2778.
If total height of screen is fixed (non allowed to scroll), all widgets should be more shorten (like 70%-80%)than former for pro max.
Should I use MediaQuery class or other responsive libraries generally?
Making the size of height of a button dynamic is not recommended. You can check telegram signup button the height will stay but the width will be dynamic and reduced x pixel from left or right using margin.
if you are trying to make a floating button like whatsapp which is no matter size of the screen the height and width will stay, you can customize it on floatingactionbutton()
but if you still want to customize the height you can use this logic:
var heightOfMyPhone = (MediaQuery.of(context).size.height);
InkWell(
onTap: (){
//code here
},
child: Container(
height: heightOfMyPhone > 300 ? (heightOfMyPhone*0.5) : 100,
width: MediaQuery.of(context).size.width,
padding:const EdgeInsets.fromLTRB(10, 10, 10, 10),
)),

Flutter how to guarante minimum left space

Let me provide an image:
I have a rectangle. I put here two elements, O1 and TEXT (with TextAlign.center).
For now I'm using stack, so in rectangle I have:
text in container, expanded on whole width with TextAlign.Center
Small rectangle on right (O1) on screen. (positioned widget with left: 0)
All works fine but, in some cases, If text is long, text overlap O1 - it's a problem.
How to assure a minimum left starting position for text which will work on long text (text which want to overlap O1)? i.e if text want to overlap O1, then move text to right. (O1 width = 16)
What I tried?
Add left margin / padding to container of text.
It works fine for long text which wants to overlap O1. But It does not work properly on smaller text. Because TextAlign.center applies after text to right. So this text does not looks center in the biggest rectangle, only in the smaller.
You can use the overflow in Text Widget.
new Text(
'Text largeeeeeeeeeeeeeeeeeeeeeee',
overflow: TextOverflow.ellipsis,
style: new TextStyle(
fontSize: 13.0,
fontFamily: 'Roboto',
color: new Color(0xFF212121),
fontWeight: FontWeight.bold,
),
),
Just try the methods here to see which one fits best for you. This should work if text trys to overflow over its container (into O1) it will not.

Make a fluttertext grow in a row until reaches max width, then overflow

I have wanted to create the next behavior in flutter, but I can't figure out how.
Is having a text in a row with some other element, the text can have variable length. And the text space in the row should accommodate inside the row, unless the text space is larger than the remaining space in the row, then the text should use one of the text overflow options.
Here a diagram of the behavior, with the ellipsis type of text overflow:
I ave try using a combination of the row and expanded widgets, but I just can't make it.
Any suggestion?
Have you tried like this:
Row(
children: [
Flexible(
child: Text("some long text", overflow: TextOverflow.ellipsis,),
),
RaisedButton(
child: Text("Button"),
)
],
)

Change CircleAvatar size in ListTile

I want to increase the size of an CircleAvatar as Leading of a Listtile. But if i increase the Radius the Circle doesnt keep its ratio and becomes an ellipse.
Here is my Code:
ListView.builder(
itemCount: friendlist.length,
itemBuilder: (BuildContext context, int index) {
print(friendlist[index]);
return ListTile(
title: Text(friendlist[index]["nickname"],
style: TextStyle(fontSize: 20)),
leading: CircleAvatar(
radius: 50,
backgroundColor: Colors.transparent,
backgroundImage: CachedNetworkImageProvider(core.url + "profiles/" + friendlist[index]["avatar_id"]),
),
subtitle:
Text(friendlist[index]["lost_last"])
);
}));
What I tried:
Nesting the Circle Avatar into a Container with fixed Width and Height -> Circle is still an ellipse
Changing the ItemExtent of the ListView.builder -> The Circle still cant use all of the empty space and becomes an ellipse.
Thanks
This is not currently possible with ListTitle, as this is the applied restrictions they have added for the standard of the widget
To be accessible, tappable leading and trailing widgets have to be at
least 48x48 in size. However, to adhere to the Material spec, trailing
and leading widgets in one-line ListTiles should visually be at most
32 (dense: true) or 40 (dense: false) in height, which may conflict
with the accessibility requirement.
You can create custom widget for your requirement.
There is a way to change the CircleAvatar actually , There are two properties related to size: minRadius and maxRadius. The are used to set the minimum and maximum radius respectively. If you already use radius, you are not allowed to use minRadius and/or maxRadius. On the contrary, if either minRadius or maxRadius is set, you are not allowed to use radius :
CircleAvatar(
backgroundImage: NetworkImage('https://www.woolha.com/media/2020/03/eevee.png'),
minRadius: 50,
maxRadius: 75,
)