Skip to content

Instantly share code, notes, and snippets.

View bizz84's full-sized avatar

Andrea Bizzotto bizz84

View GitHub Profile
@bizz84
bizz84 / show_alert_dialog.dart
Last active May 2, 2025 19:18
Helper function for showing an adaptive alert dialog (Material, Cupertino)
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Helper function for showing an adaptive alert dialog
/// Returns:
/// - true if the default action was selected
/// - false if the cancel action was selected
/// - null if the dialog was dismissed
Future<bool?> showAlertDialog({
required BuildContext context,
@bizz84
bizz84 / firebase_remote_config_provider.dart
Created April 29, 2025 13:19
Flutter Remote Config boilerplate code (using Riverpod)
import 'dart:async';
import 'dart:developer';
import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'firebase_remote_config_provider.g.dart';
@bizz84
bizz84 / url_text_widget.dart
Last active April 11, 2025 13:40
Helper widget to show native-looking URLs on Flutter web
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
/// Helper widget to show native-looking URLs on Flutter web
class URLTextWidget extends StatelessWidget {
const URLTextWidget({
super.key,
required this.uri,
this.overflow = TextOverflow.ellipsis,
@bizz84
bizz84 / build-upload-ios.sh
Created November 26, 2024 11:35
Simple script to build and upload the IPA file to App Store Connect
#!/bin/bash
# Script to build and upload the ipa file to App Store Connect
# Exit immediately if any command fails
set -e
# Validate that the API Key ID and Issuer ID are set
if [[ -z ${APP_STORE_CONNECT_KEY_ID} ]]; then
echo "Please set APP_STORE_CONNECT_KEY_ID as an environment variable."
exit 1
@bizz84
bizz84 / update-android-project.sh
Last active May 2, 2025 12:57
Script to update Gradle, Java and other Android project settings in a Flutter project
#!/bin/bash
# Update Gradle, Java and other Android project settings in a Flutter project
# Works with both .gradle and .gradle.kts build files
# See: https://gradle.org/releases/
# See: https://developer.android.com/build/releases/gradle-plugin#compatibility
DESIRED_GRADLE_VERSION="8.11.1"
# Build errors often show the required Java version
DESIRED_JAVA_VERSION="17"
# See: https://developer.android.com/ndk/downloads
@bizz84
bizz84 / app_name_remote_config.json
Created October 7, 2024 13:38
Remote config template JSON for a Flutter app
{
"config" : {
"required_version": "2.0.0"
}
}
@bizz84
bizz84 / flutter_ship_remote_config.json
Last active October 7, 2024 11:40
Remote config for the Flutter Ship app (prod flavor)
{
"config" : {
"required_version": "0.3.0"
}
}
@bizz84
bizz84 / flutter_ship_remote_config.json
Last active October 7, 2024 11:40
Remote config for the Flutter Ship app (stg flavor)
{
"config" : {
"required_version": "0.3.0"
}
}
@bizz84
bizz84 / flutter_ship_remote_config.json
Last active October 7, 2024 11:44
Remote config for the Flutter Ship app (dev flavor)
{
"config" : {
"required_version": "0.4.0"
}
}
@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;