Skip to content

Instantly share code, notes, and snippets.

@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});
@callmephil
callmephil / quotation.html
Last active February 26, 2025 14:07
Quotation generator: Generate a quotation and allow you to download it as pdf.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quotation</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
@callmephil
callmephil / linkedin_scrapper.js
Created February 26, 2025 12:40
linkedIn and threads scrapper
(function () {
const Selectors = {
COMMENTER_NAME: ".comments-comment-meta__description-title",
COMMENT_TEXT: ".comments-comment-item__main-content",
LIKES_COUNT: ".comments-comment-social-bar__reactions-count--cr span.v-align-middle",
REPLY_ELEMENTS: ":scope article.comments-comment-entity--reply",
TOP_LEVEL_COMMENTS: "article.comments-comment-entity:not(.comments-comment-entity--reply)",
LOAD_MORE_BUTTON: ".comments-comments-list__load-more-comments-button--cr",
};
@callmephil
callmephil / main.dart
Created February 2, 2025 23:25
widget_rebuild_evaluation
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@callmephil
callmephil / text_reader_prototype.dart
Created January 31, 2025 09:01
Text Reader Prototype
import 'dart:async';
import 'package:collection/collection.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
@callmephil
callmephil / firebase_error_validation.dart
Created January 24, 2025 15:44
firebase error validation example
class FirebaseErrorValidation {
const FirebaseErrorValidation._();
/// default messages for firebase auth exceptions
static const Map<String, String> _kErrorMessages = {
'unknown': 'An unknown exception occurred.',
'invalid-email': 'Email is not valid or badly formatted.',
'user-disabled':
'This user has been disabled. Please contact support for help.',
'email-already-in-use': 'An account already exists for that email.',
@callmephil
callmephil / bi_directional_page_overflow_demo.dart
Created January 22, 2025 21:31
bi-directional-page-overflow
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show RenderAligningShiftedBox;
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@callmephil
callmephil / input_demo.dart
Created January 17, 2025 22:07
dynamic input validation demo.
SizedBox(
height: 200,
child: Form(
key: _formKey,
child: TextFormField(
controller: _ec,
maxLines: null,
expands: false,
onChanged: (value) {
// Trigger immediate validation on text change
@callmephil
callmephil / child_builder_demo.dart
Last active January 22, 2025 19:39
Widget Caching (Pierre Martin)
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class ChildBuilder extends StatelessWidget {
const ChildBuilder({
super.key,
required this.builder,
@callmephil
callmephil / example.dart
Created November 11, 2024 10:37
Modifial List Example
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class Item {
const Item({required this.id, required this.name, required this.likeCount});
final String id;