Skip to content

Instantly share code, notes, and snippets.

@lukepighetti
Created June 20, 2020 16:33
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 lukepighetti/a2a90b4f3ff11bb32d1e838b0948a8e3 to your computer and use it in GitHub Desktop.
Save lukepighetti/a2a90b4f3ff11bb32d1e838b0948a8e3 to your computer and use it in GitHub Desktop.
Just another day fighting flutter
import 'package:flutter/material.dart';
import 'package:flutter_sandbox/widgets/layout/default_scaffold.dart';
import 'package:flutter_sandbox/themes/text_themes.dart';
class SandboxRoute extends StatefulWidget {
@override
_SandboxRouteState createState() => _SandboxRouteState();
}
class _SandboxRouteState extends State<SandboxRoute> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: Container(
height: 200,
child: ClipRect(
child: Container(
height: 300,
width: 100,
color: Colors.blue.withOpacity(0.2),
child: Column(
children: [
for (var e in [1, 2, 3])
Expanded(
/// Remove expanded to see appropriate size, but clipping
child: AspectRatio(
aspectRatio: 1.0,
child: Container(
color: Colors.red.withOpacity(0.2),
alignment: Alignment.center,
child: Text("$e"),
),
),
)
],
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment