Skip to content

Instantly share code, notes, and snippets.

@guitoof
guitoof / main.dart
Created February 17, 2023 22:32
crimson-tulip-4412
enum EpisodeReadingStatus {
notStarted,
inProgress,
completed;
factory EpisodeReadingStatus.fromProgress(double progress) {
if (progress == 0) return EpisodeReadingStatus.notStarted;
else if (progress < 1) return EpisodeReadingStatus.inProgress;
else return EpisodeReadingStatus.completed;
}
@guitoof
guitoof / global_gestures_listener.dart
Created January 7, 2022 16:05
Allow Multiple Gestures without modifying child widgets
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
// Custom Gesture Recognizer.
// rejectGesture() is overridden. When a gesture is rejected, this is the function that is called. By default, it disposes of the
// Recognizer and runs clean up. However we modified it so that instead the Recognizer is disposed of, it is actually manually added.
// The result is instead you have one Recognizer winning the Arena, you have two. It is a win-win.
class AllowMultipleTapGesturesRecognizer extends TapGestureRecognizer {
@override
void rejectGesture(int pointer) {
import { shallowWithStore } from 'enzyme-redux';
import React, { PureComponent, ReactNode } from 'react';
import { MockedProvider } from 'react-apollo/test-utils';
import { View } from 'react-native';
import renderer from 'react-test-renderer';
import { createMockStore } from 'redux-test-utils';
import wait from 'waait';
import getPaymentStatus from '../../../queries/getPaymentStatus.gql';