Skip to content

Instantly share code, notes, and snippets.

@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
@callmephil
callmephil / main.dart
Created January 10, 2024 16:15
go router deeplink bug
import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:go_router/go_router.dart';
final _navKey = GlobalKey<NavigatorState>();
void main() {
usePathUrlStrategy();
runApp(const MyApp());
@callmephil
callmephil / tempate.store.dart
Created September 12, 2023 08:27
Template riverpod store
@riverpod
BookService bookService(BookServiceRef _) {
return const BookService();
}
// fetch single book
@riverpod
Future<Book?> book(BookServiceRef ref, String id) {
return ref.read(bookServiceProvider).getBook(id);
@callmephil
callmephil / main.dart
Last active September 8, 2023 08:02
stream memory caching example for flutter/dart
import 'dart:async';
import 'dart:math';
/// {@template cache_client}
/// An in-memory cache client.
/// {@endtemplate}
class CacheClient {
/// {@macro cache_client}
CacheClient() : _cache = <String, Object>{};