This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Couldn't find the original developer and the gist of this code. | |
// Full credit goes to the original developer for the implementation of [HeroDialogRoute]. | |
import 'package:flutter/material.dart'; | |
class HeroDialogRoute<T> extends PageRoute<T> { | |
HeroDialogRoute({required this.builder}) : super(); | |
final WidgetBuilder builder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example of simulating a simple rope. For, the construction of rope, catenary algorithm(https://en.wikipedia.org/wiki/Catenary) is used. | |
// The catenary is a curve that describes the shape of a hanging chain or cable, or the curve described by a freely hanging chain or cable. | |
// The implementation of catenary algorithm is based on the following js implementation : https://github.com/dulnan/catenary-curve/blob/9cb7e53e2db4bd5c499f5051abde8bfd853d946a/src/main.ts#L254 | |
// In action : https://github.com/rutvik110/Flutter-Animations/tree/master/lib/flutter_design_challenges/ropes | |
import 'dart:developer' as dev; | |
import 'dart:math' as math; | |
import 'package:dart_numerics/dart_numerics.dart' as numerics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:developer' as dev; | |
import 'dart:io'; | |
import 'package:ffmpeg_kit_flutter/ffmpeg_kit.dart'; | |
import 'package:path_provider/path_provider.dart'; | |
import 'package:share_plus/share_plus.dart'; | |
class FFMPEGKITHelper { | |
// image files should be stored in numbered format like 1.png, 2.png, 3.png etc to work with ffmpeg | |
static Future<String> imagesToMp4(List<File> images) async { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementation of De Casteljau's algorithm in dart | |
// ref - https://pomax.github.io/bezierinfo/#splitting, https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm, | |
List<List<math.Point<num>>> drawCurvePoint(List<math.Point> points, double t) { | |
final List<math.Point<num>> left = <math.Point>[]; | |
final List<math.Point<num>> right = <math.Point>[]; | |
if (points.length == 1) { | |
left.add(points[0]); | |
right.add(points[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get the position of the latest coordinate on the curve at any point in animation based on animation position(t) | |
class BezierTween extends Tween<Offset> { | |
BezierTween({required this.begin, required this.end, required this.control}) | |
: super(begin: begin, end: end); | |
@override | |
final Offset begin; | |
@override | |
final Offset end; | |
final Offset control; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma glslify: range = require('glsl-range'); | |
void main () { | |
// Your incoming value | |
float x = 25.0; | |
// Map value to 0..1 domain | |
// (no need if x is already in 0..1 range) | |
float min = 10.0; | |
float max = 100.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bar extends BodyComponent with ContactCallbacks, KeyboardHandler { | |
late BodyDef bodyDef; | |
late Vector2 barPosition; | |
@override | |
Body createBody() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Container( | |
color: MediaQuery.of(context).highContrast ? highContrastBgColor : BgColor, | |
child: const Text("Hello World!"), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), |
NewerOlder