scroll_list.dart 786 B

123456789101112131415161718192021222324252627282930313233
  1. import 'package:flutter/material.dart';
  2. class AlwaysScrollListView extends StatefulWidget {
  3. final Widget child;
  4. final ScrollController scrollController;
  5. final Color? color;
  6. const AlwaysScrollListView({
  7. super.key,
  8. required this.child,
  9. required this.scrollController,
  10. this.color = Colors.grey,
  11. });
  12. @override
  13. State<StatefulWidget> createState() {
  14. return _AlwaysScrollListViewState();
  15. }
  16. }
  17. class _AlwaysScrollListViewState extends State<AlwaysScrollListView> {
  18. @override
  19. Widget build(BuildContext context) {
  20. return RawScrollbar(
  21. controller: widget.scrollController,
  22. trackVisibility: true,
  23. thumbVisibility: true,
  24. thumbColor: widget.color,
  25. radius: const Radius.circular(20),
  26. child: widget.child,
  27. );
  28. }
  29. }