Skip to content

Instantly share code, notes, and snippets.

@DZESU
DZESU / reactive_refresh_indicator.dart
Created February 17, 2021 02:21 — forked from kentcb/reactive_refresh_indicator.dart
A better RefreshIndicator for flutter
// Copyright 2014 The Chromium Authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:quiver/cache.dart';
import 'package:quiver/collection.dart';
/*
class LazyList extends StatefulWidget {
import 'package:flutter/widgets.dart';
class PreloadingImageBuilder extends StatefulWidget {
final ImageProvider imageProvider;
final AsyncWidgetBuilder<dynamic> builder;
PreloadingImageBuilder({this.imageProvider, this.builder});
@override
_PreloadingImageBuilderState createState() => _PreloadingImageBuilderState();
@DZESU
DZESU / icon_gradient.dart
Created February 17, 2021 02:13 — forked from mjohnsullivan/icon_gradient.dart
Apply a color gradient to an icon in Flutter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
@DZESU
DZESU / flutter_github_ci.yml
Created February 17, 2021 02:09 — forked from rodydavis/flutter_github_ci.yml
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
# Need to draw only good matches, so create a mask
matches_mask = [[0, 0] for i in range(len(flann_matches))]
# ratio test as per Lowe's paper
good = []
for index in range(len(flann_matches)):
if len(flann_matches[index]) == 2:
m, n = flann_matches[index]
if m.distance < 0.8 * n.distance: # 0.8 is threshold of ratio testing
matches_mask[index] = [1, 0]
# FLANN parameters
flann_index_lsh = 6
index_params = dict(algorithm=flann_index_lsh,
table_number=12,
key_size=20,
multi_probe_level=2)
search_params = dict(checks=100) # or pass empty dictionary
# create FLANN
flann = cv2.FlannBasedMatcher(index_params, search_params)
# draw key point on image
result_image_train = cv2.drawKeypoints(image_train, kp_logo, None, flags=0)
result_image_query = cv2.drawKeypoints(image_query, kp_img, None, flags=0)
cv2.imshow("train image",result_image_train)
cv2.imshow("query image",result_image_query)
cv2.waitKey(0)
# create ORB dectector
orb = cv2.ORB_create(nfeatures=2000) # default features is 500
# loop into all train images.
for image_train in train_image_list:
# find key point and descriptor
kp_logo, des_logo = orb.detectAndCompute(image_train, None)
kp_img, des_img = orb.detectAndCompute(image_query, None)
def load_all_image_from_path(path):
image_list = []
for filename in glob.glob(path):
# load image in gray scale
im = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
image_list.append(im)
return image_list