Skip to content

Instantly share code, notes, and snippets.

View henry2man's full-sized avatar
📱
Fluuuuuteringgg 💙

Enrique Cardona henry2man

📱
Fluuuuuteringgg 💙
View GitHub Profile
@henry2man
henry2man / persistence_controller.dart
Last active August 31, 2021 14:24
Flutter PersistenceController with initialization from Assets Backup and restore capabilities. Uses Floor. This is handmade, I've removed some stuff... in order to use it in your code you'll need to adapt it. My code is able to: Preload the database file with a copy that is stored in app assets. Create a backup in the SD Card Restore the databas…
import 'dart:async';
import 'dart:io';
import 'package:floor/floor.dart';
import 'package:flutter/services.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart' as sqflite;
part 'persistence_controller.g.dart'; // the generated code will be there
@henry2man
henry2man / .github-ISSUE_TEMPLATE-bug_report.md
Last active April 2, 2020 11:18
Plantillas para bugs y Feature Requests en Español

** Describe el error ** Una descripción clara y concisa de lo que es el error.

Cómo reproducir el error Pasos para reproducir el problema:

  1. Vaya a '...'
  2. Haga clic en '....'
  3. Desplácese hacia abajo hasta '...'
  4. Ver error
@henry2man
henry2man / ubuntu-MBP-16.md
Created July 20, 2020 07:23 — forked from gbrow004/ubuntu-MBP-16.md
Ubuntu on Apple Macbook Pro 16-inch (2019)

Acknowledgements

This gist is just a compilation of the hard work that others have put in. I'm not a software developer, so if there are any mistakes or better ways of doing things, I'd appreciate any suggestions. Here's a list of the real heroes who made this possible:

Kernel Patches: aunali (https://github.com/aunali1/)

T2 security chip bypass to allow access to the SSD, keyboard, and trackpad: MCMrARM (https://github.com/MCMrARM)

Audio: kevineinarsson

@henry2man
henry2man / tensorflow-keras-setup-dataset-paths.sh
Created August 10, 2020 07:55
Quick & dirty solution to use an external mounted hard drive under Ubuntu to transparently store both Tensorflow & Keras datasets, in order to preserve fast SSD space.
#!/bin/bash
# Mounted Hard drive path
drive_path = /media/data/dl
# Create main dir
mkdir $drive_path
# Create folders
mkdir $drive_path/keras_datasets
@henry2man
henry2man / GameAudio.dart
Last active January 25, 2021 19:46
A simple Dart class that wraps all audio capabilities (sounds, concurrent fx and background music) for Flutter games.
class GameAudio {
AudioPool _pool;
String path;
bool isFx;
bool concurrent;
GameAudio(
{@required this.path,
this.concurrent: false,
this.isFx: true,
@henry2man
henry2man / animated_splash_screen.dart
Last active September 3, 2021 12:36
Null safety migration, default to 1000 seconds, source code clean-up.
library animated_splash_screen;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
enum _splashType { simpleSplash, backgroundScreenReturn }
enum SplashTransition {
slideTransition,
scaleTransition,
@henry2man
henry2man / columns_rows_spacing.dart
Last active March 31, 2022 11:12
Flutter doesn't provides out-of-the-box spacing attributes for Column and Row widgets (see https://github.com/flutter/flutter/issues/55378). This utility file helps to add horizontal and vertical padding on Columns and Rows
import 'package:flutter/widgets.dart';
List<Widget> addHorizontalSpacing(double spacing, List<Widget> children) {
assert(spacing >= 0.0);
if (children.length <= 1) {
return children;
}
return <Widget>[
@henry2man
henry2man / example_widget.dart
Last active April 26, 2022 07:21
ValueHolder - Dart / Flutter utility class to use with state management packages. It is used to model the loading of information in the background. In the example it is used with BloC, but it can be used with any other state management library.
Widget namesWidget() {
return BlocBuilder<ExampleBloc, ExampleState>(
buildWhen: (previous, current) =>
previous.names != current.names,
builder: (context, state) {
if(state.names.loading) {
return Text("Loading names...");
} else if (state.names.error != null) {
return Text("Error: ${state.names.error}", style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold));
} else {
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const DemoBugCupertinoTabView());
}
class DemoBugCupertinoTabView extends StatelessWidget {
const DemoBugCupertinoTabView({Key? key}) : super(key: key);
@henry2man
henry2man / main_state_preservation_demo.dart
Last active May 9, 2023 10:27
FluentUI - Navigation and state preservation example with Fluent_ui: 4.5.0
import 'package:fluent_ui/fluent_ui.dart';
main() {
runApp(StatePreservation());
}
class StatePreservation extends StatefulWidget {
@override
State<StatePreservation> createState() => _StatePreservationState();
}