Skip to content

Instantly share code, notes, and snippets.

@johnpryan
johnpryan / main.dart
Created October 18, 2023 16:50
lively-performance-3668
bool isVertical = false;
Widget build() {
return const Column(
direction: isVertical ? 'vertical' : 'horizontal',
children: [
Widget(),
Widget(),
],
);
}
@johnpryan
johnpryan / main.dart
Created October 10, 2023 17:46
lively-performance-3668
void main() {
var record = ("Hello", "World");
var record2 = ("Hello", "World");
print(record == record2);
print(record.hashCode);
print(record2.hashCode);
}
@johnpryan
johnpryan / main.dart
Last active April 24, 2023 23:23
Patterns example
class Drink {
int ounces;
Drink(this.ounces);
}
class Coffee extends Drink {
final bool decaf;
Coffee(int ounces, {this.decaf = false}) : super(ounces);
}
@johnpryan
johnpryan / main.dart
Created March 2, 2023 21:24
tangled-gust-5485
import 'package:flutter/material.dart';
import 'package:flame/flame.dart';
import 'dart:async';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@johnpryan
johnpryan / main.dart
Created December 19, 2022 21:22
ubiquitous-cliff-4392
import 'package:flutter/material.dart';
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(DevToolsApp());
}
final _router = GoRouter(
routes: [
@johnpryan
johnpryan / LICENSE
Last active September 21, 2022 19:36
go_router 5 sample
Copyright 2013 The Flutter Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
@johnpryan
johnpryan / main.dart
Created June 29, 2022 21:27
wild-snow-4456
/// This is a test of the new GitHub integration feature.
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@johnpryan
johnpryan / main.dart
Created April 8, 2022 18:56
Dart mixin precedence
void main() {
var animal = Bird();
print(animal.nextAction());
}
abstract class Animal {
String get name;
// 4th precedence
String makeNoise() => '(uninteligble animal sound)';
@johnpryan
johnpryan / main.dart
Last active January 16, 2020 22:23
Drawer navigation in Flutter
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: RootPage(),
));
}
class Destination {
@johnpryan
johnpryan / main.dart
Created January 7, 2020 22:42
Custom notifications in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
MyApp();
_MyAppState createState() => _MyAppState();