Skip to content

Instantly share code, notes, and snippets.

@kenzieschmoll
Last active February 3, 2021 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzieschmoll/c9152384ce6487a181750e35f8a0d169 to your computer and use it in GitHub Desktop.
Save kenzieschmoll/c9152384ce6487a181750e35f8a0d169 to your computer and use it in GitHub Desktop.
Scrollbar-bug
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 500,
width: 500,
child: Scrollbar(
isAlwaysShown: true,
child: ListView(
children: [
Container(height: 100, width: 20, color: Colors.red),
Container(height: 100, width: 20, color: Colors.green),
Container(height: 100, width: 20, color: Colors.red),
Container(height: 100, width: 20, color: Colors.green),
Container(height: 100, width: 20, color: Colors.red),
Container(height: 100, width: 20, color: Colors.green),
],
),
),
),
SizedBox(width: 30),
SizedBox(
height: 500,
width: 500,
child: Scrollbar(
isAlwaysShown: true,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
Container(height: 100, width: 100, color: Colors.red),
Container(height: 100, width: 100, color: Colors.green),
Container(height: 100, width: 100, color: Colors.red),
Container(height: 100, width: 100, color: Colors.green),
Container(height: 100, width: 100, color: Colors.red),
Container(height: 100, width: 100, color: Colors.green),
],
),
),
),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment