Skip to content

Instantly share code, notes, and snippets.

View bizz84's full-sized avatar

Andrea Bizzotto bizz84

View GitHub Profile
@bizz84
bizz84 / triple_tap_detector.dart
Last active September 9, 2024 11:14
Custom TripleTapDetector widget using RawGestureDetector
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
class TripleTapDetector extends StatelessWidget {
const TripleTapDetector({
super.key,
required this.child,
required this.onTripleTap,
});
final Widget child;
@bizz84
bizz84 / future_ignore_wtf.dart
Created August 2, 2024 09:06
Example showing that Future.ignore() doesn't work as expected
import 'dart:async';
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
FlutterError.onError = (details) {
log('FlutterError error: ${details.exception}');
FlutterError.presentError(details);
@bizz84
bizz84 / go_router_basic.dart
Created June 23, 2024 20:07
Simple GoRouter navigation to a details page
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
final _router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const HomeScreen(),
routes: [
GoRoute(
@bizz84
bizz84 / flutter_bootstrap.js
Created May 21, 2024 08:40
Custom Flutter Web App Initialization Logic with CSS Loader
{{flutter_js}}
{{flutter_build_config}}
// Manipulate the DOM to add a loading spinner will be rendered with this HTML:
// <div class="loading">
// <div class="loader" />
// </div>
const loadingDiv = document.createElement('div');
loadingDiv.className = "loading";
document.body.appendChild(loadingDiv);
@bizz84
bizz84 / logger_interceptor.dart
Created May 13, 2024 07:38
Simple logger interceptor for Dio without extra dependencies
import 'dart:developer';
import 'package:dio/dio.dart';
/// A simple interceptor used to log all network requests
/// For more details, see: https://github.com/bizz84/flutter-tips-and-tricks/blob/main/tips/0152-log-status-code-emoji/index.md
class LoggerInterceptor implements Interceptor {
final stopwatches = <String, Stopwatch>{};
@override
@bizz84
bizz84 / app_release_template.json
Last active September 9, 2024 09:00
An app release checklist template for Flutter app development
{
"template": "App Release",
"version": 4,
"epics": [
{
"id": "ai",
"epic": "App Icons",
"tasks": [
{ "id": "7DA5766A", "name": "Design your app icon (IconKitchen, Figma)" },
{ "id": "029C2183", "name": "Different icons for each flavor" },
@bizz84
bizz84 / responsive_center_scrollable.dart
Last active April 30, 2024 08:05
A responsive centered scrollable layout that enables mouse scrolling outside the centered scrollable area
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@bizz84
bizz84 / privacy-manifest-list.txt
Created March 27, 2024 12:18
Bash script to check if the Podfile.lock contains any SDKs that should be declared in the privacy manifest file
Abseil
AFNetworking
Alamofire
AppAuth
BoringSSL / openssl_grpc
Capacitor
Charts
connectivity_plus
Cordova
device_info_plus
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@bizz84
bizz84 / scroll_to_index_dynamic_height.dart
Created January 14, 2024 10:22
Example showing how to scroll to a list item by index when all items can have different heights
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:scroll_to_index/scroll_to_index.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {