【重磅发布】flutter_chen_azlist - A–Z索引列表

Language: English | 中文简体

flutter_chen_azlist

Flutter 城市列表/联系人列表组件(支持悬停头与A--Z索引)。基于 scrollable_positioned_list

功能特性

  • 快速构建城市/联系人列表界面
  • 列表项按 A--Z 分组并支持悬停(可浮动)
  • 支持自定义 Header 与索引联动
  • IndexBar 支持自定义样式与本地图片
  • 支持滚动/跳转到指定条目
  • 索引交互可选触觉反馈(haptic feedback)

兼容性

  • Dart:>= 3.0.0 < 4.0.0
  • Flutter:推荐 3.x

安装

yaml 复制代码
dependencies:
  flutter_chen_azlist: ^3.0.0

快速开始

dart 复制代码
import 'package:flutter/material.dart';
import 'package:flutter_chen_azlist/flutter_chen_azlist.dart';

class City extends ISuspensionBean {
  City(this.name, this.tag);
  final String name;
  final String tag;
  @override
  String getSuspensionTag() => tag;
}

class DemoPage extends StatelessWidget {
  DemoPage({super.key});

  final List<City> cities = [
    City('北京', 'B'),
    City('上海', 'S'),
    City('深圳', 'S'),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('AzListView Demo')),
      body: AzListView(
        data: cities,
        itemCount: cities.length,
        itemBuilder: (context, i) => ListTile(title: Text(cities[i].name)),
        susItemBuilder: (context, i) => Container(
          height: 40,
          padding: const EdgeInsets.symmetric(horizontal: 16),
          alignment: Alignment.centerLeft,
          child: Text(cities[i].getSuspensionTag()),
        ),
        indexBarOptions: const IndexBarOptions(hapticFeedback: true),
      ),
    );
  }
}

截图

示例

完整示例见 example/ 目录:

  • 运行:cd example && flutter run

Thanks

azlistview

许可

使用 MIT 协议,参见 LICENSE

相关推荐
2301_822703202 小时前
开源鸿蒙跨平台Flutter开发:蛋白质序列特征提取:氨基酸组成与理化性质计算
flutter·华为·开源·harmonyos·鸿蒙
钛态3 小时前
Flutter 三方库 ethereum_addresses 的鸿蒙化适配指南 - 掌控区块链地址资产、精密校验治理实战、鸿蒙级 Web3 专家
flutter·harmonyos·鸿蒙·openharmony·ethereum_addresses
提子拌饭1333 小时前
开源鸿蒙跨平台Flutter开发:中小学百米跑信息记录表:基于 Flutter 的高精计时与运动学曲线引擎
flutter·华为·开源·harmonyos
SY.ZHOU3 小时前
移动端架构体系(四):View层的组织与调用方案
flutter·ios·架构·系统架构·安卓
2301_822703203 小时前
光影进度条:鸿蒙Flutter实现动态光影效果的进度条
算法·flutter·华为·信息可视化·开源·harmonyos
独特的螺狮粉4 小时前
城市空气质量简易指数查询卡片:鸿蒙Flutter框架 实现的空气质量查询应用
开发语言·flutter·华为·架构·harmonyos
李李李勃谦5 小时前
Flutter 框架跨平台鸿蒙开发 - 鲜花礼品配送
flutter·华为·harmonyos
牛马1115 小时前
Flutter BoxDecoration
前端·javascript·flutter
2301_822703205 小时前
鸿蒙Flutter三方库适配:Flutter Markdown适配实战-鸿蒙平台的Markdown渲染解决方案
flutter·华为·信息可视化·开源·harmonyos·鸿蒙·三方库
李李李勃谦5 小时前
Flutter 框架跨平台鸿蒙开发 - 蛋糕甜品预订
flutter·华为·harmonyos