• Taha Tesser's avatar
    Fix `Scrollbar.thickness` property is ignored when the `Scrollbar` is hovered (#144012) · 41b1aea2
    Taha Tesser authored
    fixes [`Scrollbar.thickness` property is ignored when the `Scrollbar` is hovered](https://github.com/flutter/flutter/issues/143881)
    
    ### Code sample
    
    <details>
    <summary>expand to view the code sample</summary> 
    
    ```dart
    import 'package:flutter/material.dart';
    
    void main() => runApp(const MyApp());
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        final ScrollController scrollController = ScrollController();
    
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          home: Material(
            child: ScrollConfiguration(
              behavior: const NoScrollbarBehavior(),
              child: ScrollbarTheme(
                data: ScrollbarThemeData(
                  thickness: MaterialStateProperty.all(25.0),
                  showTrackOnHover: true,
                ),
                child: Scrollbar(
                  thickness: 50.0,
                  thumbVisibility: true,
                  radius: const Radius.circular(3.0),
                  controller: scrollController,
                  child: SingleChildScrollView(
                    controller: scrollController,
                    child: const SizedBox(width: 4000.0, height: 4000.0),
                  ),
                ),
              ),
            ),
          ),
        );
      }
    }
    
    class NoScrollbarBehavior extends ScrollBehavior {
      const NoScrollbarBehavior();
    
      @override
      Widget buildScrollbar(
              BuildContext context, Widget child, ScrollableDetails details) =>
          child;
    }
    ```
    
    </details>
    
    ### Preview
    
    | Before | After |
    | --------------- | --------------- |
    | <img src="https://github.com/flutter/flutter/assets/48603081/3537d60d-a5b2-488d-aa99-4c36c3721657"  /> | <img src="https://github.com/flutter/flutter/assets/48603081/cfd02095-a327-4b16-8ece-0d1c9e6813ce" /> |
    41b1aea2
scrollbar_theme_test.dart 25.6 KB