skip to Main Content

enter image description here

I want to add Text and image together on home.

However, the error continues to occur.
What’s wrong with my code?

3

Answers


  1. you are using wrong widget, replace your body with this:

    body: Column(
      children: [
         const Text('닮은 꼴 찾기'),
         Image.asset('assets/images/face_home_img_1.png'),
      ],
    ),
    floatingActionButton: ...
    

    container doesn’t have children property. If you want to show multi widget under each other you need to use Column

    Login or Signup to reply.
  2. Your code is entirely messed up. use the column up down the widgets and use Row for side by side the two widget

    Column( 
       children: [
          const Text('닮은 꼴 찾기 '),
          Image.asset('assets/images/face_home_img_1.png'),
       ],
    )
    
    Login or Signup to reply.
  3. Your code structure is very wrong even though you can’t have the flow like container->child->children you should not do it like this

    The better way to optimize it is container->child->Column and Column will have children and then your code goes like this

    Column(
      children: [
         const Text('닮은 꼴 찾기'),
         Image.asset('assets/images/face_home_img_1.png'),
      ],
    ),
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search