Open meAtifkhan opened 4 years ago
how is your pubspack.yaml file? that's right?
@felipecastrosales yes my pubspack.yaml file is right i checked
send here what to apply to your terminal, please
Stop your app and rebuild it and start it again
Hi, did you manage to fix the problem? I'm facing similar issue.
Hello @manandarial, what´s your problem? What your message in terminal? Good Studies!
Hello @felipecastrosales, thank you for taking your time and replying. I found the problem. I forgot to declare cardChild
property in the build function. How did I miss that!? Maybe it happens after binge watching the course. This course got me hooked. I need to take rest in between so my brain functions normally again.
hello @manandarial, for nothing, anu doubts I am at your disposal, and glad you managed to solve your problem, this is part of the learning process. Always have a moment of your day for leisure, rest is very important.
I have a problem with ReusabeCard, nothing is displayed inside Colimn's children. But when I use it on another place without this custom widget everything works fine.
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
const double bottomContainerHeight = 80;
const activeCardColor = Color(0xFF1D1E33);
class InputPage extends StatefulWidget {
@override
_InputPageState createState() => _InputPageState();
}
class _InputPageState extends State<InputPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('BMI CALCULATOR'),
),
body: Column(
children: [
Expanded(
child: Row(
children: [
Expanded(
child: ReusableCard(
color: activeCardColor,
cardChild: IconContent(),
),
),
Expanded(
child: ReusableCard(
color: activeCardColor,
),
),
],
),
),
Expanded(
child: ReusableCard(
color: activeCardColor,
),
),
Expanded(
child: Row(
children: [
Expanded(
child: ReusableCard(
color: activeCardColor,
),
),
Expanded(
child: ReusableCard(
color: activeCardColor,
),
),
],
),
),
Container(
width: double.infinity,
color: Color(0xFFEB1555),
margin: EdgeInsets.only(top: 10),
height: bottomContainerHeight,
),
],
),
);
}
}
class IconContent extends StatelessWidget {
const IconContent({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const FaIcon(FontAwesomeIcons.mars, size: 80),
SizedBox(height: 15),
Text(
'MALE',
style: TextStyle(
fontSize: 80.0,
color: Color(0xFF8D8E96),
),
)
],
);
}
}
class ReusableCard extends StatelessWidget {
ReusableCard({
required this.color,
this.cardChild,
});
final Color color;
final Widget? cardChild;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(15),
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(10),
),
);
}
}
here's the solution to my problem https://stackoverflow.com/questions/69215019/flutter-custom-widget-is-not-showing-children/69215088#69215088
I have tried everything Stopping the app Running flutter clean in your app directory Deleting the app from your simulator / emulator / device Rebuild & Deploy the app. all these steps but the icons and text on card is not showing