Skip to content

Instantly share code, notes, and snippets.

@funwithflutter
funwithflutter / main.dart
Created August 10, 2021 20:24
Duration example
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
@funwithflutter
funwithflutter / firebase_authentication_service.dart
Created May 14, 2020 08:47
An example Firebase authentication service class
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import '../models/user.dart';
class FirebaseAuthService {
final FirebaseAuth _firebaseAuth;
final GoogleSignIn _googleSignIn;
FirebaseAuthService({FirebaseAuth firebaseAuth, GoogleSignIn googleSignin})
@funwithflutter
funwithflutter / index.html
Last active May 14, 2020 08:33
Flutter web Firebase initialization example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- STEP 3: ADD YOUR CLIENT ID -->
<meta name="google-signin-client_id" content="ADD-HERE.apps.googleusercontent.com">
@funwithflutter
funwithflutter / spring_curve.dart
Created March 23, 2020 13:02
Spring curve class
class SpringCurve extends Curve {
const SpringCurve({
this.a = 0.15,
this.w = 19.4,
});
final double a;
final double w;
@override
double transformInternal(double t) {
@funwithflutter
funwithflutter / sine_curve.dart
Created March 23, 2020 12:58
Sine curve class
class SineCurve extends Curve {
final double count;
SineCurve({this.count = 3});
// t = x
@override
double transformInternal(double t) {
var val = sin(count * 2 * pi * t) * 0.5 + 0.5;
return val; //f(x)
@funwithflutter
funwithflutter / animating_page_transitions.dart
Last active August 10, 2021 21:52
A simple example demonstrating how to animate page transitions in Flutter.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Animating Route Transitions',
@funwithflutter
funwithflutter / extension_method_animation_demo.dart
Last active August 10, 2021 22:18
Animation with extension methods demo in Flutter
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
@funwithflutter
funwithflutter / transform_perspective_demo.dart
Last active August 10, 2021 22:03
A demo showcasing perspective and transform manipulation in Flutter.
/// This example is slightly adapted from
/// https://medium.com/flutter-community/advanced-flutter-matrix4-and-perspective-transformations-a79404a0d828
/// and
/// https://medium.com/flutter/perspective-on-flutter-6f832f4d912e
///
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
@funwithflutter
funwithflutter / paint_demo.dart
Last active August 10, 2021 22:05
Paint demo with a simple animation. Creates a loading bar.
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
@funwithflutter
funwithflutter / bezier_curve_simulator.dart
Last active August 10, 2021 22:15
A Bezier Curve simulator written in Flutter
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(