Skip to content

Instantly share code, notes, and snippets.

View kmartins's full-sized avatar
:shipit:

Kauê Martins kmartins

:shipit:
View GitHub Profile
import 'package:flutter/material.dart';
import '../extensions/extensions.dart';
typedef AnimatedGridBuilder<T> = Widget Function(
BuildContext, T item, AnimatedGridDetails details);
class AnimatedGrid<T> extends StatelessWidget {
/// An animated grid the animates when the items change sort.
const AnimatedGrid({
@slightfoot
slightfoot / anchor_scroll.dart
Last active January 27, 2021 00:28
Ever wanted to scroll down to a widget in a scroll view? Now you can, Anchor Scroll to the rescue! - by Simon Lightfoot - 15/11/2019
// 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:
import 'package:cloud_firestore/cloud_firestore.dart';
class MockFirestore extends Mock implements FirebaseFirestore {}
class MockCollectionReference extends Mock implements CollectionReference {}
class MockDocumentReference extends Mock implements DocumentReference {}
class MockDocumentSnapshot extends Mock implements DocumentSnapshot {}
@VB10
VB10 / regex_constats.dart
Last active March 3, 2021 07:41
String Regex
class RegexConstants {
static RegexConstants _instance;
static RegexConstants get instance {
if (_instance == null) {
_instance = RegexConstants._init();
}
return _instance;
}
RegexConstants._init();
@lukepighetti
lukepighetti / text_editing_controller_builder.dart
Last active September 27, 2021 20:32
Wrap any TextField with TextEditingControllerBuilder to make it declarative
import 'package:flutter/widgets.dart';
class TextEditingControllerBuilder extends StatefulWidget {
/// Exposes a [TextEditingController] to the child, which allows
/// us to convert any [TextField] into a declarative version.
///
/// Typically used for wiring up many state fields to form inputs
/// and making sure everything stays in sync.
///
/// If [text] is updated, the consuming [TextField] will also be updated.
@chimon2000
chimon2000 / use_state_notifier.dart
Created May 5, 2020 02:59
Flutter Hook for StateNotifier
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:state_notifier/state_notifier.dart';
T useStateNotifier<T>(StateNotifier<T> notifier) {
final state = useState<T>(null);
useEffect(() {
return notifier.addListener((s) => state.value = s);
}, [notifier]);
@slightfoot
slightfoot / timestamp_converter.dart
Created April 22, 2020 16:28
Timestamp/DateTime Converter for Cloud Firestore and Dart/Flutter.
// MIT License
//
// Copyright (c) 2020 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:
@reginadiana
reginadiana / README-TEMPLATE.md
Last active October 24, 2025 15:17
Template sugestivo para documentação de projetos

Titulo ou Arte do Projeto

@mjohnsullivan
mjohnsullivan / icon_gradient.dart
Created November 25, 2019 22:09
Apply a color gradient to an icon in Flutter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
@rodydavis
rodydavis / flutter_github_ci.yml
Last active August 13, 2025 17:02
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web: