Skip to content

Instantly share code, notes, and snippets.

View omegasoft7's full-sized avatar
🎯

Farhad Sanaei omegasoft7

🎯
  • Germany, Hamburg
View GitHub Profile
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'dart:async';
import 'package:flutter/material.dart';
class AnimatedListExample extends StatefulWidget {
@override
_AnimatedListExampleState createState() => _AnimatedListExampleState();
}
class _AnimatedListExampleState extends State<AnimatedListExample> {
final List<String> _items = [];
import 'dart:async';
import 'package:flutter/material.dart';
class AnimatedListExample extends StatefulWidget {
@override
_AnimatedListExampleState createState() => _AnimatedListExampleState();
}
class _AnimatedListExampleState extends State<AnimatedListExample> {
final List<String> _items = [];
@omegasoft7
omegasoft7 / challenge01.dart
Last active September 16, 2024 11:29
flutter challenge 01
import 'dart:async';
import 'package:flutter/material.dart';
class AnimatedListExample extends StatefulWidget {
@override
_AnimatedListExampleState createState() => _AnimatedListExampleState();
}
class _AnimatedListExampleState extends State<AnimatedListExample> with SingleTickerProviderStateMixin {
final List<String> _items = [];
@omegasoft7
omegasoft7 / change_strings.gradle
Created December 19, 2018 15:06
Change String Resources from Gradle
applicationVariants.all { variant ->
variant.mergeResources.doLast {
def dir = new File("${buildDir}/intermediates/res/merged/${variant.dirName}") //iterating through resources, prepared for including to APK (merged resources)
println("Resources dir " + dir)
dir.eachFileRecurse { file ->
if(file.name.endsWith(".xml")) { //processing only files, which names and with .xml
String content = file.getText('UTF-8')
if(content != null && content.contains("Bill")) {
println("Replacing name in " + file)
content = content.replace("Bill", "Will") //replacing all Bill words with Will word in files
@omegasoft7
omegasoft7 / ExpandableVerticalLinearLayout.java
Created March 2, 2016 15:30
Make expandable Vertical LinearLayout.Height of view can be wrap content.open/close/toggle can be animated or without animation
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
/**
* Created by farhad on 16.2.3.
* this is an expandable linear Layout with orientation of Vertivally
* it will handle whole calculations and animations for height of View
* Your view can have wrap content, it will calculate exact height after adding views to the layout
@omegasoft7
omegasoft7 / createObservable RxJava
Created February 9, 2016 12:38
createObservable RxJava
public static Observable<String> createObservable(){
return Observable.create((Subscriber<? super String> subscriber) -> {
subscriber.onNext(Thread.currentThread().getName());
subscriber.onCompleted();
}
);
}
@omegasoft7
omegasoft7 / gist:ec2285ae5a873d6f780b
Last active January 12, 2018 13:27
Change Android Emulator Storage Size
# Navigate to AVD
cd ~/.android/avd/Nexus5
# Delete old image
#rm userdata-qemu.*
# Re-size the image
e2fsck -f userdata-qemu.img
resize2fs userdata.img 512M
@omegasoft7
omegasoft7 / build.gradle
Created January 20, 2015 12:07
Tweet from Gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.twitter4j', name: 'twitter4j-core', version: '3.0.2'
}
}
import twitter4j.*
@omegasoft7
omegasoft7 / ActivitySwipeDetector.java
Created January 15, 2015 11:15
SwipeDetectorIt should set as ontouch event of a View
import android.app.Activity;
import android.view.MotionEvent;
import android.view.View;
public abstract class ActivitySwipeDetector implements View.OnTouchListener {
private Activity activity;
static final int MIN_DISTANCE = 100;
private float downX, downY, upX, upY;