Skip to content

feat: Rich Text View의 Adapter 로직 구현 #8

@seungwone

Description

@seungwone

배경 소개

Server Driven UI 구현

기능 설명

서버로부터 전달받은 Dart 언어 레벨의 데이터를 파싱해서 Flutter 위젯으로 변환

요구사항

  • contents의 viewType을 확인하고 적절한 컴포넌트로 파싱
  • String 값으로 주어지는 textColor를 Color 타입으로 변환
  • String 값으로 주어지는 textStyle을 비트마스킹을 통해 int 타입으로 변환

관련 자료

서버 Response

  "responseData": {
    "screenName": "Home",
    "contents": [
      {
        "viewType": "BViewType",
        "content": {
          "title": "This is B ViewType"
        }
      },
      {
        "viewType": "AViewType",
        "content": {
          "title": "This is A ViewType",
          "iconUrl": "https://avatars.githubusercontent.com/u/103282546?s=200&v=4"
        }
      },
      {
        "viewType": "RichViewType",
        "content": {
          "title": "This is RichText ViewType",
          "richText": [
            {
              "text": {
                "text": "이것은",
                "fontSize": 14
              }
            },
            {
              "text": {
                "text": "새로운",
                "fontSize": 16
              }
            },
            {
              "text": {
                "text": "Rich Text",
                "background": "yellow",
                "fontSize": 24
              }
            },
            {
              "text": {
                "text": "ViewType",
                "textColor": "red",
                "fontSize": 30
              }
            },
            {
              "text": {
                "text": "어떻게 구현할수 있을까요?",
                "textStyle": [
                  "underline"
                ],
                "textSize": 24
              }
            },
            {
              "image": {
                "url": "https://img.icons8.com/?size=512&id=63684&format=png",
                "width": 24,
                "height": 24
              }
            }
          ]
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions