Skip to content

Instantly share code, notes, and snippets.

View stevenosse's full-sized avatar
😁
I turn coffee into mobile apps

Steve stevenosse

😁
I turn coffee into mobile apps
View GitHub Profile
class InAppPurchaseService {
static const premiumPermissionId = 'premium';
static const androidLifetimeProductId = 'lifetime_access';
static const androidMonthlyProductId = 'android_premium_monthly_3.99_30days_0:0';
static const androidYearlyProductId = 'android_paper_premium_yearly_45_30days_0:0';
static const iosLifetimeProductId = 'lifetime_access';
static const iosMonthlyProductId = 'ios_premium_monthly_3.99_30days_0';
static const iosYearlyProductId = 'ios_paper_premium_yearly_45_30days_0';
@stevenosse
stevenosse / adaptative_menu.button.dart
Last active August 9, 2024 07:57
AdaptativeMenuButton (Uses Popup menu button on Android & CupertinoActionSheet on iOS)
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AdaptivePopupMenu extends StatelessWidget {
final List<AdaptiveMenuItem> menuItems;
final Widget child;
final String? iosCancelButtonLabel;
final BorderRadius? androidButtonRadius;
final double spacing;
/// packages:
/// google_sign_in: ^6.2.1
/// sign_in_with_apple: ^6.1.1
/// crypto: ^3.0.3
const appleAuthProviderID = 'apple.com';
const googleAuthProviderID = 'google.com';
class AuthService {
final GoogleSignIn _googleSignIn;
@stevenosse
stevenosse / gist:e90be81be10569292f9233f61a1a7337
Created July 19, 2024 12:26
in app purchase service (Glassfy)
class InAppPurchaseService {
Future<void> init() async {
try {
await Glassfy.initialize(
Environment.glassfyApiKey,
watcherMode: kDebugMode,
);
} catch (e, trace) {
log('Glassfy init failed', error: e);
Sentry.captureException(e, stackTrace: trace);
@stevenosse
stevenosse / main.dart
Last active July 8, 2024 15:06
Draw a progress bar around a widget. This implementation extends ShapeBorder so it's usable around a Card (or any other widget expecting a ShapeBorder)
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final double _progress = .5;
@override
Widget build(BuildContext context) {
@stevenosse
stevenosse / main.dart
Created June 20, 2024 21:54
Confetti V2
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@stevenosse
stevenosse / main.dart
Created June 20, 2024 13:32
Confetti experiment
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@stevenosse
stevenosse / main.dart
Last active June 1, 2024 16:53
POC: Zoomable GridView widget
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@stevenosse
stevenosse / pop_confirm.dart
Last active May 28, 2024 11:16
PopConfirm
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter widget to execute asynchronous operations before a page is popped
/// Uses Flutter 3.16.x's PopScope attribute
class PopConfirm extends StatefulWidget {
const PopConfirm({
super.key,
@stevenosse
stevenosse / lifecycle_watcher.dart
Created November 20, 2023 15:16
LifecycleWatcher
import 'package:flutter/material.dart';
class LifecycleWatcher extends StatefulWidget {
const LifecycleWatcher({
super.key,
required this.child,
this.onResume,
this.onPause,
this.onInactive,
this.onHide,