SouthGlory
Preview Image

Flutter Simple 그림판 (4) - 텍스트 컨테이너 줄바꿈 감지(word - breaking)(character-breaking)

문제 해결 알고리즘 문자열을 space, tab, 혹은 enter로 끊어서 리스트에 담고, 앞에서부터 한개, 두개, … n개 만큼 textPainter에 넣어서 textPainter.width를 확인하고, 만약 containerWidth보다 커지는 시점이 오거나 더 이상 단어가 남아있지 않았을 때 그 바로 직전 단어(혹은 마지막 단어)의 인덱스와 시...