

내가 작성한 포스트 갯수, 좋아요, 공유 갯수가 나오는 간단한 컴포넌트입니다.
profile_count_info
를 수정하겠습니다.Widget _buildInfo 메서드입니다.
count와 title 을 매개변수로 받고 있기 때문에
const
를 사용할 수 는 없습니다.Widget _buildInfo(String count, String title){
return Column(
children: [
Text(
count, //변수 바인딩
style: TextStyle(fontSize: 15),
),
SizedBox(height: 2),
Text(
title,
style: TextStyle(fontSize: 15),
),
],
);
}
Widget _buildLine 메서드입니다.
각 info 사이에 있는 파란색 선을 정의하고 있습니다.
Widget _buildLine(){
return Container(width: 2, height: 60, color: Colors.blue);
}
위젯에 작성한 메서드들을 호출해 보겠습니다.
이때 Row 는 내용을 가로로, Column 은 세로로 둔다는 것을 기억하세용.
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildInfo("50", "Posts"),
_buildLine(),
_buildInfo("10", "Likes"),
_buildLine(),
_buildInfo("3", "Share"),
],
);
}
}


[프로필 앱 만들기]
1. 프로젝트 셋팅, 헤더
https://inblog.ai/hj/1-프로필-앱-만들기--30850
2. 프로필 카운드 바 만들기
https://inblog.ai/hj/2-프로필-앱-만들기-30576
Share article