패키지, 저장소 및 앱 카테고리 검색

liquid_container 표지
패키지 상세v1.1.1

liquid_container

호버 효과가 있는 액체 버튼 컨테이너. 애플리케이션에 액체 효과를 쉽게 추가하세요

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
93
좋아요
15
Pub 점수
160

패키지 설치

flutter pub add liquid_container

패키지 개요

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

LiquidContainer는 컨테이너 위젯에 유체적이고 액체 같은 호버 효과를 추가하는 Flutter 패키지입니다. 사용자가 컨테이너 위에 마우스를 올릴 때 리플이나 파도의 움직임을 시뮬레이션함으로써 UI의 상호작용성을 향상시켜 현대적이고 동적인 인터페이스에 이상적입니다. 이 패키지는 가볍고 쉽게 통합할 수 있으며, Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원합니다. 버튼, 카드 또는 시각적 피드백이 사용자 경험을 개선하는 모든 상호작용 UI 요소에 적합합니다.

사용 사례

  • 인터랙티브 버튼
  • 애니메이션 UI 요소
  • 현대적인 앱 인터페이스
  • 호버 기반 탐색
  • 게임화 앱 구성 요소
  • 양식에서의 시각적 피드백

주요 기능

  • 부드러운 액체 호버 애니메이션
  • 크로스 플랫폼 호환성
  • 기존 위젯과의 간단한 통합
  • 사용자 지정 가능한 리플 효과
  • 경량이고 성능이 뛰어남
  • 터치 및 마우스 상호작용을 지원합니다

적합한 대상

  • 유연한 애니메이션을 찾는 디자이너
  • 인터랙티브 앱을 개발하는 개발자
  • 현대적인 미적 목표를 가진 앱
  • 매력적인 UI를 필요로 하는 프로토타입
  • 교육용 또는 게임 애플리케이션

고려 사항

  • 저사양 기기에서 성능에 영향을 줄 수 있습니다
  • 복잡한 효과에 대한 사용자 정의 옵션이 제한적입니다
  • 섬세한 애니메이션에 가장 적합
  • 고주파 상호작용 영역에는 권장되지 않습니다
  • 시각적 혼잡을 피하기 위해 신중한 디자인 필요

원본 README

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

liquid_container

Platform Pub Package License: MIT Donate


Demo

Liquid button container. The physics of the Hover effect is not indistinguishable from a drop of water

png

Video of the application

Video

Features

  • easy to use
  • has many parameters for fine tuning
  • fully native dart

Getting started

  • Add this to your pubspec.yaml

    dependencies:
      liquid_container: ^1.0.4
    
  • Get the package from Pub:

    flutter packages get
    
  • Import it in your file

    import 'package:liquid_container/liquid_container.dart';
    

Usage

  • Create options
  final optionsParam = Options(
    layers: [
      LayerModel(
        points: [],
        viscosity: 0.9,
        touchForce: 30,
        forceLimit: 15,
        color: const Color(0xFF00FF00),
      ),
      LayerModel(
        points: [],
        viscosity: 0.9,
        touchForce: 50,
        forceLimit: 10,
        color: const Color(0xFFFF0000),
      ),
    ],
    gap: 30,
    noise: 30,
    forceFactorBuild: 10,
    forceFactorOnTap: 150,
  );
  • Add BoxDecoration to customize the container shape (optional)
  BoxDecoration _borderForm() {
    return const BoxDecoration(
        borderRadius: BorderRadius.only(
      topLeft: Radius.circular(40),
      topRight: Radius.circular(80),
      bottomLeft: Radius.circular(150),
      bottomRight: Radius.circular(20),
    ));
  }
  • Use the pretty hover button
  Widget _buildLiquidButton() {
    return LiquidContainer(
      onTap: () {
        // same code
      },
      optionsParam: optionsParam,
      boxDecorationLabel: _borderForm(),
      child: _buildSomeChild(),
    );
  }
Full example
import 'package:flutter/material.dart';

void main() {
  runApp(const LiquidApp());
}

class LiquidApp extends StatelessWidget {
  static const title = 'Liquid Container';

  const LiquidApp({
    super. key,
  });

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: title,
      home: Scaffold(
        appBar: AppBar(
          title: const Text(title),
        ),
        body: Container(
          color: Colors.grey,
          child: ListView(
            children: const [
              BigNoiseLiquidWidget(),
              SizedBox(height: 300),
            ],
          ),
        ),
      ),
    );
  }
}


class BigNoiseLiquidWidget extends StatefulWidget {
  const BigNoiseLiquidWidget({super.key});

  @override
  _BigNoiseLiquidWidgetState createState() => _BigNoiseLiquidWidgetState();
}

class _BigNoiseLiquidWidgetState extends State<BigNoiseLiquidWidget> {
  static const _label = 'Big Noise';
  final optionsParam = Options(
    layers: [
      LayerModel(
        points: [],
        viscosity: 0.9,
        touchForce: 30,
        forceLimit: 15,
        color: const Color(0xFF00FF00),
      ),
      LayerModel(
        points: [],
        viscosity: 0.9,
        touchForce: 50,
        forceLimit: 10,
        color: const Color(0xFF0000FF),
      ),
      LayerModel(
        points: [],
        viscosity: 0.9,
        touchForce: 50,
        forceLimit: 10,
        color: const Color(0xFFFF0000),
      ),
    ],
    gap: 30,
    noise: 30,
    forceFactorBuild: 10,
    forceFactorOnTap: 150,
    scaleOptionLayer: [1, 0.9, 0.8],
  );
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 200,
      margin: const EdgeInsets.only(left: 10, right: 30, top: 100),
      child: LiquidContainer(
        onTap: _onTapToLiquidButton,
        optionsParam: optionsParam,
        boxDecorationLabel: _borderForm(),
        child: _buildForegroundChild(),
      ),
    );
  }

  BoxDecoration _borderForm() {
    return const BoxDecoration(
        borderRadius: BorderRadius.only(
      topLeft: Radius.circular(40),
      topRight: Radius.circular(80),
      bottomLeft: Radius.circular(150),
      bottomRight: Radius.circular(20),
    ));
  }

  void _onTapToLiquidButton() {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 20),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const Text(
                _label,
                style: TextStyle(
                  fontSize: 20,
                  fontWeight: FontWeight.w900,
                  color: Color(0xFF00FFD5),
                ),
              ),
              IconButton(
                onPressed: ScaffoldMessenger.of(context).clearSnackBars,
                icon: const Icon(
                  Icons.close,
                  size: 30,
                  color: Colors.redAccent,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Row _buildForegroundChild() {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: const <Widget>[
        Icon(
          Icons.liquor_outlined,
          color: Color(0xFF00FFD5),
          size: 60,
        ),
        SizedBox(width: 5),
        Text(
          _label,
          style: TextStyle(
            fontSize: 36,
            fontWeight: FontWeight.w900,
            color: Color(0xFF00FFD5),
          ),
        ),
      ],
    );
  }
}

Author

Okladnoj

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

아직 데이터가 없습니다.