Skip to content

Instantly share code, notes, and snippets.

View rutvik110's full-sized avatar
🎵
Humming

Rutvik Tak rutvik110

🎵
Humming
View GitHub Profile
double getScaledSize(int index) {
return getPropertyValue(
index: index,
baseValue: baseItemHeight,
maxValue: 70,
nonHoveredMaxValue: 50,
);
}
double getTranslationY(int index) {
@rutvik110
rutvik110 / image_size_data.dart
Created June 23, 2022 12:58 — forked from dnfield/image_size_data.dart
Image size parsing in Dart
import 'dart:typed_data';
import 'package:meta/meta.dart';
/// Image formats supported by Flutter.
enum ImageFormat {
/// A Portable Network Graphics format image.
png,
/// A JPEG format image.
///
@rutvik110
rutvik110 / main.dart
Created July 15, 2022 08:02
animating hero behind other widgets
import 'package:flutter/material.dart';
// TODO edit your app
void main() {
print('Hello from your Flutter app!');
runApp(MyApp());
}
@rutvik110
rutvik110 / counter_app_build.dart
Created August 7, 2022 09:19
Counter app build method
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
@rutvik110
rutvik110 / counter_app_build.dart
Created August 7, 2022 09:20
Counter app build method
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
@rutvik110
rutvik110 / highcontrast_flutter.dart
Created August 7, 2022 16:43
highcontrast_flutter
Container(
color: MediaQuery.of(context).highContrast ? highContrastBgColor : BgColor,
child: const Text("Hello World!"),
),
class Bar extends BodyComponent with ContactCallbacks, KeyboardHandler {
late BodyDef bodyDef;
late Vector2 barPosition;
@override
Body createBody() {
#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;
//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;
@rutvik110
rutvik110 / de_casteljaus_algorithm.dart
Created December 22, 2022 17:01
Implementation of De Casteljau's algorithm in dart
// 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]);