londonappbrewery / BMI-Calculator-Flutter-Completed

The completed code for the BMI Project - The Complete Flutter Development Bootcamp
https://www.appbrewery.co/
104 stars 147 forks source link

font awesome icons are not showing #9

Open meAtifkhan opened 4 years ago

meAtifkhan commented 4 years ago

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

felipecastrosales commented 4 years ago

how is your pubspack.yaml file? that's right?

meAtifkhan commented 4 years ago

@felipecastrosales yes my pubspack.yaml file is right i checked

felipecastrosales commented 4 years ago

send here what to apply to your terminal, please

melmslmany commented 4 years ago

Stop your app and rebuild it and start it again

manandarial commented 3 years ago

Hi, did you manage to fix the problem? I'm facing similar issue.

felipecastrosales commented 3 years ago

Hello @manandarial, what´s your problem? What your message in terminal? Good Studies!

manandarial commented 3 years ago

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.

felipecastrosales commented 3 years ago

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.

fobf commented 3 years ago

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),
      ),
    );
  }
}
fobf commented 3 years ago

here's the solution to my problem https://stackoverflow.com/questions/69215019/flutter-custom-widget-is-not-showing-children/69215088#69215088