Skip to content

Instantly share code, notes, and snippets.

View cristianfb1989's full-sized avatar

Cristian Fabian Bustos cristianfb1989

View GitHub Profile
@happyharis
happyharis / main.dart
Created March 14, 2020 09:23
Proxy provider with firebase authentication
void main() {
Provider.debugCheckInvalidValueType = null;
runApp(MyAppExample());
}
class MyAppExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MultiProvider(providers: [
@Christopher2K
Christopher2K / list_view_with_extra_elements.dart
Created March 9, 2020 16:08
Allow ListView.builder() to have leading / trailling elements
import 'package:flutter/material.dart';
class ListViewWithExtraElements<T> extends StatelessWidget {
final List<T> elements;
final List<Widget> leadingElements;
final List<Widget> trailingElements;
final Widget Function(BuildContext context, T element) itemBuilder;
ListViewWithExtraElements({
this.leadingElements = const [],
@happyharis
happyharis / neumorphic_bar.dart
Created January 22, 2020 12:17
A neumorphic bar
NeumorphicBar(
width: 200,
height: 400,
value: 0.9,
text: 'Tue',
color: Color.fromRGBO(0, 200, 156, 1),
),
class NeumorphicBar extends StatelessWidget {
const NeumorphicBar({
GetIt supports since recently a mechanic to make initialization of registered
Instances easier.
The idea is that you can mark Singletons/LazySingletons that they will signal
when they are ready.
You then can wait for either that all are ready or that one of them is ready or
trigger the readyFuture manually
In case of a timeout you get detailed debug information.
void main() {
runApp(_SwitchingThemeApp());
}
/// Properties that help me keep track of the example being run.
bool _useMaterial = false;
class _SwitchingThemeApp extends StatefulWidget {
@override
_SwitchingThemeAppState createState() => _SwitchingThemeAppState();
@mjohnsullivan
mjohnsullivan / draggable_custom_painter.dart
Created November 26, 2019 21:32
Handling draggable areas or elements drawn on a Flutter CustomPainter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Draggable Custom Painter',
home: Scaffold(
@slightfoot
slightfoot / main.dart
Last active June 1, 2024 11:10
Firebase Login/Logout Example - by Simon Lightfoot
/*
This example uses the following packages:
firebase_auth: 0.14.0+5
google_sign_in: 4.0.7
provider: 3.1.0+1
Make sure you have setup your project with Firebase by following these instructions:
1. Follow Option 1 instructions here up to Step 3
@slightfoot
slightfoot / single_top.dart
Last active June 19, 2022 11:15
Recreating Android Single-Top Activity behaviour with Flutter Route's - by Simon Lightfoot
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@aaronstgeorge-wf
aaronstgeorge-wf / module_explorer.dart
Last active October 14, 2019 18:55
Small tool to print a mapping between module file "primary source" and dart files that are part of that module
import 'dart:convert';
import 'dart:core';
import 'dart:io';
main() {
final packageName = Directory.current.path.split('/').last;
final generated = new Directory('.dart_tool/build/generated/$packageName');
// The build system's documentation reads "[e]mit .module assets which contain
// a filtered view of the package level meta-module specific to a single