Skip to content

Instantly share code, notes, and snippets.

@ashishbeck
Created August 2, 2023 10:08
Show Gist options
  • Save ashishbeck/c0c87fc478d6524afc9a5e64d253d787 to your computer and use it in GitHub Desktop.
Save ashishbeck/c0c87fc478d6524afc9a5e64d253d787 to your computer and use it in GitHub Desktop.
Flutter layout
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Layout Builder Example')),
body: Center(
child: Container(
color: Colors.blue,
width: 200,
height: 200,
child: LayoutBuilder(
builder: (context, constraints) {
return Container(
width: 300,
height: 100,
color: Colors.red,
);
},
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment