Skip to content

Instantly share code, notes, and snippets.

View kmartins's full-sized avatar
:shipit:

Kauê Martins kmartins

:shipit:
View GitHub Profile
@kmartins
kmartins / update-android-project.sh
Created December 14, 2024 10:53 — forked from bizz84/update-android-project.sh
Script to update Gradle, Java and other Android project settings in a Flutter project
#!/bin/bash
# Update Gradle, Java and other Android project settings in a Flutter project
# See: https://gradle.org/releases/
DESIRED_GRADLE_VERSION="8.9"
# Build errors often show the required Java version
DESIRED_JAVA_VERSION="17"
# See: https://developer.android.com/ndk/downloads
DESIRED_NDK_VERSION="27.0.12077973"
# The minimum Android SDK version
Como ir de $0 a $10k/mês (por Josh Rush https://x.com/johnrushx/status/1838342060857770336)
1. Ideia.
○ fácil de construir (idealmente sem código (nocode))
○ pode ser explicada em uma frase
○ direcionada a um pequeno nicho B2B (business to business)
○ tem potencial de crescimento orgânico
Nunca pense: "Vou comprar anúncios para promovê-la". Isso literalmente nunca funciona.
@kmartins
kmartins / flutter-android-cd.yml
Created October 15, 2021 01:29 — forked from vinicioslc/flutter-android-cd.yml
Build flutter releases in github actions for production only android for while.
# This is a basic workflow to help you get started with Actions
name: CD
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
tags:
- "v*.*.*" # on every version tag will build a new android artifact.
jobs:
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:math' as math;
class SliverGridPage extends StatefulWidget {
@override
_SliverGridPageState createState() => _SliverGridPageState();
}
class _SliverGridPageState extends State<SliverGridPage> {
abstract class EventSyncHelper {
void startSession();
Future<void> sendEvent(Event event);
Future<VoidResult> syncRemainingEvents();
void endSession();
}
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({
import 'dart:async';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
@kmartins
kmartins / generate_pushid.dart
Created February 19, 2021 14:48 — forked from amirh/generate_pushid.dart
Dart port of Firebase push ID generator (origin: https://gist.github.com/mikelehen/3596a30bd69384624c11)
import 'dart:math' as math;
const String _kPushChars = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
typedef String StringCallback();
StringCallback generatePushId = () {
int lastPushTime = 0;
final List<int> randomSuffix = new List<int>(12);
final math.Random random = new math.Random.secure();
@kmartins
kmartins / use_state_notifier.dart
Created February 16, 2021 18:26 — forked from chimon2000/use_state_notifier.dart
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]);
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 {}