Skip to content

Instantly share code, notes, and snippets.

@imaNNeo
Last active October 24, 2020 19:08
Show Gist options
  • Save imaNNeo/5cc746b3a922ce1b581c548f35f406af to your computer and use it in GitHub Desktop.
Save imaNNeo/5cc746b3a922ce1b581c548f35f406af to your computer and use it in GitHub Desktop.
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