Skip to content

Instantly share code, notes, and snippets.

View samuelematias's full-sized avatar

samuca samuelematias

View GitHub Profile
@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"
extension DynamicColor on BuildContext {
Color dynamicColor({int light, int dark}) {
return (Theme.of(this).brightness == Brightness.light)
? Color(light)
: Color(dark);
}
/// the white background
Color get backgroundColor =>
dynamicColor(light: 0xFFFFFFFF, dark: 0xFF222A2E);
@samuelematias
samuelematias / animated_modal.dart
Created July 10, 2020 20:14
flutter modal with custom/animated transition
import 'package:flutter/material.dart';
class AnimatedModal extends PageRouteBuilder {
AnimatedModal({
@required BuildContext context,
@required Widget modalContent,
double overlayHeight = 50.0,
}) : super(
opaque: false,
transitionsBuilder: (BuildContext context,
@samuelematias
samuelematias / restart.dart
Last active July 23, 2020 21:16
Reset your app from everywhere using
import 'package:flutter/material.dart';
class RestartWidget extends StatefulWidget {
RestartWidget({this.child});
final Widget child;
static void restartApp(BuildContext context) {
Future.microtask(() =>
context.findAncestorStateOfType<_RestartWidgetState>().restartApp());
@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());
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
- avoid_annotating_with_dynamic
- avoid_as
include: all_lint_rules.yaml
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
# This is generated from the i18n vscode extension
- "**/i18n.dart"
strong-mode:
implicit-casts: false
implicit-dynamic: false
@samuelematias
samuelematias / animated_line_progress.dart
Created August 20, 2020 16:36
Line Progress Animated.
import 'package:flutter/material.dart';
class AnimatedLineProgress extends StatelessWidget {
final double minLineWidth;
final double maxLineWidth;
final double minLineHeight;
final double maxLineHeight;
final Color lineColor;
final double progressValue;
final Color progressColor;
@samuelematias
samuelematias / links.md
Created August 26, 2020 15:34 — forked from irvine5k/links.md
TDC SP 2020 TESTES DE WIDGET