분류, 패키지 및 저장소 검색

stack_board 표지
패키지 상세v0.2.6+1

stack_board

스택 보드를 위한 플러터 패키지로, 어떤 위젯에도 스택하고 편집할 수 있는 컴포넌트입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
151
좋아요
84
Pub 점수
140

패키지 설치

flutter pub add stack_board

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Stack Board는 사용자가 스택 가능한 편집 가능한 위젯을 생성하고 조작할 수 있도록 해주는 Flutter 패키지입니다. 컴포넌트를 겹쳐 배치하고 재정렬하며 상호작용적으로 수정할 수 있어 동적 시각적 구성이 필요한 애플리케이션에 적합합니다. Android, iOS, Web, macOS, Windows, Linux 등 다양한 플랫폼을 지원하여 광범위한 호환성을 보장합니다. 창의적인 워크플로우를 위해 설계되었으며, 그림 그리기, 페인팅, 서명 애플리케이션과 같이 여러 겹쳐진 요소를 쉽게 관리해야 하는 경우에 특히 유용합니다.

사용 사례

  • 인터랙티브 디자인 인터페이스
  • 디지털 서명 도구
  • 레이어드 드로잉 앱
  • 다중미디어 구성
  • 위젯 기반 편집 워크플로우

주요 기능

  • 중첩 가능하고 재정렬 가능한 컴포넌트
  • 실시간 위젯 편집
  • 크로스 플랫폼 지원
  • 유연한 컴포넌트 통합
  • 인터랙티브 레이어 관리

적합한 대상

  • 계층형 UI를 만드는 디자이너
  • 인터랙티브 그림 도구를 개발하는 개발자
  • 다중 레이어 편집을 필요로 하는 응용 프로그램
  • 시각적 구성 요소를 갖춘 교육용 또는 창의적 앱
  • 사용자에게 맞춤형 위젯 배치가 필요한 사용자

고려 사항

  • 복잡한 스택을 위해 신중한 상태 관리가 필요합니다
  • 많은 수의 겹쳐진 위젯이 있을 경우 성능이 달라질 수 있습니다
  • 중간 복잡도 사용 사례에 가장 적합
  • 고급 상호작용을 위해 사용자 정의 로직이 필요할 수 있습니다
  • 기본 스택 외에 내장된 스타일 옵션이 제한적

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Stack Board

A Flutter package of custom stack board.

pub package GitHub stars GitHub forks CodeFactor FlutterCandies


Try it: Demo


1.使用 StackBoardController


import 'package:stack_board/stack_board.dart';

StackBoard(
    controller: _boardController,
    ///添加背景
    background: const ColoredBox(color: Colors.grey),
),
添加自适应文本


_boardController.add(
    const AdaptiveText(
        'Flutter Candies',
        tapToEdit: true,
        style: TextStyle(fontWeight: FontWeight.bold),
    ),
);

添加自适应图片


_boardController.add(
    StackBoardItem(
        child: Image.network('https://avatars.githubusercontent.com/u/47586449?s=200&v=4'),
    ),
);

添加画板


_boardController.add(
    const StackDrawing(
        caseStyle: CaseStyle(
            borderColor: Colors.grey,
            iconColor: Colors.white,
            boxAspectRatio: 1,
        ),
    ),
);

添加自定义item


1.继承自 StackItemContent 和 StackItem

class ColorContent extends StackItemContent {
  ColorContent({required this.color});

  Color color;

  @override
  Map<String, dynamic> toJson() {
    return <String, dynamic>{
      'color': color.value,
    };
  }
}

class ColorStackItem extends StackItem<ColorContent> {
  ColorStackItem({
    required Size size,
    String? id,
    Offset? offset,
    double? angle,
    StackItemStatus? status,
    ColorContent? content,
  }) : super(
          id: id,
          size: size,
          offset: offset,
          angle: angle,
          status: status,
          content: content,
        );

  @override
  ColorStackItem copyWith({
    Size? size,
    Offset? offset,
    double? angle,
    StackItemStatus? status,
    ColorContent? content,
  }) {
    return ColorStackItem(
      id: id, // <= must !!
      size: size ?? this.size,
      offset: offset ?? this.offset,
      angle: angle ?? this.angle,
      status: status ?? this.status,
      content: content ?? this.content,
    );
  }
}

2.使用controller添加

import 'dart:math' as math;

...

/// Add custom item
void _addCustomItem() {
    final Color color = Colors.primaries[Random().nextInt(Colors.primaries.length)];
    _boardController.addItem(
        ColorStackItem(
        size: const Size.square(100),
        content: ColorContent(color: color),
        ),
    );
}

3.使用customBuilder构建

StackBoard(
    controller: _boardController,
        /// 如果使用了继承于StackBoardItem的自定义item
        /// 使用这个接口进行重构
      customBuilder: (StackItem<StackItemContent> item) {
          if (...) {

           ...

          } else if (item is ColorStackItem) {
            return Container(
              width: item.size.width,
              height: item.size.height,
              color: item.content?.color,
            );
          }

          ...
        },
)

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.