Skip to content

Instantly share code, notes, and snippets.

@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(
@callmephil
callmephil / connectivity_widget.dart
Last active April 9, 2024 11:23
borken connectivity widget flutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart';
import 'package:xverse_flutter/utils/environment.dart';
class ConnectivityWidget extends StatefulWidget {
const ConnectivityWidget({
super.key,
required this.builder,
void main() {
const isDoorVisible = false;
const isClassVisible = false;
const isHazineVisible = false;
const isFaragiranVisible = false;
const isErsalPayamVisible = false;
List<bool> visibleWidgets = [
isDoorVisible,
isClassVisible,
@callmephil
callmephil / main.dart
Last active January 15, 2024 08:24
In Memory Store (Article Example)
import 'dart:async';
void main() {
final authRepo = AuthenticationRepository();
// listen to cache updates
authRepo.user.listen((event) => print(event));
const user = User(firstName: 'John', lastName: 'Doe', age: 29);
// Create user