Unverified Commit 59ea6192 authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Added scrollbar example (#75761)

parent 40e34892
......@@ -34,7 +34,54 @@ const Duration _kScrollbarTimeToFade = Duration(milliseconds: 600);
/// [showTrackOnHover]. The thickness of the track and scrollbar thumb will
/// become larger when hovering, unless overridden by [hoverThickness].
///
// TODO(Piinks): Add code sample
/// {@tool dartpad --template=stateless_widget_scaffold}
/// This sample shows a [Scrollbar] that executes a fade animation as scrolling occurs.
/// The Scrollbar will fade into view as the user scrolls, and fade out when scrolling stops.
/// ```dart
/// Widget build(BuildContext context) {
/// return Scrollbar(
/// child: GridView.builder(
/// itemCount: 120,
/// gridDelegate:
/// const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
/// itemBuilder: (BuildContext context, int index) {
/// return Center(
/// child: Text('item $index'),
/// );
/// },
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=stateful_widget_scaffold}
/// When isAlwaysShown is true, the scrollbar thumb will remain visible without the
/// fade animation. This requires that a ScrollController is provided to controller,
/// or that the PrimaryScrollController is available.
/// ```dart
/// final ScrollController _controllerOne = ScrollController();
///
/// @override
/// Widget build(BuildContext context) {
/// return Scrollbar(
/// controller: _controllerOne,
/// isAlwaysShown: true,
/// child: GridView.builder(
/// controller: _controllerOne,
/// itemCount: 120,
/// gridDelegate:
/// const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
/// itemBuilder: (BuildContext context, int index) {
/// return Center(
/// child: Text('item $index'),
/// );
/// },
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment