搜索分类、插件与代码仓

alphabet_navigation 封面
插件详情v2.1.0

alphabet_navigation

一个提供字母索引列表视图的 Flutter 包。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
72
喜欢数
13
Pub 分数
150

安装插件

flutter pub add alphabet_navigation

插件介绍

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

一个 Flutter 包,可实现字母索引列表视图,允许用户通过点击字母快速浏览长列表。它提供了一个可滚动的侧边栏,带有字母指示器,提升了大型数据集(如联系人或词典)的可用性。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 多个平台。它可轻松集成到现有的 Flutter 应用中,设置简单,并提供可自定义的样式和行为。

适合场景

  • 联系人列表中的快速导航
  • 高效浏览大型数据集
  • 改进了字母搜索的用户体验
  • 显示词典或术语表条目
  • 增强列表密集型界面的可访问性

主要特点

  • 字母顺序侧边栏导航
  • 可自定义外观
  • 跨平台兼容性
  • 平滑滚动集成
  • 对动态数据源的支持
  • 与 ListView.builder 的轻松集成

适合对象

  • 带有长字母列表的应用程序
  • 联系人或目录应用程序
  • 教育或参考应用
  • 需要快速内容访问的用户界面
  • 寻求直观列表导航的开发者

使用建议

  • 可能需要额外的样式设置以支持自定义主题
  • 处理超大数据集时的性能
  • 仅限字母索引
  • 需要妥善处理空列表等边缘情况
  • 不适用于非字母排序需求

原始 README

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

Alphabet Navigation

License GitHub Contributors Stars GitHub Closed Issues

alphabet_navigation is a Flutter package that provides a dynamic, scrollable list view with an alphabetical index. It’s perfect for apps that need a quick and intuitive way to navigate long lists by alphabet.


Features

  • [x] A vertical alphabetical navigation bar for quick access to sections.
  • [x] Smooth scrolling to the desired section when an alphabet is selected.
  • [x] Fully customizable list items and navigation styles.
  • [x] Built-in search bar for filtering items dynamically.
  • [x] Search field is optional & can be customized.
  • [x] Dynamic list height is optional & can be customized.
  • [x] Alphabetic list direction is configurable.
  • [x] Allow users to easily configure colors, fonts, and styles.
  • [x] Lightweight and easy to integrate into any Flutter project.
  • [x] Compatible with all platforms.
  • [x] Clear documentation.

Demo

Demo GIF


Installation

To use the alphabet_navigation package, follow these steps:

Run this on your project terminal:

flutter pub add alphabet_navigation

or manually configure pubspec.yml file

  1. Add the package to your pubspec.yaml file:

    dependencies:
      alphabet_navigation: ^2.1.0 // replace with latest version
    
  2. Run the following command to get the package:

    flutter pub get
    

Usage

Here’s how you can use the AlphabetNavigation widget in your app:

Example 1:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  dynamicListHeight: 80, // Dynamic list height (optional)
  showSearchField: true, // Toggle for search field (optional)
  circleSelectedLetter: true, // Is circle apply for the selected letter (optional)
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 2:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  searchFieldHintText: "Search here...", // Search field hint text
  searchFieldTextStyle: TextStyle(
   color: Colors.blue.shade800,
   fontWeight: FontWeight.w500,
   fontSize: 16,
  ),
  searchFieldHintTextStyle: TextStyle(
    color: Colors.grey.shade300,
    fontWeight: FontWeight.w500,
    fontSize: 16,
  ),
  searchFieldIcon: Icon(Icons.search, color: Colors.blue.shade800,), // Search field icon
  searchFieldEndIconColor: Colors.blue.shade800, // Search field clear icon color
  listDirection: ListDirection.left, // Direction of the list. If [ListDirection.left], the list will be from right to left (optional)
  showSearchField: true, // Toggle for search field (optional)
  circleSelectedLetter: true, // Is circle apply for the selected letter (optional)
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 3:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  showSearchField: true, // Toggle for search field (optional)
  alphabetListBackgroundColor: Colors.tealAccent, // Alphabet list background color
  selectedColor: Colors.white70, // Selected color for the alphabet
  unselectedColor: Colors.black38, // Unselected color for the alphabet
  circleSelectedLetter: true, // Is circle apply for the selected letter (optional)
  circleSelectedBackgroundColor: Colors.blue, // Selected circle background color
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 4:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  showSearchField: false, // Toggle for search field (optional)
  circleSelectedLetter: false, // Is circle apply for the selected letter (optional)
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 4:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  circleSelectedLetter: false, // Is circle apply for the selected letter (optional)
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 5:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  circleSelectedLetter: false, // Is circle apply for the selected letter (optional)
  alphabetListBackgroundColor: Colors.transparent, // Alphabet list background color
  selectedColor: Colors.blue, // Selected color for the alphabet
  unselectedColor: Colors.grey.shade600, // Unselected color for the alphabet
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 6:
AlphabetNavigation(
  stringList: stringList, // Pass the string list for alphabet mapping
  dynamicList: dynamicList, // Pass the dynamic list for content
  showSearchField: true, // Toggle for search field (optional)
  circleSelectedLetter: true, // Is circle apply for the selected letter (optional)
  circleBorderRadius: 50.0, // Border radius for the selected letter circle and alphabet list border
  scrollAnimationCurve: Curves.easeInCubic, // Scroll animation curve
  itemBuilder: (context, index, searchFilterList) {}, // Item builder
)
Example 1 Example 2 Example 3
Example 4 Example 5 Example 6

Parameters
Parameter Type Description
stringList List<String> List of strings for alphabetical grouping.
dynamicList List<dynamic> Data list to be displayed.
dynamicListHeight double Dynamic list height.
listDirection ListDirection Direction of the list.
showSearchField bool Toggle for search field.
searchFieldTextStyle TextStyle Search field text style.
searchFieldHintText String Search field hint text.
searchFieldHintTextStyle TextStyle Search field hint style.
searchFieldIcon Icon Search field icon.
searchFieldBackgroundColor Color Search field background color.
searchFieldEndIconColor Color Search field icon color.
alphabetListBackgroundColor Color Alphabet list background color.
selectedColor Color Selected alphabet color
unselectedColor Color Unselected alphabet color
circleSelectedLetter bool Is circle apply for the selected letter.
circleSelectedBackgroundColor Color Circle background color for the selected letter.
circleBorderRadius double Border radius for the selected letter circle
scrollAnimationCurve Curve Scroll animation curve.
itemBuilder Function(BuildContext, int, dynamic) Function to build list items dynamically.

Future Plans

Here are some planned features for future releases:

  • Accessibility Improvements: Enhanced support for voice-over and screen readers.
  • Horizontal Navigation: Add support for horizontal alphabetical navigation.
  • Custom Alphabet Set: Support for custom navigation sets like ['A', 'B', 'C', '1', '2', '3'].
  • Multi-Language Support: Enable alphabetical navigation for other languages.

Contributing

We welcome contributions from the community! If you encounter any issues or have feature suggestions, feel free to open an issue or submit a pull request on our GitHub repository.


Additional information

License

This project is licensed under the MIT License - see the LICENSE file for details.

CONTRIBUTORS

Contributors
Akash Das

Happy Coding 👨‍💻

所属分类

源码仓库

使用此插件的项目

暂无相关数据。