Last active
April 22, 2022 15:47
-
-
Save dJani97/ea6c08617939ea9c4932c7fb1bbd5b9b to your computer and use it in GitHub Desktop.
Flutter cat scroller
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'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: ListView( | |
children: [ | |
...List.generate(500, (index) => MyWidget(index)), | |
], | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
final int index; | |
const MyWidget(this.index); | |
@override | |
Widget build(BuildContext context) { | |
return Card( | |
child: Row( | |
children: [ | |
Image.network('https://cataas.com/cat?rnd=$index', height: 150), | |
const SizedBox(width: 18), | |
Flexible( | |
child: SelectableText( | |
'Hello Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.', | |
style: Theme.of(context).textTheme.bodyMedium, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment