Skip to content

Instantly share code, notes, and snippets.

View ScottS2017's full-sized avatar

Scott ScottS2017

View GitHub Profile
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Squircle',
import 'package:flutter/widgets.dart';
/// Displays an overlay Widget anchored directly above the center of this
/// [AnchoredOverlay].
///
/// The overlay Widget is created by invoking the provided [overlayBuilder].
///
/// The [anchor] position is provided to the [overlayBuilder], but the builder
/// does not have to respect it. In other words, the [overlayBuilder] can
/// interpret the meaning of "anchor" however it wants - the overlay will not
@ScottS2017
ScottS2017 / main.dart
Created September 23, 2018 21:23
New default main.dart Live Template that can handle desktop embedding (IntelliJ Live Template)
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'
show debugDefaultTargetPlatformOverride;
void main() {
debugDefaultTargetPlatformOverride = TargetPlatform.android;
_setTargetPlatformForDesktop();
runApp($MyApp$());
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
/// Use these booleans to see how each approach works, use the one that fits your needs
/// *** For some strange reason HotReload is not responding to changes in these bools
/// but if you use HotRestart then it's fine.
@ScottS2017
ScottS2017 / No_flexible_Green_Yellow_Containers.dart
Last active March 15, 2019 12:23
No_flexible_Green_Yellow_Containers.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
@ScottS2017
ScottS2017 / tight_and_loose_flexibles_together.dart
Last active March 15, 2019 12:27
tight_and_loose_flexibles_together.dart
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
appBar: AppBar(
title: Text('Deep Dive Testing'),
backgroundColor: Colors.blue,
),
final Widget render_constrained_box_object_was_given_an_infinite_size_during_layout =
Column(
children: <Widget>[
Row(
children: <Widget>[
Container(
child: SizedBox(
height: double.infinity,
),
),
Expanded({
Key key,
int flex = 1,
@required Widget child,
}) : super(
key: key,
flex: flex,
fit: FlexFit.tight,
child: child,
);
Widget brokenCodeRenderFlexError =
Column(
/// A Column's default is "mainAxisSize: MainAxisSize.max,"
/// This means it will try to take all the height it's allowed to.
children: <Widget>[
Container(
height: 300,
width: double.infinity,
color: Colors.red,
),
void main() {
runApp(
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Flexible(
fit: FlexFit.loose,
child: Container(
color: Colors.blue,
height: 100,