Created
February 12, 2024 10:28
-
-
Save IchordeDionysos/7b209e673de7ee0a8ebd26abe07c779b to your computer and use it in GitHub Desktop.
Flutter Web scrolling problem
This file contains 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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | |
useMaterial3: true, | |
), | |
home: const MyHomePage(title: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
final String title; | |
const MyHomePage({ | |
super.key, | |
required this.title, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | |
title: Text(title), | |
), | |
body: ListView( | |
children: [ | |
for (var i = 0; i < 60; i++) | |
SizedBox( | |
height: 50, | |
child: ListView( | |
scrollDirection: Axis.horizontal, | |
children: [ | |
for (var i = 0; i < 30; i++) | |
Container( | |
width: 50, | |
height: 50, | |
color: Color( | |
(math.Random().nextDouble() * 0xFFFFFF).toInt(), | |
).withOpacity(1.0), | |
) | |
], | |
), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment