Flutter Icon ? IconData ?

    IconData에 대한 개념때문에 개발하면서 시간을 소요한 경우가 있어서 정리합니다. 

    Icon
    IconData에 설명된 글꼴의 glyph로 그려진 그래픽 아이콘 위젯입니다. Icon은 상호작용을 하지 않습니다.
    상호작용을 하고 싶은 아이콘의 경우 IconButton을 사용하시면 됩니다. Icon을 사용할 때 주변 방향 위젯이 있어야 합니다. 일반적으로 WidgetsApp 또는 MaterialApp에 의해 자동으로 도입됩니다.
    Icon 위젯은 렌더링된 아이콘으로 가정합니다.제곱되지 않은 아이콘은 잘못 렌더링될 수 있습니다.

    IconData
    Icon에 대한 설명입니다. 

    정리하면 IconData를 기반으로 Icon을 만들 수 있다 입니다. 

    Icon(IconData? icon, {Key? key, double? size, Color? color, String? semanticLabel, TextDirection? textDirection})

    실제로 Icon 내에 IconData를 가지고 있습니다.

    결론은 IconData 만으로는 Icon을 생성할 방법이 없습니다.


    https://api.flutter.dev/flutter/widgets/Icon-class.html

     

    Icon class - widgets library - Dart API

    A graphical icon widget drawn with a glyph from a font described in an IconData such as material's predefined IconDatas in Icons. Icons are not interactive. For an interactive icon, consider material's IconButton. There must be an ambient Directionality wi

    api.flutter.dev

    https://api.flutter.dev/flutter/widgets/IconData-class.html

     

    IconData class - widgets library - Dart API

    A description of an icon fulfilled by a font glyph. See Icons for a number of predefined icons available for material design applications. Annotations Constructors IconData(int codePoint, {String? fontFamily, String? fontPackage, bool matchTextDirection =

    api.flutter.dev

     

    댓글