Skip to content

Instantly share code, notes, and snippets.

View miguelpruivo's full-sized avatar
🚀
Fluttering

Miguel Ruivo miguelpruivo

🚀
Fluttering
View GitHub Profile
@slightfoot
slightfoot / main.dart
Last active June 19, 2022 11:15
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
@escamoteur
escamoteur / nextField.dart
Created September 13, 2019 12:22
So easy is it now to implement a next field behavior for forms, meaning that the focus is moved as soon the user tabs the next button on the keyboard
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
FocusScopeNode _node = FocusScopeNode(); /// <-----------------
@override
void initState() {
_tabController = TabController(length: 3, vsync: this);
@brianegan
brianegan / ez_animated_list.dart
Created March 5, 2019 18:55
An AnimatedList that does all the hard work for ya.
library ez_animated_list;
import 'package:flutter/widgets.dart';
typedef EzAnimatedItemBuilder<T> = Widget Function(
BuildContext context,
Animation<double> animation,
T item,
);
@slightfoot
slightfoot / bloc_fun.dart
Last active April 16, 2020 18:29
Bloc Fun
import 'dart:async';
import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(ExampleApp());
class ExampleApp extends StatefulWidget {
@override
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() => runApp(TestApp());
class TestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
@slightfoot
slightfoot / target_border.dart
Last active September 19, 2021 05:30
Flutter TargetBorder for BoxDecoration
import 'package:flutter/material.dart';
class TargetBorder extends Border {
const TargetBorder({
BorderSide side = const BorderSide(color: Colors.white, width: 2.0),
this.depth = 25.0,
this.strokeCap = StrokeCap.square,
}) : super(top: side, right: side, bottom: side, left: side);
final double depth;
// 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:
@netsmertia
netsmertia / main.dart
Created May 4, 2018 13:53
flutter image drawing in canvas
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import 'package:flutter/services.dart' show rootBundle;
import 'dart:async';
import 'dart:typed_data';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@yjbanov
yjbanov / .travis.yml
Created May 26, 2017 04:05
Continuously build Flutter APKs and IPAs using Travis build matrix
matrix:
include:
- os: linux
language: android
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
android:
components:
@tatocaster
tatocaster / RealPathUtil.java
Last active April 3, 2024 00:27
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {