Skip to content

Instantly share code, notes, and snippets.

View Mastersam07's full-sized avatar
🚀
building amazing things

Samuel Abada Mastersam07

🚀
building amazing things
View GitHub Profile
@Mastersam07
Mastersam07 / widgetbook.dart
Last active September 17, 2024 13:23
Conference App Widgetbook
import 'package:cave/cave.dart';
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
import 'main.directories.g.dart';
void main() {
runApp(const WidgetbookApp());
}
@Mastersam07
Mastersam07 / state_restoration.dart
Last active September 12, 2024 18:00
RestorableTabController
/// A [RestorableProperty] that knows how to store and restore a
/// [TabController].
///
/// The [TabController] is accessible via the [value] getter. During
/// state restoration, the property will restore [TabController.index]
/// to the value it had when the restoration data it is getting restored from
/// was collected.
class RestorableTabController extends RestorableChangeNotifier<TabController> {
/// Creates a [RestorableTabController] to control the tab index of
/// [TabBar].
@Mastersam07
Mastersam07 / clean_project.sh
Last active September 9, 2024 12:33
A script to clean all flutter projects on your machine
#!/bin/bash
# Directories to exclude
EXCLUDE_DIRS=(
"/System"
"/Library"
"/Applications"
"/Volumes"
"/opt/homebrew"
"/opt/homebrew/bin/fvm"
@Mastersam07
Mastersam07 / traversal.dart
Created July 14, 2024 23:02
Find scrollables in viewport
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/material.dart';
GlobalKey<_CounterWidgetState> counterKey = GlobalKey<_CounterWidgetState>();
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Mastersam07
Mastersam07 / clean_pub_cache.md
Last active May 18, 2024 10:45
Clean pub cache directories
#!/bin/bash

# Paths to the pub cache directories
PUB_CACHE_HOSTED_DIRS=("$HOME/.pub-cache/hosted/pub.dev" "$HOME/.pub-cache/hosted/pub.dartlang.org")
PUB_CACHE_HASHES_DIR="$HOME/.pub-cache/hosted-hashes/pub.dev"
PUB_CACHE_GIT_DIR="$HOME/.pub-cache/git"

# Function to clean old versions from a given directory
clean_old_versions() {
@Mastersam07
Mastersam07 / future.dart
Last active March 27, 2024 19:41
Future controller idea
import 'package:flutter/material.dart';
typedef FutureGenerator<T> = Future<T> Function();
class FutureController<T> {
Future<T>? _future;
VoidCallback? _onUpdate;
final FutureGenerator<T>? _futureGenerator;
FutureController({FutureGenerator<T>? futureGenerator})
@Mastersam07
Mastersam07 / bottom_sheet.dart
Created February 1, 2024 18:24 — forked from slightfoot/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss)
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@Mastersam07
Mastersam07 / ci.yaml
Created December 10, 2023 18:28
Yaml to build and upload apk to diawi
name: CI
on:
push:
branches: [master, staging]
paths:
- 'lib/**'
- 'pubspec.yaml'
- '.github/**'
- 'android/**'
@Mastersam07
Mastersam07 / auto_response.yaml
Last active October 26, 2023 07:18
Automated Responses Github Actions
name: Automated Responses
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
respond: