Skip to content

Instantly share code, notes, and snippets.

@kherel
kherel / main.dart
Last active July 5, 2022 08:23
Juan
void main() async {
var plan = myPlanFunction();
print(plan['title']);
}
dynamic myPlanFunction() {
dynamic plan;
if (currentSubscription['productId'] == null) {
@kherel
kherel / tileHelper.dart
Last active December 23, 2021 13:04
Find all tiles inside bounding box
import 'package:app/config/map_config.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
class TilesHelper {
final TileLayerOptions options;
final double minZoom;
final double maxZoom;
@kherel
kherel / distortion.dart
Created June 2, 2021 06:28 — forked from wilsonowilson/distortion.dart
Widget warping and distortion in Flutter
import 'dart:typed_data';
import 'dart:ui' hide Image;
import 'package:image/image.dart' as img_lib;
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
enum ImageFetchState { initial, fetching, fetched }
class ImagePlayground extends StatefulWidget {
@kherel
kherel / bubble_effect.dart
Created June 2, 2021 06:27 — forked from slightfoot/bubble_effect.dart
3D Style Bubble Magnifying Effect - by Simon Lightfoot and Wilson Wilson @wilsonowilson - 18/03/2021
// MIT License
//
// Copyright (c) 2021 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@kherel
kherel / main.dart
Last active September 5, 2020 09:07
for Mahdi
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@kherel
kherel / tables.dart
Last active August 28, 2020 06:55
TableColumnWidth example
/// example for https://stackoverflow.com/questions/63627339/flutter-table-layout-is-not-responding-according-to-expected
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kherel
kherel / main.dart
Created August 9, 2020 12:14
Scrollable + ViewPort + SliverList
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
let hasBlobConstructor =
typeof Blob !== 'undefined' &&
(function () {
try {
return Boolean(new Blob())
} catch (e) {
return false
}
})()
@kherel
kherel / sample.dart
Last active April 22, 2020 06:21
how to short the text by cutting in the middle of the string
void main() {
var testString = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit,';
var resLengh = 17;
print(middleCut(testString, resLengh));
}
String middleCut(String text, int length){
const numberOfDots = 3;
final dotsString = List<String>.filled(numberOfDots, '.').join();