Skip to content

Instantly share code, notes, and snippets.

@stephaniefash
Last active August 16, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephaniefash/86ac980b64d5541ef905e39264c63d68 to your computer and use it in GitHub Desktop.
Save stephaniefash/86ac980b64d5541ef905e39264c63d68 to your computer and use it in GitHub Desktop.
class _MyHomePageState extends State<MyHomePage> {
List<String> imageList = [
'https://images.unsplash.com/photo-1523554888454-84137e72c3ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1569172122301-bc5008bc09c5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/flagged/photo-1572392640988-ba48d1a74457?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1589030343991-69ea1433b941?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1561214115-f2f134cc4912?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1555443805-658637491dd4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1572450732467-5eb1311e7bc8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1267&q=80',
'https://images.unsplash.com/photo-1523554888454-84137e72c3ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1569172122301-bc5008bc09c5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/flagged/photo-1572392640988-ba48d1a74457?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1589030343991-69ea1433b941?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1561214115-f2f134cc4912?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
'https://images.unsplash.com/photo-1555443805-658637491dd4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60',
];
@override
void initState() {
SystemChrome.setEnabledSystemUIOverlays([]); // <- makes app full screen
super.initState();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.black,
appBar: PreferredSize( // <- responsible for creating the app bar you see above
preferredSize: Size.fromHeight(100),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Text(
widget.title,
style: TextStyle(
fontFamily: 'Vogue', // <- custom font
color: Colors.white,
fontSize: 30,
letterSpacing: 8),
),
],
),
),
body: SingleChildScrollView(
child: new Column(children: [
new GridView.count(
crossAxisCount: 2,
controller: new ScrollController(keepScrollOffset: false),
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: imageList.map((String url) {
return _singleImagePreview(url);
}).toList(),
),
]),
),
);
}
Widget _singleImagePreview(String imageUrl) {
return new Container(
height: 100.0,
margin: new EdgeInsets.all(1.0),
child: Image.network(imageUrl, fit: BoxFit.cover),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment