[auth] Dragable scrollbar for selecting custom icons

This commit is contained in:
Aman Raj 2025-01-02 23:29:54 +05:30
parent 9b47595f2c
commit ce0798fbec

View File

@ -31,6 +31,7 @@ class _CustomIconPageState extends State<CustomIconPage> {
// Used to request focus on the search box when clicked the search icon // Used to request focus on the search box when clicked the search icon
late FocusNode searchBoxFocusNode; late FocusNode searchBoxFocusNode;
final Set<LogicalKeyboardKey> _pressedKeys = <LogicalKeyboardKey>{}; final Set<LogicalKeyboardKey> _pressedKeys = <LogicalKeyboardKey>{};
final ScrollController _scrollController = ScrollController();
@override @override
void initState() { void initState() {
@ -45,6 +46,7 @@ class _CustomIconPageState extends State<CustomIconPage> {
void dispose() { void dispose() {
_textController.dispose(); _textController.dispose();
searchBoxFocusNode.dispose(); searchBoxFocusNode.dispose();
_scrollController.dispose();
ServicesBinding.instance.keyboard.removeHandler(_handleKeyEvent); ServicesBinding.instance.keyboard.removeHandler(_handleKeyEvent);
super.dispose(); super.dispose();
} }
@ -155,8 +157,11 @@ class _CustomIconPageState extends State<CustomIconPage> {
children: [ children: [
Expanded( Expanded(
child: Scrollbar( child: Scrollbar(
controller: _scrollController,
thumbVisibility: true, thumbVisibility: true,
interactive: true,
child: GridView.builder( child: GridView.builder(
controller: _scrollController,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: (MediaQuery.sizeOf(context).width ~/ 90) crossAxisCount: (MediaQuery.sizeOf(context).width ~/ 90)
.clamp(1, double.infinity) .clamp(1, double.infinity)