Skip to content

Instantly share code, notes, and snippets.

@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;
@callmephil
callmephil / alert_model.dart
Created October 15, 2024 13:58
(Flutter) Firestore stream example
class AlertModel {
final String id;
final String title;
final String message;
final DateTime createdAt;
const AlertModel({
required this.id,
required this.title,
required this.message,
@callmephil
callmephil / smooth_page_view.dart
Created July 15, 2024 22:04
smooth page view
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class SmoothPageView extends StatefulWidget {
const SmoothPageView({
super.key,
required this.onPageChanged,
required this.pages,
required this.pageIndex,
@callmephil
callmephil / main.dart
Created May 8, 2024 22:56
ai assistant
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
void main() {
runApp(const MyApp());
}
@callmephil
callmephil / tailwind_cheat_sheep.md
Created April 23, 2024 09:33
Tailwind cheatsheet

Layout

Container: container
Box Sizing: box-border | box-content
Display: block | inline-block | inline | flex | grid
Flexbox:
    Flex Direction: flex-row | flex-row-reverse | flex-col | flex-col-reverse
    Justify Content: justify-start | justify-end | justify-center | justify-between | justify-around
    Align Items: items-start | items-end | items-center | items-baseline | items-stretch

Flex Wrap: flex-wrap | flex-wrap-reverse | flex-nowrap

@callmephil
callmephil / gist:911606cfa175dd6f2d0093d981b701dd
Created April 10, 2024 19:04 — forked from long1eu/gist:e59e3674871d3d63c9fe7b177fe43ca8
InteractiveViewer with CustomMultiChildLayout
import 'dart:convert';
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:image_size_getter/file_input.dart' as image_size;
import 'package:image_size_getter/image_size_getter.dart' as image_size;
void main() {
runApp(const MyApp());
@callmephil
callmephil / main.dart
Created April 10, 2024 17:56
Reorderable List Column Example
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(