Language: English | 中文简体

flutter_chen_azlist

A Flutter sticky headers & A–Z index ListView. Based on scrollable_positioned_list.

Features

  • Easy creation of city/contact list UIs
  • Group items by A–Z with sticky headers (floating)
  • Custom header and index linkage
  • IndexBar supports custom styles and local images
  • Programmatically scroll to a specific item
  • Optional haptic feedback on index interactions

Compatibility

  • Dart: >= 3.0.0 < 4.0.0
  • Flutter: 3.x (recommended)

Install

dependencies:
  flutter_chen_azlist: ^3.0.0

Quick start

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('Beijing', 'B'),
    City('Shanghai', 'S'),
    City('Shenzhen', '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),
      ),
    );
  }
}

Screenshots

Example

A full example is available under the example/ directory:

  • Run: cd example && flutter run

Thanks

azlistview

License

This project is licensed under the terms of the MIT license. See LICENSE for details.