Skip to content

Instantly share code, notes, and snippets.

Avatar
🧩
Taking care of my mental health and in spare moments coding sometimes.

Samuel Matias samuelematias

🧩
Taking care of my mental health and in spare moments coding sometimes.
View GitHub Profile
@samuelematias
samuelematias / extension_example.dart
Created Mar 12, 2020
Examples of Dart extension methods
View extension_example.dart
extension Paddings on Widget {
Widget paddingAll(double padding) => Padding(
padding: EdgeInsets.all(padding),
child: this,
);
}
extension TextStyles on Text {
Text h1() {
if (this is Text) {
View name_initial_widget.dart
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(
View extension.dart
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 / modal_with_keyboard.dart
Created May 15, 2020
Modal with keyboard Flutter
View modal_with_keyboard.dart
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (context) {
return SingleChildScrollView(
child:Container(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: AnyChild(),
)
@samuelematias
samuelematias / launch.json
Last active Jun 10, 2020
[Flutter] Open 2 devices in debug mode on VsCode.
View launch.json
//To get your devideId follow this steps:
//1 - Open your emulator/simulator (Android/iOS/Browser)
//2 - Run on terminal "flutter devices"
//3 - Get de deviceId (second param: https://i.imgur.com/dZHsyrc.png)
// More infos: https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code
{
"version": "0.2.0",
"configurations": [
{
"name": "Android",
@samuelematias
samuelematias / flutter_github_ci.yml
Created Jun 22, 2020 — 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)
View flutter_github_ci.yml
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
@samuelematias
samuelematias / flutter_all_fastlane.sh
Created Jun 23, 2020 — forked from rodydavis/flutter_all_fastlane.sh
Using Fastlane for Flutter to deploy iOS, Mac, Android and Web
View flutter_all_fastlane.sh
# 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
View flutter_device_utils.dart
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 / app_theme.dart
Created Jun 24, 2020
Customize/Theming the ThemeData to Light/Dark Theme
View app_theme.dart
import 'package:flutter/material.dart';
class AppTheme {
AppTheme._();
static final Color _iconColor = Colors.redAccent.shade200;
static const Color _lightPrimaryColor = Colors.white;
static const Color _lightPrimaryVariantColor = Color(0xFFE1E1E1);
static const Color _lightSecondaryColor = Colors.green;
@samuelematias
samuelematias / pre-push
Created Jul 7, 2020 — forked from rogood/pre-push
Flutter Pre Push Hook with Console Messages
View pre-push
#!/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