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

패키지 상세v0.0.3

flutter_web_scrollbar

Flutter 웹용 사용자 정의 스크롤바입니다.

30일 다운로드
52
좋아요
46
Pub 점수
30

패키지 설치

flutter pub add flutter_web_scrollbar

패키지 개요

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

Flutter 웹 애플리케이션에 특화된 사용자 정의 가능한 스크롤바입니다. 웹 전용 상호작용에 적응하는 시각적으로 매력적이고 기능적인 스크롤 표시기를 제공하여 사용자 경험을 향상시킵니다. 스크롤바는 사용자 정의 스타일, 위치 및 동작 조정을 지원하며, 웹 기반의 Flutter 프로젝트에 쉽게 통합할 수 있습니다. ListView 및 SingleChildScrollView와 같은 표준 스크롤 가능한 위젯과 원활하게 작동하여 데스크톱 및 태블릿 브라우저에서 부드러운 스크롤링을 보장합니다.

사용 사례

  • 웹 앱에서 스크롤바 사용자 정의하기
  • 긴 콘텐츠 목록을 위한 UX 개선
  • 웹 인터페이스의 시각적 디자인 향상
  • 반응형 레이아웃과의 통합
  • 데스크톱 및 태블릿 스크롤링 지원
  • 웹 플랫폼 간에 일관된 스크롤 인디케이터 만들기

주요 기능

  • 웹 최적화 스크롤바 디자인
  • 완전히 사용자 정의 가능한 외관
  • 수직 및 수평 스크롤 지원
  • ScrollView와의 간편한 통합
  • 사용자 정의 가능한 트랙 및 썸 스타일
  • 다양한 화면 크기에서의 반응형 동작

적합한 대상

  • Flutter 개발자가 웹 애플리케이션을 구축하고 있습니다
  • 정교한 스크롤 UI를 원하는 디자이너
  • 일관된 웹 스크롤바 동작이 필요한 프로젝트
  • 넓은 스크롤 가능한 콘텐츠를 가진 앱
  • 웹 전용 UX 개선에 집중하는 팀

고려 사항

  • 모바일 플랫폼용이 아님
  • 각 스크롤 가능한 위젯에 대해 명시적인 설정이 필요합니다
  • 웹 플랫폼 전용
  • 다크 모드 호환성을 위해 추가적인 스타일링이 필요할 수 있습니다
  • 매우 큰 스크롤 가능한 목록에 대한 성능 영향

원본 README

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

flutter_web_scrollbar

A flutter web plugin for adding a customizable scrollbar to your web project. Scroll Bar Web

Usage

To use this plugin add flutter_web_scrollbar as a dependency in your pubspec.yaml file.

Adding the scrollbar to your webpage requires a few mandatory steps:

  1. The content of your page must be the child of a Scrollable Widget (i.e: SingleChildScrollView
  2. The scrollable widget and the FlutterWebScrollbar must be children in a parent Stack
  3. The scrollable widget must be listed first in the Stack
  4. The scrollable widget must have a ScrollController attached to it
  5. The FlutterWebScrollbar must receive a callBack function that accepts a DragUpdateDetails as a parameter.

Example

import 'package:flutter/material.dart';  
import 'package:flutter_web_scrollbar/flutter_web_scrollbar.dart';  
  
class LandingPage extends StatefulWidget {  
  LandingPage({Key key}) : super(key: key);  
  @override  
  State<StatefulWidget> createState() {  
    return _LandingPageState();  
  }  
}  
  
class _LandingPageState extends State<LandingPage> {  
  ScrollController _controller;  
  
  @override  
  void initState() {  
      //Initialize the  scrollController  
      _controller = ScrollController();  
      super.initState();  
  }  
  
  void scrollCallBack(DragUpdateDetails dragUpdate) {  
    setState(() {  
      // Note: 3.5 represents the theoretical height of all my scrollable content. This number will vary for you.  
       _controller.position.moveTo(dragUpdate.globalPosition.dy * 3.5);  
    });  
  }  
  
  @override  
  Widget build(BuildContext context) {  
  
    return Scaffold(  
      backgroundColor: Colors.white,  
      body: Stack(  
        children: [  
          Container(  
            child: SingleChildScrollView(  
              //Assign the controller to my scrollable widget  
              controller: _controller,  
              child: Column(  
                children: [  
                  Container(  
                    height: MediaQuery.of(context).size.height,  
                    width: MediaQuery.of(context).size.width,  
                    color: Colors.black,  
                  ),  
                  Container(  
                    height: MediaQuery.of(context).size.height,  
                    width: MediaQuery.of(context).size.width,  
                    color: Colors.red,  
                  ),  
                  Container(  
                    height: MediaQuery.of(context).size.height,  
                    width: MediaQuery.of(context).size.width,  
                    color: Colors.green,  
                  ),  
                  Container(  
                    height: MediaQuery.of(context).size.height,  
                    width: MediaQuery.of(context).size.width,  
                    color: Colors.blue,  
                  ),  
                ],  
              ),  
            ),  
          ),  
  
  
          FlutterWebScroller(  
            //Pass a reference to the ScrollCallBack function into the scrollbar  
            scrollCallBack,  
  
            //Add optional values  
            scrollBarBackgroundColor: Colors.white,  
            scrollBarWidth: 20.0,  
            dragHandleColor: Colors.red,  
            dragHandleBorderRadius: 2.0,  
            dragHandleHeight: 40.0,  
            dragHandleWidth: 15.0,  
          ),  
        ],  
      ),  
    );  
  }  
}

Things to note about the above code:

  • Inside of our scrollCallBack function, we're updating the ScrollController that is attached to our scrollable widget. It's important to note that in the example, we are using a value of 3.5 to represent the theoretical height of our page content. The theoretical height of your page content may be different. For example, if you have to full height container as your content, you may want to use 2 rather than 3.5. Getting this value as correct as possible plays a big role in how accurate your scrolling will be.
  • Visit the repository here to submit issue reports and request changes
  • If you'd like to help with the upkeep for the plugin, email me at caira102797@gmail.com

Buy Me A Pizza

카테고리

소스 저장소

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

아직 데이터가 없습니다.