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 / pop_confirm.dart
Created January 22, 2024 10:29
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 20, 2024 10:14
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];
@stevenosse
stevenosse / main.dart
Created March 17, 2021 10:03
SO: listview.builder not showing
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
// 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
@stevenosse
stevenosse / Autoloader.php
Last active November 2, 2018 10:37
Autoloader class that automatically loads all the classes of your project.
<?php
/*
* Author : Steve Nosse
* Licence : Freeware
* How to use ?
* Simply do require_once "autoloader.php"; and then Autoloader::init();
*/
class Autoloader {
/**