플러터 메모

김지원·2023년 10월 31일
0
// 날짜비교하고 up태그 붙히기
todayDateTime.difference(webtoonDTO.episodeList[index].createdAt).inHours < 40

//Image.network 실패하면 다른 이미지로 대체하기
  errorBuilder: (context, error, stackTrace) {
    return Image.asset(
    "assets/default_episode_Thumbnail.jpg",
    height: 60,
    width: sizeGetScreenWidth(context) * 0.25,
    fit: BoxFit.cover,
  );
 }

// 글자 길어서 삐져나가서 오버플로우 막기
Container(
  constraints: BoxConstraints(maxWidth: sizeGetScreenWidth(context) * 0.4),
  child: Text(
    "${interestWebtoonDTOList[index].webtoonTitle}",
    style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, overflow: TextOverflow.ellipsis),
  ),
),

// 실제 현재시간과 차이
DateTime.now().difference(interestAuthorDTOList[index].authorBoardCreateAt!)

Text( "${DateTime.now().difference(interestAuthorDTOList[index].authorBoardCreateAt!).inDays}일/${DateTime.now().difference(interestAuthorDTOList[index].authorBoardCreateAt!).inHours}시간/${DateTime.now().difference(interestAuthorDTOList[index].authorBoardCreateAt!).inMinutes}분/${DateTime.now().difference(interestAuthorDTOList[index].authorBoardCreateAt!).inSeconds}초")

// 박스 크기 무시하고 크기 변경
Transform.scale(
            scale: 1,
            child: YourContentWidget(),
          ),
          
// (사진) 확대
InteractiveViewer

시간에 따라 리스트에서 1개 선택

      int nowTime = (DateTime.now().minute);
      // int nowTime = (DateTime.now().second.toInt() / 20).toInt();
      int listLength = advertisingSubDTOList.length;

      int nowIndex = (nowTime % listLength);

      AdvertisingSubDTO selectSubDTO = advertisingSubDTOList[nowIndex];

focusNode 상태가 변할 때 화면을 다시 렌더링하게
GestureDetector 바깥부분 누르면 키보드 내리게 FocusScope.of(context).unfocus();
최종프로젝트 댓글 참고

profile
https://github.com/k7850

0개의 댓글

관련 채용 정보