Skip to content

Instantly share code, notes, and snippets.

View tarek360's full-sized avatar
💭
I'm Fluttering!

Ahmed Tarek tarek360

💭
I'm Fluttering!
View GitHub Profile
RichPathView colorPickerRichPathView = findViewById(R.id.color_picker);
final RichPath bluePath = colorPickerRichPathView.findRichPathByName("bluePath");
final RichPath redPath = colorPickerRichPathView.findRichPathByName("redPath");
final RichPath greenPath = colorPickerRichPathView.findRichPathByName("greenPath");
final RichPath purplePath = colorPickerRichPathView.findRichPathByName("purplePath");
colorPickerRichPathView.setOnPathClickListener(new RichPath.OnPathClickListener() {
@Override
public void onClick(RichPath richPath) {
bluePath.setStrokeAlpha(0f);
<com.richpath.RichPathView
android:id="@+id/color_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:vector="@drawable/color_picker" />
RichPathView colorPickerRichPathView = findViewById(R.id.color_picker);
final RichPath bluePath = colorPickerRichPathView.findRichPathByName("bluePath");
final RichPath redPath = colorPickerRichPathView.findRichPathByName("redPath");
final RichPath greenPath = colorPickerRichPathView.findRichPathByName("greenPath");
final RichPath purplePath = colorPickerRichPathView.findRichPathByName("purplePath");
colorPickerRichPathView.setOnPathClickListener(new RichPath.OnPathClickListener() {
@Override
public void onClick(RichPath richPath) {
// reset all strokes
@Entity(tableName = "matches",
foreignKeys = [
ForeignKey(entity = UserEntry::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("id"))
])
data class UserEntry(
@PrimaryKey @ColumnInfo(name = "id") var id: Long? = null,
@ColumnInfo(name = "name") var name: String? = null,
@Entity(tableName = "eyes")
data class EyeEntry(
@PrimaryKey @ColumnInfo(name = "id") var id: Long? = null,
@ColumnInfo(name = "color") var color: String? = null
)
import 'package:flutter/material.dart';
import "package:flare_flutter/flare_actor.dart";
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'The Boring Star',
@tarek360
tarek360 / NoJpgRule.kt
Last active February 13, 2019 07:08
Custom Koshry rule to avoid adding new JPG files to your git repo and ask the pull request author to use WebP instead.
import io.github.tarek360.rules.core.Issue
import io.github.tarek360.rules.core.Level
import io.github.tarek360.rules.core.Report
import io.github.tarek360.rules.core.Rule
class NoJpgRule : Rule() {
override fun run(): Report? {
val report = Report(msgTitle = "No more JPG files, Use WebP.")
class HeartsPainter extends CustomPainter {
final Paint hearPaint = Paint()
..style = PaintingStyle.stroke;
@override
void paint(Canvas canvas, Size size) {
print('Hearts Painting..');
const int count = 700;
for (int i = 0; i < count; i++) {
@tarek360
tarek360 / flip.dart
Created November 16, 2019 04:49
Flip Widget Vertically or Horizontally.
class Flip extends StatelessWidget {
final Widget child;
final double _scaleX;
final double _scaleY;
Flip.vertically({@required this.child})
: _scaleX = 1.0,
_scaleY = -1.0;
Flip.horizontally({@required this.child})
@tarek360
tarek360 / stream_builder_example.dart
Created December 6, 2019 10:32
StreamBuilder Example
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(