Skip to content

Instantly share code, notes, and snippets.

View awaik's full-sized avatar

Alex Awaik awaik

  • Berlin, Germany
View GitHub Profile
@awaik
awaik / fastlane-ios-language-codes
Created January 4, 2023 13:20
Fastlane iOS available language codes
ar-SA, ca, cs, da, de-DE, el, en-AU, en-CA, en-GB, en-US, es-ES, es-MX, fi, fr-CA, fr-FR, he, hi, hr, hu, id, it, ja, ko, ms, nl-NL, no, pl, pt-BR, pt-PT, ro, ru, sk, sv, th, tr, uk, vi, zh-Hans, zh-Hant
@awaik
awaik / gist:7d5b6d6ec644ae844a3740dddc990ed4
Created August 17, 2022 11:39
Flutter 3.0.5 - Sample code to detect 2 finger swipe vertically using `RawGestureDetector` and `MultiDragGestureRecognizer`.Sample code to detect 2 finger swipe vertically using `RawGestureDetector` and `MultiDragGestureRecognizer`.
// original code is here, this is upadated version for the new Flutter
// https://gist.github.com/guptahitesh121/ca7fa34d73b8b024823c85dd0c7f687d
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
import 'dart:async';
import 'package:rxdart/rxdart.dart';
class CounterBloc {
int _counter;
CounterBloc() {
_counter = 1;
_actionController.stream.listen(_increaseStream);
}
class MyHomePage extends StatelessWidget {
CounterBloc counterBloc = CounterBloc();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: StreamBuilder<int>(
stream: counterBloc.pressedCount,
builder: (context, snapshot) {
//Example 3 for article getters&setters
class Person {
String name;
int birthYear;
bool get isAdult => (DateTime.now().year - birthYear) > 18;
int get age => (DateTime.now().year - birthYear);
set age(int val) => birthYear = (DateTime.now().year - val);
//Example 1 for article getters&setters
class Person {
String name;
int birthYear;
Person(this.name, this.birthYear);
}
void main() {
@awaik
awaik / check_ios_subscribtion_fluter.dart
Created July 20, 2019 07:59
check ios subscribtion fluter
if (Platform.isIOS) {
var history = await FlutterInappPurchase.getPurchaseHistory();
for (var purchase in history) {
Duration difference =
DateTime.now().difference(purchase.transactionDate);
if (difference.inMinutes <= (duration + grace).inMinutes &&
purchase.productId == 'SKU_OF_SUBSCRIPTION') return 'PAID_STATE_FOR_YOUR_CHOICE';
}
return 'NOT_PAID_STATE_FOR_YOUR_CHOICE';
}