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
@tarek360
tarek360 / safe_pace.dart
Created December 27, 2019 05:16
SafeSpace top or bottom, (in progress)
import 'package:flutter/widgets.dart';
enum _Position {
bottom,
top,
right,
left,
}
class SafeSpace extends StatelessWidget {
@tarek360
tarek360 / top_alert.dart
Created December 10, 2019 09:57
A TopAlert to show at the top of any page (widget).
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Top Alert View',
theme: ThemeData(
@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(
@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})
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 / 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.")
@tarek360
tarek360 / CurvedShape.dart
Last active February 8, 2023 00:54
Draw a curved shape in Flutter
import "package:flutter/material.dart";
import 'package:flutter/services.dart';
import 'dart:math';
const CURVE_HEIGHT = 160.0;
const AVATAR_RADIUS = CURVE_HEIGHT * 0.28;
const AVATAR_DIAMETER = AVATAR_RADIUS * 2;
void main() => runApp(new MyApp());
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',
@Entity(tableName = "eyes")
data class EyeEntry(
@PrimaryKey @ColumnInfo(name = "id") var id: Long? = null,
@ColumnInfo(name = "color") var color: String? = null
)
@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,