首页 > 其他分享 >WheelChoose组件的用法

WheelChoose组件的用法

时间:2024-10-18 22:18:18浏览次数:3  
标签:WheelChoose 示例 用法 选择 TextDecoration 组件 方法 属性

文章目录


我们在上一章回中介绍了"如何实现Numberpicker"相关的内容,本章回中将介绍wheelChoose组件.闲话休提,让我们一起Talk Flutter吧。

在这里插入图片描述

1. 概念介绍

我们在本章回中介绍的wheelChooser是一个三方包,它除了像NumberPicker一样创建数字选择功能外,它可以选择其它的组件当作被选择的对象,相当于在选择数字
功能的基础上做了扩展,它扩展了被选择内容的范围。我们将在本章回中详细介绍该组件的使用方法。

2. 使用方法

和其它的组件一样WheelChooser组件提供了相关的属性来控制自己,下面是常用的属性。

  • datas属性:该属性是数组类型,数组中的值就是被选择的值,因此它用来控制选择数值的范围;
  • horizontal属性:用来控制选择的方向,分水平垂直两个方向;
  • onValueChanged属性:该属性是方法类型,选择某个数值时会回调该属性对应的方法;
  • isInfinite属性:该属性用来控制是否循环显示被选择的内容;
    除了这些属性外,该组件还提供了一些工厂方法,通过工厂方法快速创建被选择的内容,比如WheelChooser.number()可以快速创建数字选择器,我们将在稍后的小节
    中通过示例代码来演示如何使用这些工厂方法。

3. 代码与效果

3.1 示例代码

WheelChooser(
  ///控制滑动方向
  horizontal: true,
  ///使用装饰可以在选择的内容上方和下方显示一条横线
  selectTextStyle:TextStyle(
    ///单独使用和复合使用装饰
    // decoration: TextDecoration.overline,
    decoration: TextDecoration.combine([TextDecoration.underline,TextDecoration.overline]),
  ) ,
  ///是否循环显示
  isInfinite: true,
  onValueChanged: 

标签:WheelChoose,示例,用法,选择,TextDecoration,组件,方法,属性
From: https://blog.csdn.net/talk_8/article/details/142962727

相关文章

  • 使用常用组件构建页面
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/......
  • C++ -string -常见用法2
    博客主页:【夜泉_ly】本文专栏:【C++】欢迎点赞......
  • vue多选框组件
    vue的多选框问题首先在<template>里完成对组件的定义,定义了一个含有全选标志的多选框<el-form-itemlabel="城市"prop="cicty"><!--<el-inputv-model="dataForm.score"placeholder="成绩"></el-input>对于indetermin......
  • 如何在 HarmonyOS NEXT 中使用 @Builder 装饰器优化 UI 组件的复用?
    摘要在鸿蒙NEXT开发中,@Builder 装饰器是一种轻量级的UI元素复用机制,它允许开发者将重复使用的UI元素抽象成一个方法,并在 build() 方法中多次调用,以实现UI结构的复用。以下是如何使用 @Builder 装饰器来优化UI组件复用的详细介绍和案例分析:自定义构建函数@Bui......
  • UIAbility组件生命周期
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......
  • UIAbility组件概述
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......
  • UIAbility组件间交互(设备内)
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......
  • UIAbility组件与UI的数据同步
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......
  • UIAbility组件基本用法
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......
  • UIAbility组件启动模式
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(MaoistLearning)➤博客园地址:为敢技术(https://www.cnblogs.com/strengthen/ )➤GitHub地址:https://github.com/strengthen➤原文地址:https://www.cnblogs.com/strengthen/p/......