搜索插件、代码仓与 APP 分类

vertical_weight_slider 封面
插件详情v2.6.0

vertical_weight_slider

该包提供易于使用且可滚动的垂直重量滑块。兼容 Android、iOS 和 Web。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
664
喜欢数
79
Pub 分数
160

安装插件

flutter pub add vertical_weight_slider

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

vertical_weight_slider 包为 Flutter 应用程序提供了一个可滚动的垂直滑块,用于直观地选择重量或数值。专为跨平台使用而设计,支持 Android、iOS、Web、macOS、Windows 和 Linux。该滑块易于集成和自定义,提供流畅的滚动和响应式反馈。适用于需要通过垂直移动进行精确输入的场景,例如调整音量、强度或以紧凑形式输入数值。该包轻量且与现代 Flutter 版本兼容。

适合场景

  • 调整音频音量
  • 设置强度级别
  • 输入数值
  • 自定义 UI 控件
  • 交互式仪表板
  • 表单输入

主要特点

  • 垂直滚动接口
  • 跨平台兼容性
  • 轻松集成
  • 平滑滚动
  • 响应式设计
  • 可自定义外观

适合对象

  • 开发交互式表单的开发者
  • 需要紧凑输入控件的设计师
  • 需要垂直值调整的应用
  • 跨平台 Flutter 项目
  • 以UI为主的应用程序

使用建议

  • 可能需要额外的样式设置以实现自定义外观
  • 仅限纵向方向
  • 不适用于横向布局
  • 性能在低端设备上可能有所不同
  • 需要 Flutter 3.0+ 才能完全兼容

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Vertical Weight Slider

This package provides easy-to-use and scrollable vertical weight slider.

Compatible with Android & iOS & Web. :heart_eyes:

pub


Showcase


Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  vertical_weight_slider : "^lastest_version"

Usage

Need to include the import the package to the dart file where it will be used, refer the below command

import 'package:vertical_weight_slider/vertical_weight_slider.dart';

Complete example

import 'package:flutter/material.dart';
import 'package:vertical_weight_slider/vertical_weight_slider.dart';

void main() {
  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late WeightSliderController _controller;
  double _weight = 30.0;

  @override
  void initState() {
    super.initState();
    _controller = WeightSliderController(initialWeight: _weight, minWeight: 0, interval: 0.1);
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Vertical Weight Slider Example"),
        centerTitle: true,
      ),
      body: Column(
        children: [
          Container(
            height: 200.0,
            alignment: Alignment.center,
            child: Text(
              "${_weight.toStringAsFixed(1)} kg",
              style: TextStyle(fontSize: 40.0, fontWeight: FontWeight.w500),
            ),
          ),
          VerticalWeightSlider(
            controller: _controller,
            decoration: const PointerDecoration(
              width: 130.0,
              height: 3.0,
              largeColor: Color(0xFF898989),
              mediumColor: Color(0xFFC5C5C5),
              smallColor: Color(0xFFF0F0F0),
              gap: 30.0,
            ),
            onChanged: (double value) {
              setState(() {
                _weight = value;
              });
            },
            indicator: Container(
              height: 3.0,
              width: 200.0,
              alignment: Alignment.centerLeft,
              color: Colors.red[300],
            ),
          ),
        ],
      ),
    );
  }
}


License

Copyright 2020, the Flutter project authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of Google Inc. nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。