Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working From Home

Rody Davis rodydavis

:octocat:
Working From Home
View GitHub Profile
@rodydavis
rodydavis / dropzone.dart
Created Feb 13, 2020 — forked from mosheduminer/dropzone.dart
Implementation of a drag-and-drop zone for flutter web. Inspired by https://gist.github.com/PlugFox/ffe83a91ce50f9c78a5b1d6674e36d1b
View dropzone.dart
import 'dart:async';
import 'dart:html';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum _DragState {
dragging,
notDragging,
}
@rodydavis
rodydavis / stream_widget.dart
Created Feb 13, 2020 — forked from rseibane/stream_widget.dart
[Flutter] Reusable Widget to handle the common flows working with Streams
View stream_widget.dart
import 'package:flutter/material.dart';
class StreamWidget<T> extends StatelessWidget {
final Stream<T> stream;
final Widget Function() onLoading;
final Widget Function(T) onData;
final Widget Function(dynamic) onError;
const StreamWidget({
@required this.stream,
@rodydavis
rodydavis / dottedBorder.dart
Created Dec 27, 2019 — forked from PlugFox/dottedBorder.dart
Flutter Web simple file upload
View dottedBorder.dart
import 'package:flutter_web/material.dart';
import 'dart:math' as math;
class DottedBorder extends StatelessWidget {
final Color color;
final double strokeWidth;
final double gap;
final Widget child;
final EdgeInsets padding;
@rodydavis
rodydavis / scratch_card.dart
Created Jun 13, 2019 — forked from slightfoot/scratch_card.dart
Scratch Card - Unfinished Flutter implementation of https://allu.io/react-scratchcard/
View scratch_card.dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:math' as math;
void main() => runApp(DemoApp());
class DemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@rodydavis
rodydavis / programmatic-dynamic-images.m
Created Jun 8, 2019 — forked from timonus/programmatic-dynamic-images.m
Programmatically create iOS 13 dynamic images
View programmatic-dynamic-images.m
- (UIImage *)dynamicImage
{
UITraitCollection *const baseTraitCollection = /* an existing trait collection */;
UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]];
UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];
UITraitCollection *const darkTraitCollection = UITraitCollection *lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]];
__block UIImage *lightImage;
[lightTraitCollection performAsCurrentTraitCollection:^{
lightImage = /* draw image */;
@rodydavis
rodydavis / guide.txt
Created Apr 23, 2019 — forked from tomaszpolanski/guide.txt
Building Flutter for MacOS
View guide.txt
- `flutter channel master && flutter doctor`
- `export ENABLE_FLUTTER_DESKTOP=true`
- `git clone git@github.com:google/flutter-desktop-embedding.git`
- Move your project inside the `flutter-desktop-embedding` folder
- Copy the `macos` folder from `flutter-desktop-embedding/example` to your project
- `cd flutter-desktop-embedding/my-project && flutter run -d macos`
@rodydavis
rodydavis / run_logged.dart
Last active Apr 18, 2019 — forked from slightfoot/run_logged.dart
Logging your app's print statements to a local file for later processing.
View run_logged.dart
import 'dart:async';
import 'dart:core';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
void main() => runLoggedApp(App());
@rodydavis
rodydavis / README.md
Last active Apr 10, 2019 — forked from kasperpeulen/README.md
How to pretty-print JSON using Dart.
View README.md
@rodydavis
rodydavis / macapp.go
Created Mar 28, 2019 — forked from mholt/macapp.go
Distribute your Go program (or any single binary) as a native macOS application
View macapp.go
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
View rubber_range_picker.dart
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
void main() => runApp(ExampleApp());
class ExampleApp extends StatelessWidget {
@override
You can’t perform that action at this time.