Skip to content

Instantly share code, notes, and snippets.

@imaNNeo
Created November 13, 2021 21:58
Show Gist options
  • Save imaNNeo/c8f008bb85a82856087df31477d3ecb4 to your computer and use it in GitHub Desktop.
Save imaNNeo/c8f008bb85a82856087df31477d3ecb4 to your computer and use it in GitHub Desktop.
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