Last active
October 24, 2020 19:08
-
-
Save imaNNeo/5cc746b3a922ce1b581c548f35f406af 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'; | |
main() => runApp(MaterialApp(home: MyHomePage())); | |
class MyHomePage extends StatelessWidget { | |
final itemWidth = 120.0; | |
final itemHorizontalMargin = 4.0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Flutter 4 Fun'), | |
), | |
body: Center( | |
child: SizedBox( | |
height: 200.0, | |
child: ListView.builder( | |
scrollDirection: Axis.horizontal, | |
itemBuilder: (context, i) { | |
return Container( | |
width: itemWidth, | |
height: 200, | |
margin: EdgeInsets.symmetric(horizontal: itemHorizontalMargin), | |
decoration: BoxDecoration( | |
color: Colors.purple, | |
borderRadius: BorderRadius.all(Radius.circular(4.0)), | |
), | |
child: Center( | |
child: Text( | |
'$i', | |
style: TextStyle( | |
color: Colors.white, | |
fontWeight: FontWeight.bold, | |
fontSize: 22, | |
), | |
), | |
), | |
); | |
}, | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment