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
@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,
@stevenosse
stevenosse / test_screenshot_util.dart
Last active April 28, 2024 03:10
testWidgets screenshot
/// Originally published on: https://gist.github.com/stevsct/fc84fee8bcc3271e2295d99d7c7ae49d
///
/// Inspired by https://pub.dev/packages/spot
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
@stevenosse
stevenosse / i18n_checker.dart
Last active June 20, 2023 07:25
I18n Checker
import 'dart:io';
void main(List<String> arguments) {
if (arguments.length < 2) {
// ignore: avoid_print
print('Usage: dart i18n_checker.dart <arb_folder> <reference_file>');
return;
}
final arbFolder = arguments[0];
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override