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 / run.dart
Last active February 2, 2023 15:51
Cross platform Flutter compute method
View run.dart
export 'run.io.dart' if (dart.library.html) 'run.web.dart';
@rodydavis
rodydavis / dart_to_dart.dart
Created January 10, 2023 02:41
Dart ast to dart export
View dart_to_dart.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:meta/meta.dart';
/// A visitor used to write a source representation of a visited AST node (and
@rodydavis
rodydavis / flutter_infinite_canvas.dart
Last active January 13, 2023 23:52
Flutter infinite canvas with InteractiveViewer + CustomMultiChildLayout
View flutter_infinite_canvas.dart
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' hide Colors;
void main() {
final controller = WidgetCanvasController([
WidgetCanvasChild(
key: UniqueKey(),
offset: Offset.zero,
size: const Size(400, 800),
child: Scaffold(
@rodydavis
rodydavis / flutter_canvas_demo.dart
Last active December 23, 2022 23:18
Flutter Canvas Demo
View flutter_canvas_demo.dart
import 'package:flutter/material.dart';
void main() {
runApp(const StoryBoardExample());
}
class StoryBoardExample extends StatelessWidget {
const StoryBoardExample({super.key});
@override
@rodydavis
rodydavis / flutter_material_3_markdown_view.dart
Created September 13, 2022 15:43
Material 3 Theme for Markdown package in Flutter
View flutter_material_3_markdown_view.dart
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:go_router/go_router.dart';
import 'package:markdown/markdown.dart' as md;
import 'package:url_launcher/url_launcher.dart';
class MarkdownView extends StatelessWidget {
const MarkdownView({
Key? key,
required this.markdown,
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<link rel="stylesheet" href="https://rodydavis.github.io/material-design-lite/css/mdl.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body class="light-theme">
<button class="button filled">Button</button>
<script src="main.ts"></script>
@rodydavis
rodydavis / gist:8a819c292b39826382f242415dc19b21
Created July 24, 2022 03:58 — forked from jampajeen/gist:d19f36a7309d0ead0e1f9735a26d66f3
Disable/Enable Mac OSX sleep on lid closed
View gist:8a819c292b39826382f242415dc19b21
# disable sleep
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1
# re-enable sleep
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0
@rodydavis
rodydavis / flutter_animations.dart
Created July 15, 2022 20:43
Flutter Animations
View flutter_animations.dart
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
@rodydavis
rodydavis / flutter_xcode_cloud_script.sh
Created June 6, 2022 03:09
flutter script to build app on Xcode Cloud ci_scripts/ci_post_install.sh
View flutter_xcode_cloud_script.sh
#!/bin/sh
# Install CocoaPods using Homebrew.
brew install cocoapods
# Install Flutter
brew install --cask flutter
# Run Flutter doctor
flutter doctor
@rodydavis
rodydavis / flutter_master_detail.dart
Last active April 9, 2022 06:04
Flutter Master Detail View
View flutter_master_detail.dart
import 'package:flutter/material.dart';
class MasterDetail<T> extends StatefulWidget {
const MasterDetail({
Key? key,
required this.listBuilder,
required this.detailBuilder,
required this.onPush,
this.emptyBuilder,
}) : super(key: key);