Skip to content

Instantly share code, notes, and snippets.

@klaszlo8207
klaszlo8207 / scaling_gesture_detector.dart
Last active August 16, 2022 00:44
Flutter ScalingGestureDetector for a 3D view (you can pan and zoom in/out)
import 'package:advert_app/utils/logging.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/gestures.dart';
class ScalingGestureDetector extends StatefulWidget {
final Widget child;
final void Function(Offset initialPoint) onPanStart;
final void Function(Offset initialPoint, Offset delta) onPanUpdate;
final void Function() onPanEnd;
@comm1x
comm1x / PanAndScalingGestureRecognizer.dart
Created December 10, 2019 00:23
Pan and scaling gesture recognizer for flutter
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
class PanAndScalingGestureRecognizer extends StatefulWidget {
final Widget child;
final void Function(Offset initialPoint) onPanStart;
final void Function(Offset initialPoint, Offset delta) onPanUpdate;
final void Function() onPanEnd;
final void Function(Offset initialFocusPoint) onScalingStart;
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@cnnrhill
cnnrhill / ListViewScrollTracker.java
Created September 24, 2013 04:24
Helper class for calculating relative scroll offsets in a ListView or GridView by tracking the position of child views.
import android.util.SparseArray;
import android.widget.AbsListView;
/**
* Helper class for calculating relative scroll offsets in a ListView or GridView by tracking the
* position of child views.
*/
public class ListViewScrollTracker {
private AbsListView mListView;
private SparseArray<Integer> mPositions;
@daichan4649
daichan4649 / ProgressDialogFragment.java
Last active August 1, 2018 20:29
AsyncTask + ProgressDialogFragment (Android)
public class ProgressDialogFragment extends DialogFragment {
public final static String TITLE = "title";
public final static String MESSAGE = "message";
public final static String MAX = "max";
public final static String CANCELABLE = "cancelable";
public static ProgressDialogFragment newInstance() {
return new ProgressDialogFragment();
}