Skip to content

Instantly share code, notes, and snippets.

View bkhezry's full-sized avatar
🏠
Working from home

Behrouz Khezry bkhezry

🏠
Working from home
View GitHub Profile
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:get/get.dart';
class CapturePersonalPictureController extends GetxController {
CapturePersonalPictureController({required this.returnDataFunction});
late CameraController cameraController;
static ThemeData darkTheme() {
return FlexThemeData.dark(
scheme: FlexScheme.blueWhale,
colorScheme: const ColorScheme(
brightness: Brightness.dark,
primary: Color(0xff57859d),
onPrimary: Color(0xfff5f9fb),
primaryContainer: Color(0xff2a9d8f),
onPrimaryContainer: Color(0xffe6f8f6),
secondary: Color(0xffed7f29),
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ThemeUtil {
static ThemeData themeData(bool isDarkTheme, BuildContext context) {
return ThemeData(
pageTransitionsTheme: const PageTransitionsTheme(builders: {
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.iOS: FadeUpwardsPageTransitionsBuilder(),
}),
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/ahmad/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@bkhezry
bkhezry / main.dart
Created July 31, 2020 07:43
Half screen with two listview
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@bkhezry
bkhezry / BaseActivity.java
Created February 2, 2020 10:50
Fix dark mode problem with i18n
@Override
public void applyOverrideConfiguration(@Nullable Configuration overrideConfiguration) {
if (overrideConfiguration != null) {
int uiMode = overrideConfiguration.uiMode;
overrideConfiguration.setTo(getBaseContext().getResources().getConfiguration());
overrideConfiguration.uiMode = uiMode;
}
super.applyOverrideConfiguration(getResources().getConfiguration());
}
package com.github.bkhezry.buildingcollection.service;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
@bkhezry
bkhezry / EncodingSRT.bash
Created March 16, 2019 15:43
Change encoding of subtitle to UTF-8 in the linux terminal
iconv -f CP1256 -t UTF-8 input.srt -o output.srt
//Request google sign in
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
//Get selected account data
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
private void setUpGoogleSignIn() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
}