• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Flutter 게시판 커스텀 위젯으로 하단바 만들어보았는데.. 덮어씌워집니다

커스텀 위젯으로 하단바 만들어보았는데.. 덮어씌워집니다

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #70488

    이상윤
    참가자
    숙제에서 나온대로 하단네비게이션바를 커스텀 위젯으로 했는데 
    바디 본문이 왜 가려질까요? 
    
    
    import 'package:flutter/material.dart';
    void main() {
      runApp(const MyApp());
    }
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(),
            body: ListView(
              children: [
                Row(
                  children: [
                    IconButton(onPressed: (){}, icon: Icon(Icons.person)),
                    Text('홍길동'),
                  ],
                ),
                Row(
                  children: [
                    IconButton(onPressed: (){}, icon: Icon(Icons.person)),
                    Text('임꺽정'),
                  ],
                ),
                Row(
                  children: [
                    IconButton(onPressed: (){}, icon: Icon(Icons.person)),
                    Text('장길산'),
                  ],
                ),
              ],
            ),
            bottomNavigationBar: NavBar(),
          )
        );
      }
    }
    class NavBar extends StatelessWidget {
      const NavBar({Key? key}) : super(key: key);
      @override
      Widget build(BuildContext context) {
        return Align(
            alignment: Alignment.bottomCenter,
            child: Container(
                height: 80,
                decoration: BoxDecoration(
                    border: Border(
                      top: BorderSide(
                        color: Color.fromRGBO(147, 151, 153, 0.7),
                        width: 1,
                      )
                    )
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: [
                    IconButton(onPressed: (){}, icon: Icon(Icons.phone), color: Colors.black,),
                    IconButton(onPressed: (){}, icon: Icon(Icons.message), color: Colors.black,),
                    IconButton(onPressed: (){}, icon: Icon(Icons.contact_page), color: Colors.black,),
                  ],
                )
            )
        );
      }
    }
    #70513

    이상윤
    참가자
    해결했습니다..
    커스템 위젯에서 컨테이너를 Align() 씌워줬던게 문제였네요. 
    애초에 bottomNavigationBar: 에서 커스템 위젯명을 입력하면 
    정렬을 따로 시켜줘야하는줄 알고 했다가 오히려 그게 낭패였네요.
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠