alphabet_scroll_view 0.1.0 alphabet_scroll_view: ^0.1.0 copied to clipboard
A Scrollable ListView Widget with the dynamic vertical Alphabet List which you can drag and tap to scroll to the first item starting with that letter.
import 'package:flutter/material.dart';
import 'package:alphabet_scroll_view/alphabet_scroll_view.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
int selectedIndex;
@override
Widget build(BuildContext context) {
List<String> list =
'Hello world how 123 43 67 67 78 are you this is alphabet scroll 3ASDS widget built with flutter I love building tools for productivity this also helps me to gain more experience and also to shwocase my work in the community it is kind of inspiring and Theres zero Risk Tolerance'
.split(' ')
.toList();
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
children: [
Expanded(
child: AlphabetScrollView(
list: list.map((e) => AlphaModel(e)).toList(),
// isAlphabetsFiltered: false,
itemExtent: 50,
itemBuilder: (_, k, id) {
return Padding(
padding: const EdgeInsets.only(right: 20),
child: ListTile(
title: Text('$id'),
subtitle: Text('Secondary text'),
leading: Icon(Icons.label),
trailing: Radio<bool>(
value: false,
groupValue: selectedIndex != k,
onChanged: (value) {
setState(() {
selectedIndex = k;
});
},
),
),
);
},
),
),
],
),
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
],
),
);
}
}