Created
November 13, 2021 21:58
-
-
Save imaNNeo/c8f008bb85a82856087df31477d3ecb4 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'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter4fun', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: const HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.blueGrey, | |
body: LayoutBuilder( | |
builder: (context, constraints) { | |
return GridView.count( | |
crossAxisCount: constraints.maxWidth < 800 ? 1 : 2, | |
childAspectRatio: 1.7, | |
padding: const EdgeInsets.all(16), | |
crossAxisSpacing: 16, | |
mainAxisSpacing: 16, | |
children: const [ | |
Card(), | |
Card(), | |
Card(), | |
Card(), | |
], | |
); | |
} | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment