Skip to content

Instantly share code, notes, and snippets.

View samuelematias's full-sized avatar

samuca samuelematias

View GitHub Profile
import 'package:flutter/material.dart';
class NameInitialsWidget extends StatelessWidget {
final double width;
final double height;
final String text;
final double fontSize;
final double margin;
const NameInitialsWidget(
extension TextExtension on Text {
Text h1({TextStyle style}) {
TextStyle defaultStyle = TextStyle(
fontFamily: 'Nunito_Sans',
fontSize: 36,
fontWeight: FontWeight.w900,
fontStyle: FontStyle.normal,
letterSpacing: -0.02,
color: SoulphiaTheme.defaultGraySwatch[50],
);
@samuelematias
samuelematias / flutter_github_ci.yml
Created June 22, 2020 23:10 — forked from rodydavis/flutter_github_ci.yml
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
@samuelematias
samuelematias / flutter_all_fastlane.sh
Created June 23, 2020 23:15 — forked from rodydavis/flutter_all_fastlane.sh
Using Fastlane for Flutter to deploy iOS, Mac, Android and Web
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
import 'package:flutter/foundation.dart';
import 'dart:io';
bool get isWeb => kIsWeb;
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid);
bool get isDesktop =>
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux);
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS);
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia);
@samuelematias
samuelematias / pre-push
Created July 7, 2020 01:15 — forked from rogood/pre-push
Flutter Pre Push Hook with Console Messages
#!/usr/bin/env bash
if [[ `git status --porcelain` ]]; then
printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.'
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer'
flutter analyze
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error'
exit 1
@samuelematias
samuelematias / pre-commit
Created July 7, 2020 01:15 — forked from rogood/pre-commit
Flutter Pre Commit Hook with Console Messages
#!/usr/bin/env bash
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter formatter'
flutter format .
printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter formatter'
@samuelematias
samuelematias / gh-pages-deploy.md
Created July 7, 2020 16:46 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@samuelematias
samuelematias / script
Created July 7, 2020 16:47 — forked from fesor/script
Jenkins: script for checking is directory has changed from last build
#!/bin/bash
DIR_PATH=$1
if [ ! -d "$DIR_PATH" ]; then
echo "Directory '$DIR_PATH' not exists"
exit 1
fi
if [ -z "$GIT_COMMIT" ]; then
echo "No current commit... fail"
@samuelematias
samuelematias / future_extension.dart
Created August 18, 2020 19:39 — forked from VB10/future_extension.dart
Future Extension Flutter
extension FutureExtension on Future {
Widget toBuild<T>({Widget Function(T data) onSuccess, Widget onError, dynamic data}) {
return FutureBuilder<T>(
future: this,
initialData: data,
builder: (BuildContext context, AsyncSnapshot snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
case ConnectionState.active:
return Center(child: CircularProgressIndicator());