Skip to content

Instantly share code, notes, and snippets.

View Luckey-Elijah's full-sized avatar
🦢
Working from home

Elijah Luckey Luckey-Elijah

🦢
Working from home
  • InsuranceToolkits
  • Florida
  • 19:48 (UTC -04:00)
View GitHub Profile
@Luckey-Elijah
Luckey-Elijah / logout_button.dart
Created June 18, 2024 16:01
A useful OverlayPortal widget wrapper for building based on the anchor/target's position.
import 'positioned_overlay_builder.dart';
import 'package:flutter/material.dart';
class LogoutButton extends StatelessWidget {
const LogoutButton({super.key});
@override
Widget build(BuildContext context) {
return PositionedOverlayBuilder(
anchorBuilder: (context, controller) {
const k = {
"admin-restricted-operation": "This operation is restricted to administrators only.",
"argument-error": "",
"app-not-authorized": "This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.",
"app-not-installed": "The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.",
"captcha-check-failed": "The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.",
"code-expired": "The SMS code has expired. Please re-send the verification code to try again.",
"cordova-not-ready": "Cordova framework is not ready.",
"cors-unsupported": "This browser is not supported.",
"credential-already-in-use": "This credential is already associated with a different user account.",

dpad.dart

dpad is your local dart scripting environment. This is a simple guide to start using dart scripts across your machine.

Requirements

  • dart installed (I recommend using puro to manage dart/flutter versions)
  • bash/zsh-like environment (this is likely possible in other terminals but idk how to set that up and am too lazy to tell you)

Setup

@Luckey-Elijah
Luckey-Elijah / main.dart
Created August 28, 2023 20:46
discord-like-commands
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
import 'dart:math';
import 'package:benchmark_harness/benchmark_harness.dart';
void main(List<String> args) {
final random = Random();
ShapeType randomShapeType() => ShapeType.values[random.nextInt(4)];
double randomSize() => random.nextDouble();
@Luckey-Elijah
Luckey-Elijah / main.dart
Last active January 9, 2023 16:58
Dart Loop Benchmarking
// Adding this line so we can perform the variable assignment: num eachElement = 0;
// ignore_for_file: unused_local_variable
import 'dart:collection';
import 'dart:math';
void main(List<String> args) {
final list = UnmodifiableListView(
List<int>.generate(200000000, (index) => index),
);
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: EyesThatFollow()));
class EyesThatFollow extends StatefulWidget {
const EyesThatFollow({super.key});
@override
State<EyesThatFollow> createState() => _EyesThatFollowState();
}
@Luckey-Elijah
Luckey-Elijah / main.dart
Last active July 27, 2022 21:46
Addds expanding functionality when hovering over the navigation rail
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
@Luckey-Elijah
Luckey-Elijah / readme.md
Last active July 7, 2022 20:37
Flutte upload to tesflight
  1. Run flutter build ipa --release -t lib/main/production.dart

    $ flutter build ipa
    Archiving com.example.example...
    Automatically signing iOS for device deployment using specified development team in Xcode project: J........Z
    Running pod install...
    Running Xcode build...
    └─Compiling, linking and signing...

Xcode archive done.

@Luckey-Elijah
Luckey-Elijah / cached_streamable.dart
Last active July 20, 2022 18:07
Cached Streamable class
import 'dart:async';
import 'package:meta/meta.dart';
/// {@template cached_streamable}
/// Extend this class for a streamable, single-data type repository.
/// {@endtemplate}
abstract class CachedStreamable<T> {
/// {@macro cached_streamable}
CachedStreamable({
required T initialState,