Last active
June 2, 2020 19:49
-
-
Save onatcipli/0aa3c4d09b0ca72e1cdd5d4186a31c13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
/// able to show scrollbar always with following example | |
/// available with changes from this branch https://github.com/onatcipli/flutter/tree/scrollbar_display_always | |
void main() => runApp(MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
ScrollController _controller = ScrollController(); | |
bool _displayAlways = false; | |
int _itemCount = 15; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('displayAlways : $_displayAlways'), | |
), | |
body: Scrollbar( | |
displayAlways: _displayAlways, | |
controller: _controller, | |
child: ListView.builder( | |
controller: _controller, | |
itemCount: _itemCount, | |
itemBuilder: (BuildContext context, int index) { | |
return ListTile( | |
title: Text('Numbers 123'), | |
contentPadding: EdgeInsets.all(15), | |
); | |
}, | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
child: Icon(Icons.threed_rotation), | |
onPressed: () { | |
setState(() { | |
_displayAlways = !_displayAlways; | |
}); | |
}, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment