Skip to content

Instantly share code, notes, and snippets.

View tieorange's full-sized avatar
👨‍💻
Developing mobile apps

Andrii Kovalchuk tieorange

👨‍💻
Developing mobile apps
View GitHub Profile
@Demwunz
Demwunz / install.md
Created January 28, 2020 21:45
How to install Flutter on macOS using homebrew and asdf

How to install Flutter on macOS using homebrew and asdf

The official way to install the flutter and its dependencies is a mishmash of brew install, binary downloads alongside relying on system installed versions of ruby.

I became particularly frustrated when trying to setup flutter on macOS Mojave and macOS Catalina. I came across too many issues, and it took a lot of stackoverflow and google searches to overcome.

By using a package manager to install dependencies and runtimes, we can share the exact same setup in different environments and automate the install and escape the above issues.

This is particularly valuable if you use different machines, or have team members in different locations. Moreover, we know where everything belongs and how to upgrade or uninstall if necessary.

@jbxbergdev
jbxbergdev / marker_icon_generator.dart
Last active December 7, 2023 11:09
Creates a BitmapDescriptor from an IconData object to be used for google_maps_flutter map markers. Read the Medium article here: https://medium.com/@JBXBergDev/how-to-use-googlemap-markers-with-flutter-material-icons-38c4c975e928
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class MarkerGenerator {
final _markerSize;
double _circleStrokeWidth;
double _circleOffset;
@av
av / main.dart
Created January 13, 2020 18:44
Flutter: neu
import 'package:flutter/material.dart';
void main() => runApp(NeumorphicApp());
class NeumorphicApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Neumorphic App',
theme: ThemeData(
@humblerookie
humblerookie / json_decoder.dart
Last active February 13, 2022 02:15
Dio Built Value Json Decoder/Transformer for Dart/Flutter
import 'dart:convert';
import 'package:my_app/data_model/serializers.dart';
import 'package:flutter/foundation.dart';
Future<T> decodeJson<T>(String res) async {
var list = List();
list.add(res);
list.add(T);
//Replace compute with spawning any other isolate, compute is simpler abstraction of isolate api.
@tieorange
tieorange / ThrottledOnClickListener.kt
Last active September 18, 2023 07:03
A debounced onClickListener for Android
package com.westwingnow.android.utils
import android.os.SystemClock
import android.view.View
import java.util.*
/**
* A Throttled OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will throttle each one separately.
@tieorange
tieorange / Teleprinter.kt
Created February 18, 2019 20:03
Hide and show the keyboard util
package com.dobabci.android.util
import android.app.Activity
import android.content.Context
import android.graphics.Rect
import android.view.View
import android.view.ViewTreeObserver
import android.view.Window
import android.view.inputmethod.InputMethodManager
@bharatdodeja
bharatdodeja / Robot Pattern.md
Last active December 17, 2023 12:21
Android UI testing using Espresso and Robot pattern

Android UI Testing using Espresso, Rotton Pattern and Kotlin DSL

Espresso allow UI tests to have stable interactions with your app, but without discipline these tests can become hard to manage and require frequent updating. Robot pattern allows you to create stable, readable, and maintainable tests with the aid of Kotlin’s language features.

Test Excecution

Let's say there is a login screen and user needs to login access dashboard by entering email and password and clicking on the login button. This is what we want the test to validate. But there’s also the how. Really, what we are looking for is the what.

Traditional Testing (Problem)

A way that you might write the test is something like this:

@jmfayard
jmfayard / Config.kt
Last active September 22, 2020 13:15
Gists Gradle-Kotlin-DSL
// buildSrc/src/main/kotlin/Config.kt
object Config {
const val ACTIVITY = "com.mautinoa.cardapp.MainActivity"
const val PACKAGE = "com.mautinoa.cardapp"
const val kotlinVersion = "1.2.71"
object SdkVersions {
val versionCode = 1
val compile = 28
val target = 26
@lopspower
lopspower / RecyclerViewAdapter.kt
Last active September 30, 2023 10:50
RecyclerView Adapter Kotlin Android Studio Template
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import java.util.*
class ${NAME} : RecyclerView.Adapter<${Model}Adapter.ViewHolder>() {
@MaksimDmitriev
MaksimDmitriev / FileUtils.java
Created January 26, 2018 09:26
PowerMock with System.currentTimeMillis
package sample.com.sample_app;
import android.support.annotation.NonNull;
public class FileUtils {
@NonNull
public static String generateName() {
return Long.toString(System.currentTimeMillis());
}