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 / 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());
@eveliotc
eveliotc / getRoundedBitmap.java
Created July 22, 2013 03:26
A better yet dirty way of get rounded avatars
public static Bitmap getRoundedBitmap(Bitmap bitmap) {
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final int color = Color.RED;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);