UserAvatar class

사용자 사진 표시

uid 사용자 uid

size 크기

radius 둥근 모서리

onTap 클릭시 실행할 콜백 함수

initialData when initialData is provided, it will be use as the photo url instead of showing the loader (or SizedBox.shrink). And this reduce the flickering dramatically.

sync 사용자 사진을 실시간으로 표시한다. 즉, 사용자 사진이 변경되면, 실시간으로 변경된 사진을 보여준다. 참고로, 로그인 사용자 사진을 표시 할 대, sync 옵션을 쓰면, 깜빡임이 덜한데 왜 그런지 모르겠다. (2024.03.21)

cacheId 메모리 캐시 아이디 사용자 사진이 깜빡이는 경우, 캐시를 사용하면 화면 깜빡임이 줄어든다. 예를 들면 채팅방에서, 메시지와 사진이 깜빡이는데, 이는 사진때문에 깜빡일 확률이 높다. 또 다른 예로 게시판 글 목록에서 사용자 사진이 깜빡이는데 이는 사진을 로드 할 때 깜빡이기 때문이다. 이 처럼, 특히 사진을 로드 할 때, 항상 로딩 중 위젯 표시가 되고, 사진이 표시된다. 이를 방지하기 위해 캐시를 사용한다. UserAvatar 가 사용되는 곳이면, cacheId 를 사용하면 된다. 참고로, 기본적으로 cache 를 하지 않는다.

Inheritance

Constructors

UserAvatar({Key? key, required String uid, double size = 48, double radius = 20, VoidCallback? onTap, String? initialData, String? cacheId, bool sync = false, BoxBorder? border})
const
UserAvatar.sync({Key? key, required String uid, double size = 48, double radius = 20, VoidCallback? onTap, String? initialData, BoxBorder? border})
const

Properties

border BoxBorder?
final
cacheId String?
final
hashCode int
The hash code for this object.
no setterinherited
initialData String?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onTap VoidCallback?
final
radius double
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
final
sync bool
final
uid String
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
builder(dynamic url) Widget
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited