Skip to content

Instantly share code, notes, and snippets.

View RobertBrunhage's full-sized avatar

Robert Brunhage RobertBrunhage

View GitHub Profile
@RobertBrunhage
RobertBrunhage / neutral_color_extension.dart
Created February 3, 2025 07:39
A Theme extension to use neutral colors with automatic light and dark mode switching
import 'package:flutter/material.dart';
@immutable
class NeutralColors extends ThemeExtension<NeutralColors> {
final Color neutral50;
final Color neutral100;
final Color neutral200;
final Color neutral300;
final Color neutral400;
final Color neutral500;
@RobertBrunhage
RobertBrunhage / .gitconfig
Last active July 21, 2023 18:45
Ignore files/folders that makes me cringe
[core]
excludesfile = ~/.gitignore
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@RobertBrunhage
RobertBrunhage / material_bottomsheet_hell.dart
Last active May 9, 2023 05:41
A usage of material bottomsheet that should push the bottomsheet up in case of keyboard, but doesn't
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@RobertBrunhage
RobertBrunhage / main.dart
Last active May 7, 2023 11:38
Dart 3 examples
// ------- Different class declarations -------
base class BaseClassExample {}
mixin class MiximClassExample {}
final class FinalClassExample {}
// ------- Different class usages -------
@RobertBrunhage
RobertBrunhage / nnoremap.lua
Last active December 23, 2022 13:06
nnoremap
-- vimscript way
-- nnoremap <leader>fd :below new output:///flutter-dev <CR>
-- lua way
vim.keymap.set("n", "<leader>fd", ":below new output:///flutter-dev <CR>")
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(HomePage());
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
include: all_lint_rules.yaml
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
# This is generated from the i18n vscode extension
- "**/i18n.dart"
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
- avoid_annotating_with_dynamic
- avoid_as
@RobertBrunhage
RobertBrunhage / Flutter_test_snippets.code-snippets
Created January 2, 2021 15:07
These snippets I have gotten from FilledStacks so make sure to follow him!
{
"Main Test Suite Setup": {
"prefix": "testm",
"body": [
"import 'package:flutter_test/flutter_test.dart';",
"",
"void main() {",
" group('${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}} -', (){",
"",
" });",