flutter_easy_navigation_list 0.0.5 copy "flutter_easy_navigation_list: ^0.0.5" to clipboard
flutter_easy_navigation_list: ^0.0.5 copied to clipboard

Automatic navigation for list location.

example/lib/main.dart

import 'dart:math';
import 'dart:ui';

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: ListText(),
      ),
    );
  }
}

class ListText extends StatefulWidget {
  ListText({Key? key}) : super(key: key);

  @override
  _ListTextState createState() => _ListTextState();
}

class _ListTextState extends State<ListText> {
  late List<String> naList = [];
  late List<Widget> chList = [];

  @override
  void initState() {
    super.initState();

    for (int i = 0; i < 27; i++) {
      naList
          .add(i == 26 ? String.fromCharCode(35) : String.fromCharCode(i + 65));
      int num = Random().nextInt(10) + 3;
      List<Widget> cChList = [];
      for (int j = 0; j < num; j++) {
        cChList.add(
          Container(
            margin: EdgeInsets.only(
              bottom: 10,
              left: 16,
              right: 16,
            ),
            width: window.physicalSize.width,
            color: Colors.green,
            height: 50,
            alignment: Alignment.centerLeft,
            child: Text(
              naList[i] + ':' + j.toString(),
            ),
          ),
        );
      }
      chList.add(
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: cChList,
        ),
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    /// 使用示例
    ///
    /// Usage example
    return Container(
      color: Colors.blue,
      child: AutoCharacterNavigatorList(
        // alphabetDirection: Axis.horizontal,
        alphabetChildrenPosition: Position(
          right: 16,
          top: 30,
        ),
        alphabetChildrenStyle: AlphabetChildrenStyle(
          unSelectBackgroundColor: Colors.deepOrange,
          margin: EdgeInsets.zero,
          totalWidth: 16,
          // totalHeight: 400,
          alphabetDirection: Axis.vertical,
        ),
        childrenNavigator: naList,
        children: chList,
      ),
    );
  }
}
1
likes
110
pub points
12%
popularity

Publisher

unverified uploader

Automatic navigation for list location.

Homepage

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_easy_navigation_list