Created with <3 with dartpad.dev.
Created
July 5, 2022 18:15
-
-
Save bltavares/9c36cbdd3cb8b0079a92ff97b35eb7d5 to your computer and use it in GitHub Desktop.
elegant-sparkle-3214
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'; | |
const 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( | |
appBar: AppBar(), | |
body: MyWidget(), | |
), | |
); | |
} | |
} | |
class NoisyText extends StatefulWidget { | |
final String text; | |
const NoisyText(this.text, {super.key}); | |
@override | |
State<NoisyText> createState() => _NoisyTextState(); | |
} | |
class _NoisyTextState extends State<NoisyText> { | |
@override | |
void initState() { | |
super.initState(); | |
print(widget.text); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
color: Colors.white, | |
padding: const EdgeInsets.all(50), | |
child: Text(widget.text), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return CustomScrollView(slivers: [ | |
SliverList( | |
delegate: SliverChildListDelegate( | |
[ | |
Column( | |
children: List.generate( | |
1000, | |
(index) => NoisyText('Hello $index'), | |
)) | |
], | |
)) | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment