Skip to content

Instantly share code, notes, and snippets.

import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@callmephil
callmephil / velocity_rendering.dart
Created May 12, 2025 17:49
velocity rendering sliver flutter
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:async';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@callmephil
callmephil / particle_cloud.dart
Created May 10, 2025 03:28
3D Particle Cloud (Gemini)
import 'dart:math';
import 'package:flutter/material.dart';
// Main function to run the Flutter application
void main() {
runApp(const ParticleApp());
}
// Root widget of the application
class ParticleApp extends StatelessWidget {
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
/// Global Chat Overlay Manager
class ChatOverlayService {
static final navigatorKey = GlobalKey<NavigatorState>();
static final _chatKey = GlobalKey<_ChatContainerState>();
@callmephil
callmephil / animated_constraints.dart
Created May 8, 2025 10:41
Animated Constraint (Instead of AnimatedContainer)
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class AnimatedConstraints extends ImplicitlyAnimatedWidget {
const AnimatedConstraints({
super.key,
required this.constraints,
required super.duration,
super.curve,
@callmephil
callmephil / base_firestore_service.dart
Created April 21, 2025 07:05
Base Firestore Service
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/foundation.dart';
/// Base service class for handling CRUD operations with Firestore
abstract class BaseFirestoreService<T> {
/// Constructor
BaseFirestoreService(String collectionPath) {
_collection = _firestore.collection(collectionPath);
}
@callmephil
callmephil / fireworks.dart
Last active April 5, 2025 11:34
flutter fireworks (gemini)
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'dart:math';
import 'dart:async';
import 'dart:ui' as ui;
import 'dart:typed_data';
const bool kDebugMode = false;
const int kLaunchIntervalBaseMs = 400;
@callmephil
callmephil / main.dart
Created March 7, 2025 09:18
Go like error handling in Dart
typedef AsyncErrorRecord = ({Object error, StackTrace? stackTrace});
abstract class Async<T> {
const Async();
static Future<(AsyncErrorRecord? error, T? result)> guard<T>(
Future<T> Function() future,
) async {
try {
final result = await future();
@callmephil
callmephil / gradient_border_progress.dart
Last active February 28, 2025 14:37
bi-directional gradient border progress on hover
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@callmephil
callmephil / animated_shadermask_gradient.dart
Created February 26, 2025 18:13
AnimatedBuilder + ShaderMask and LinearGradient
import 'package:flutter/material.dart';
import 'dart:ui';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});