Skip to content

Instantly share code, notes, and snippets.

View roipeker's full-sized avatar
🏠
Working from home

Roi Peker roipeker

🏠
Working from home
View GitHub Profile
@roipeker
roipeker / mask_email.dart
Created January 20, 2021 15:42
Mask Email RegExp for Dart
import 'dart:math';
void testMaskEmail() {
final emails = [
'a@example.com',
// output: a****a@example.com
'ab@example.com',
// output: a****b@example.com
'abc@example.com',
// output: a****c@example.com
@roipeker
roipeker / main.dart
Created June 4, 2021 16:38
GraphX issue #19: gesture detector sample (zoom/pan/rotation with easing)
import 'package:flutter/material.dart';
import 'package:graphx/graphx.dart';
import 'zoom_scene.dart';
/// Live demo:
/// https://graphx-gesture-sample.surge.sh
///
void main() {
@roipeker
roipeker / control_dialogs_demo.dart
Last active December 28, 2023 05:14
test for removing GetX dialogs with removeRoute + extension methods.
/// Copyright roipeker 2020.
// Web Sample:
// https://roi-getx-kill-dialog.surge.sh/
import 'package:flutter/material.dart';
import 'package:get/get.dart';
/// proof of concept
/// execute in main.dart:
@roipeker
roipeker / main.dart
Created September 3, 2020 00:27
Getx Subnavigators Colors
/// roipeker - 2020
/// Based on
/// https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SampleMultiNavColors extends StatelessWidget {
@override
@roipeker
roipeker / image_color_picker_widget.dart
Last active November 4, 2023 17:37
Basic image pixel color detection in Flutter (supports screenshots of the widget tree)
//////////////////////////////
//
// 2019, roipeker.com
// screencast - demo simple image:
// https://youtu.be/EJyRH4_pY8I
//
// screencast - demo snapshot:
// https://youtu.be/-LxPcL7T61E
//
//////////////////////////////
@roipeker
roipeker / form_utils.dart
Last active October 27, 2023 12:51
TextField concept for GetX (WIP) ...
/// copyright 2020, roipeker
class FormValidations {
static String email(String val) {
val = val.trim();
if (val.isEmpty) return 'Email cant be empty';
if (val.length <= 4) return 'Email is too short';
if (!val.isEmail) return 'Invalid email';
return null;
}
@roipeker
roipeker / glassbox.dart
Created December 10, 2020 02:33
GlassBox - Flutter Widget: Glassmorphism style .
/// roipeker 2020.
import 'dart:ui';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
/// Usage:
/// ```
/// GlassBox(
/// width: 140,
@roipeker
roipeker / issue1481.dart
Created May 28, 2021 01:27
Getx Issue 1481 (same Type Controllers in multipage navigation).
/// Note:
/// A simple fix for this case scenario of local controller lifecycle, might be
/// to separate the `global:false` logic here:
/// https://github.com/jonataslaw/getx/blob/07ad5d7f9e726f181800359d0218b44e5967ccf8/lib/get_state_manager/src/simple/get_state.dart#L177
// ...
// if (_isCreator! || widget.assignId) {
// if (widget.autoRemove) {
// /// if the Controller is flagged as "local", run manually `onClose()`.
// if( !widget.global ){
@roipeker
roipeker / main.dart
Created April 11, 2023 00:02
Creating Particles with Flutter and GraphX #short
/// roipeker 2023.
///
/// #short tutorial: https://youtu.be/I8Yo9jq4hXs
///
import 'package:flutter/material.dart';
import 'package:graphx/graphx.dart';
void main() {
runApp(const MyApp());
@roipeker
roipeker / signal.dart
Last active March 29, 2023 15:16
signal concept in dart
import 'package:flutter/cupertino.dart';
abstract class Entity {
late final onDispose = Signal0();
late bool _disposed = false;
bool get disposed => _disposed;
@mustCallSuper