Skip to content

Instantly share code, notes, and snippets.

View timmaffett's full-sized avatar

Tim Maffett timmaffett

View GitHub Profile
@timmaffett
timmaffett / gist:7e8b9f5c36526279a2d706214181f5e6
Created September 7, 2025 15:26
FilipsExampleWith_watch_it
import 'package:english_words/english_words.dart';
import 'package:flutter/material.dart';
import 'package:watch_it/watch_it.dart';
final sl = GetIt.instance;
void main() {
sl.registerLazySingleton(() => MyAppState());
@timmaffett
timmaffett / main.dart
Last active September 7, 2025 14:10
LukesSimpleGrid
// https://x.com/luke_pighetti/status/1962682748776087930
import 'package:flutter/material.dart';
class SimpleGrid extends StatelessWidget {
const SimpleGrid({
super.key,
required this.gap,
required this.columns,
required this.children,
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+k",
"command": "-editor.action.addCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+1",
"command": "moveActiveEditor",
@timmaffett
timmaffett / asset_bundle_find_helpers.dart
Last active May 20, 2024 23:22
Flutter: AssetBundleFindHelpers extension class on AssetBundle
import 'package:flutter/services.dart';
/// Implements @matthew-carroll 's proposal in https://github.com/flutter/flutter/issues/137043
///
/// Example use/results
///
/// in main():
///
/// await rootBundle.initAssetBundleFindHelpers(); //strictly speaking this does not need to be awaited
///
@timmaffett
timmaffett / main.dart
Created April 19, 2024 22:32
Example of AutoComplete with support for focusNode and textEditingController
// Copyright 2014 The Flutter Authors. 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:flutter/scheduler.dart';
import 'package:flutter/material.dart';
//import 'ink_well.dart';
//import 'material.dart';
//import 'text_form_field.dart';
@timmaffett
timmaffett / main.dart
Last active May 1, 2023 06:19
wild-gorge-8043
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@timmaffett
timmaffett / main.dart
Created April 24, 2023 18:21
wild-gorge-8043
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
import 'dart:ui';
import 'package:flutter/material.dart' hide Gradient;
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/effects.dart';
class SunSegment extends RectangleComponent {
SunSegment(int i)
: super(
@timmaffett
timmaffett / main.dart
Created July 4, 2022 17:00 — forked from immadisairaj/main.dart
Flame Water Wave #FlameEffectsChallenge
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/effects.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
GameWidget(game: FlameWave()),
);
}
@timmaffett
timmaffett / index.html
Last active April 5, 2022 15:48 — forked from jcollins-g/index.html
Sunflower
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sunflower</title>
<link rel="stylesheet" href="styles.css">
<script type="application/dart" src="main.dart"></script>
</head>