Skip to content

Instantly share code, notes, and snippets.

View stargazing-dino's full-sized avatar
🏠
Working from home

Rex Magana stargazing-dino

🏠
Working from home
View GitHub Profile
@stargazing-dino
stargazing-dino / my_painter.dart
Created February 8, 2020 20:33
Compares lines between canvas.drawLine and canvas.drawVertices
class MyPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final brush = Paint()
..color = Colors.blue
..strokeWidth = 4
..style = PaintingStyle.stroke;
canvas.drawVertices(
UI.Vertices(
import 'dart:math';
import 'dart:typed_data';
import 'dart:ui' as UI;
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' hide Colors;
final TargetPlatform platform = TargetPlatform.android;
@stargazing-dino
stargazing-dino / message_shape.dart
Created November 24, 2019 17:09
Draws a shape that looks like a chat message with the tail or tip near the top or bottom
import 'package:flutter/material.dart';
class MessageShape extends ShapeBorder {
const MessageShape({
@required this.target,
@required this.borderRadius,
@required this.tailHeight,
@required this.tailBaseWidth,
});
@stargazing-dino
stargazing-dino / auth.dart
Last active October 20, 2019 17:14
An example of dealing with auth methods in Flutter with FB and Google sign in
import 'dart:async';
import 'package:appname/services/firestore.dart';
import 'package:appname/utils/get_status_code_error.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_facebook_login/flutter_facebook_login.dart';
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn _googleSignIn = GoogleSignIn(scopes: ['email']);
@stargazing-dino
stargazing-dino / Info.plist
Created October 19, 2019 17:34
An Example of the info plist inside ios for a flutter application
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
@stargazing-dino
stargazing-dino / build.gradle
Created October 19, 2019 17:22
An example of a working build.gradle for flutter
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
@stargazing-dino
stargazing-dino / gradle.properties
Created October 19, 2019 17:19
An example for the gradle.properties file 10/19/2019
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
@stargazing-dino
stargazing-dino / gradle.build
Created October 19, 2019 17:17
A gradle build for getting FB and Google auth 10/19/2019
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
import 'package:flutter/material.dart';
/// This is possibly an issue with the flutter framework where
/// when returning a container for FAB, it won't show a
/// floating snackbar but it will show a fixed one
class FloatingIssue extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: Container(),
@stargazing-dino
stargazing-dino / continuous_mixin.dart
Created September 13, 2019 18:27
Continuous Requests Mixin
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobile/utils/lifecycle_event_handler.dart';
/// Attaches to a [Widget] and calls [fetchData] every [interval] seconds
/// or upon app reactivation.
mixin ContinuousRequest<T extends StatefulWidget> on State<T> {
/// A subscription that calls [fetch] data every [interval] seconds