Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
https://vipulasri.com/

Vipul Asri vipulasri

👨‍💻
https://vipulasri.com/
View GitHub Profile
View extractImagesFromFont.rb
require 'ttfunk'
file = TTFunk::File.open(ARGV[0])
size = 200
output_dir = ARGV[2]
`mkdir #{output_dir}`
cmap = file.cmap
chars = {}
unicode_chars = []
@vipulasri
vipulasri / banner-sample.json
Created Mar 17, 2020
Banner Element Sample
View banner-sample.json
{
"viewType":"bannerElement",
"imageUrl":"https://images.unsplash.com/photo-1478145046317-39f10e56b5e9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80",
"title":"Upto 30% Off",
"action":{
"type":1,
"value":"d43e24ca-3522-4106-91f6-09f0b80d1061"
}
}
@vipulasri
vipulasri / Banner.kt
Created Mar 12, 2020
JetDelivery-banner-text
View Banner.kt
@Composable
private fun showBannerText() {
Align(alignment = Alignment.BottomLeft) {
Container(
modifier = LayoutWidth.Fill, height = 50.dp,
alignment = Alignment.CenterLeft
) {
DrawShape(shape = RectangleShape, color = Color.Black.copy(alpha = 0.3f))
Text(
text = "Upto 30% off",
@vipulasri
vipulasri / Banner.kt
Created Mar 12, 2020
JetDelivery-banner-rounded-corner
View Banner.kt
@Composable
fun showBannerElement() {
Container(width = 150.dp, height = 178.dp) {
Clip(shape = RoundedCornerShape(5.dp)) {
DrawImage(image = imageResource(id = R.drawable.placeholder_banner))
}
}
}
View data-random.json
{
"data":[
{
"viewType":"horizontalScroll",
"data":[
{
"viewType":"categoryElement",
"imageUrl":"https://gist.githubusercontent.com/vipulasri/8bd2115e50fd73272ea8de08cd54b9d5/raw/c61e583eb588f711126cc72899739d4c9ac9cba6/hamburger.png",
"title":"Burgers",
"subTitle":"260 Places",
View Painting.dart
class PaintingResponse {
List<Painting> paintings;
PaintingResponse(this.paintings);
PaintingResponse.fromJson(Map<String, dynamic> json) {
if (json['Paintings'] != null) {
paintings = new List<Painting>();
json['Paintings'].forEach((v) {
paintings.add(new Painting.fromJson(v));
@vipulasri
vipulasri / CustomTabIndicator_Step3.dart
Created May 22, 2018
Flutter: Bubble Tab Indicator
View CustomTabIndicator_Step3.dart
//In this, we will create a variable to hold [indicatorHeight] i.e 15.0
//Now, we will create a new offset to set the x-axis position of tab according to the TabIndicatorSize i.e label or tab start.
//And set the y-axis to tab height center position and subtracting the value of indicatorHeight center value.
final Rect rect = Offset(offset.dx, (configuration.size.height/2) - indicatorHeight/2) & Size(configuration.size.width, indicatorHeight);
@vipulasri
vipulasri / CustomTabIndicator_Step2.dart
Last active May 22, 2018
Flutter: Bubble Tab Indicator
View CustomTabIndicator_Step2.dart
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
class CustomTabIndicator extends Decoration {
@override
_CustomPainter createBoxPainter([VoidCallback onChanged]) {
return new _CustomPainter(this, onChanged);
}
@vipulasri
vipulasri / CustomTabIndicator_Step1.dart
Last active May 22, 2018
Flutter: Bubble Tab Indicator
View CustomTabIndicator_Step1.dart
import 'package:flutter/widgets.dart';
class CustomTabIndicator extends Decoration {
@override
BoxPainter createBoxPainter([VoidCallback onChanged]) {
// TODO: implement createBoxPainter
}
}