fluttercommunity / flutter-draggable-scrollbar

Draggable Scrollbar - A scrollbar that can be dragged for quickly navigation through a vertical list. Additional option is showing label next to scrollthumb with information about current item. Maintainer: @marica27
https://pub.dev/packages/draggable_scrollbar
MIT License
442 stars 77 forks source link

Scrollbar not draggable for web. #23

Open allComputableThings opened 4 years ago

allComputableThings commented 4 years ago

For flutter web, should it be possible to drag the scrollbar? When I mouse-down on it, the labelText is shown, but the tab cannot be dragged.

The code works as expected in the Android emulator (can drag the scrollbar).

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    final scrollController = ScrollController();
    Widget child = ListView.builder(
      physics: ScrollPhysics(),
      controller: scrollController,
      itemCount: 500,
      itemBuilder: rowContent,
    );

    if (true) {
      // Add scrollbar
      child = DraggableScrollbar.arrows(
        controller: scrollController,
        alwaysVisibleScrollThumb: true, //alwaysVisibleScrollThumb,
        labelTextBuilder: (double offset) => Text("${offset ~/ 100}"),
        child: child,
      );
    }

    return MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'MyApp',
        home: Container(
            color: Colors.blue,
            child: child));
  }
}

final textStyle = TextStyle(
    color: Colors.black,
    decoration: TextDecoration.none,
    fontSize: 12,
    fontStyle: FontStyle.normal);

Widget rowContent(BuildContext context, int i, [int j = 0]) {

  return Text(
      "$i:  $j: abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef",
      style: textStyle);
}
allComputableThings commented 4 years ago

Hmm... perhaps is related to this:

https://github.com/flutter/flutter/issues/47758

... scrollviews don't seem to get drag events in general.