Bottom overflowed by 100.0 pxl - flutter

I have this UI :UI
And the text is showing this yellow bar, even when I set the maxlines to 3..
I put them in a container and its still like this!
child: Container(
height: 150,
width: 200,
child: Column(children: [
Text(
allRecipes[index].name,
style: TextStyle(color: Colors.black54,
fontSize: 20,),
),
Text(
allRecipes[index].about,
softWrap: true,
maxLines: 3,
style: TextStyle(
fontSize: 14,)
),
Also, I need help from you so I can make more space between the food cards??

Its because your Container Height.
try to increase this and check,
your Container height is 150
increase this 200 or 250. as per your design requirement.
Container(
height: 250,//like this
width: 200,
child: Column(children: [
Text(
allRecipes[index].name,
style: TextStyle(color: Colors.black54,
fontSize: 20,),
),
Text(
allRecipes[index].about,
softWrap: true,
maxLines: 3,
style: TextStyle(
fontSize: 14,)
),
]
)

Related

Flutter align Column of text with single text

I would like to make this in Flutter:
My code:
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: const [
Text('Total', style: TextStyle( color: Color(0xFF68B762)),),
Text('Km', style: TextStyle( color: Color(0xFF68B762)),),
],),
const Text('612', style: TextStyle(fontSize: 30, fontFamily: SecondaryFontMedium, color: Color(0xFF68B762)),),
],),
Result:
Add \n between "Total" and "Km". Use like this way,
Row(
children: [
Text('Total\nKm', textAlign: TextAlign.end, style: TextStyle(color: Color(0xFF68B762))),
Text('612',
style: TextStyle(
fontSize: 30,
fontFamily: SecondaryFontMedium,
color: Color(0xFF68B762))),
],
)
Result:
If you want the Total and Km closer together you could try setting a height in the style. For example
Text('Total', style: TextStyle(height: 1, color: Color(0xFF68B762))),
Text('Km', style: TextStyle(height: 1, color: Color(0xFF68B762)),),
result:
I don't know if the error is the spacing, or that the letters on the left are not aligned, but I got something like this :
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 40, // change this
color: Colors.white,
child: FittedBox( // this is important
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: const [
Text(
'Total',
style: TextStyle(color: Color(0xFF68B762)),
),
Text(
'Km',
style: TextStyle(color: Color(0xFF68B762)),
),
],
),
),
),
Container(
height: 40, // change this
color: Colors.white,
child: const FittedBox( // this is important
child: Text(
'612',
style: TextStyle(
height: 1, // this is important
fontSize: 45,
color: Color(0xFF68B762),
),
),
),
),
],
)
What I did was to add both Container with some equal size (40 for example), then using the Widget FittedBox makes that when you lower the height of the container, the letter adapts and you don't have problems...
Now in the second letter to remove the "padding" is added the height : 1 in the TextStyle, if you can read more of it would be good so you don't have problems but basically it makes it possible to align with the left letters.
Try to edit the height Container and you'll see
try this,
return MaterialApp(
home: Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Total\nKm',
textAlign: TextAlign.right,
style: TextStyle(color: Color(0xFF68B762)),
),
SizedBox(
width: 5,
),
Text(
'612',
style: TextStyle(
fontSize: 30,
// fontFamily: SecondaryFontMedium,
color: Color(0xFF68B762)),
),
],
),
),
),
);
Happy Coding!

AutoSizeText with Marquee - How can the text be scrolled instead of being resized?

enter image description here
AutoSizeText(
Dummy.locations[index]['name'],
maxLines: 1,
overflowReplacement: Marquee(
scrollAxis: Axis.horizontal,
velocity: 5,
text: Dummy.locations[index]['name'],
style: const TextStyle(fontSize: 18, color: Colors.white)),
style: const TextStyle(fontSize: 18, color: Colors.white),),
The AutoSizeText widget does not replace to Marquee if the text is overflowed.
I just found out and to someone who needs, we just need to do the following things:
Specify the minFontSize property of AutoSizeText
Wrap Marquee widget with a width and height specified Container or SizedBox as the code below
AutoSizeText(
Dummy.locations[index]['name'],
maxLines: 1,
minFontSize: 18,
overflowReplacement: SizedBox(
width: 180,
height: 18,
child: Marquee(
scrollAxis: Axis.horizontal,
velocity: 5,
text:'${Dummy.locations[index]['name']} ',
style: const TextStyle(fontSize: 18,color: Colors.white)),
),
style: const TextStyle(fontSize: 18, color: Colors.white),
),

Child already specified | Flutter container with headline and subheadline

When there are no results loaded on the app, there is a headline and subheadline explaining how to work the application.
However, when results are loaded into the app the Headline and subheadline disappear, and then show the imageArray in place of both
I am unable to group the headline and subheadline together because I am following a specific UI, and thus they require different font styles, but adding them both in a separate child seems to throw an error as the child is already specified.
What's the best way to rectify this?
Container(
margin: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
height: MediaQuery.of(context).size.height * .8,
child: imageArray.isEmpty
? Center(
child: Text(
‘HEADLINE’,
style: TextStyle(
fontSize: 19,
fontFamily: 'Avenir',
fontWeight: FontWeight.w900,
),
),
child: Text(
‘SUBHEADLINE’,
style: TextStyle(
fontSize: 16,
fontFamily: 'Avenir',
fontWeight: FontWeight.w500,
),
),
)
: GridView.count(
crossAxisCount: 2,
children: List.generate(imageArray.length, (index) {
var img = imageArray[index];
return Container(child: Image.file(img));
})))
]),
)
]));
}
}
According to the official documentation:
All layout widgets have either of the following:
A child property if they take a single child—for example, Center or Container
A children property if they take a list of widgets—for example, Row, Column, ListView, or Stack.
The problem with the code is that Center only takes a single widget as its child. In order to display both of your Text, you'll need to use something such as Column with children property. This should work:
Container(
margin: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
height: MediaQuery.of(context).size.height * .8,
child: imageArray.isEmpty
? Column( // Use the Column here instead of Center
children: [
Text(
'TITLE',
style: TextStyle(
fontSize: 19,
fontFamily: 'Avenir',
fontWeight: FontWeight.w900,
),
),
Text( // Remove the `child:` property
'SUBTITLE',
style: TextStyle(
fontSize: 16,
fontFamily: 'Avenir',
fontWeight: FontWeight.w500,
),
),
],
)
: GridView.count(
crossAxisCount: 2,
children: List.generate(
imageArray.length,
(index) {
var img = imageArray[index];
return Container(child: Image.file(img));
},
),
),
);
Change your Center to a Column this can take a List<Widget> called children as opposed to a singular child
Container(
margin: EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
height: MediaQuery.of(context).size.height * .8,
child: imageArray.isEmpty
? Column(
children: [ Text(
‘HEADLINE’,
style: TextStyle(
fontSize: 19,
fontFamily: 'Avenir',
fontWeight: FontWeight.w900,
),
),
Text(
‘SUBHEADLINE’,
style: TextStyle(
fontSize: 16,
fontFamily: 'Avenir',
fontWeight: FontWeight.w500,
),
),
]
)
: GridView.count(
crossAxisCount: 2,
children: List.generate(imageArray.length, (index) {
var img = imageArray[index];
return Container(child: Image.file(img));
})))
]),
)
]));
}
You could also add a Column to the child of your Center if you would prefer that styling.
But Column has the built in functionality to display its children where you want with mainAxisAlignment

I have a problem with a personalized text

THe principal problem is when i a put a text with textile with personalized font the heigh by default is 0.0, but when i try to change the height the space is infinite and the text dissapear.
Container(
//height: 200,
//width: 20,
alignment: Alignment.centerLeft,
child: Text(
"Parece que olvidaste tu\ncontraseña, ¿Qué deseas hacer?",
textAlign: TextAlign.start,
style: TextStyle(
//fontFamily: 'GothamBook',
height: 0.6,
fontSize: 16.0,
fontStyle: FontStyle.normal,
),
))

Flickering Issues with ListScrollView Flutter

Hi I made a scroll list view and get weird flickering issues the text that is centered get very small but I set a font-size to all the items. Also I added a magnifier with the value of 0.1, a diameter radius of 6.5 and a item extent of 200.
Thank you for your help
class _CalendarState extends State<Calendar> {
#override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.blueGrey,
body: ListWheelScrollView(
children: [
Text(
"2020",
style: TextStyle(fontSize: 130),
),
Text(
"2021",
style: TextStyle(fontSize: 130),
),
Text(
"2022",
style: TextStyle(fontSize: 130),
),
Text(
"2023",
style: TextStyle(fontSize: 130),
),
Text(
"2024",
style: TextStyle(fontSize: 130),
),
Text(
"2025",
style: TextStyle(fontSize: 130),
),
Text(
"2026",
style: TextStyle(fontSize: 130),
),
Text(
"2027",
style: TextStyle(fontSize: 130),
),
Text(
"2028",
style: TextStyle(fontSize: 130),
),
Text(
"2029",
style: TextStyle(fontSize: 130),
),
Text(
"2030",
style: TextStyle(fontSize: 130),
)
],
itemExtent: 200,
useMagnifier: true,
magnification: 0.1,
diameterRatio: 6.5,clipBehavior: Clip.antiAlias,
),
),
);
}
}
change magnification grater then 1.0
magnification property have default value is 1.0, which will not change anything. If the value is > 1.0, the center item will be zoomed in by that rate, and it will also be rendered as flat, not cylindrical like the rest of the list. The item will be zoomed out if magnification < 1.0.