Skip to content

Instantly share code, notes, and snippets.

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

sanni prasad prasadsunny1

🏠
Working from home
View GitHub Profile
@prasadsunny1
prasadsunny1 / transxml.py
Last active May 19, 2018 18:13
This python script takes an xml file and translaes all the values tagged with <value> in your target language(set target="LANG_CODE" in the script)
# -*- coding: utf-8 -*-
from google.cloud import translate
import six
import xml.dom.minidom as minidom
def translate_text(target, text):
"""Translates text into the target language.
Target must be an ISO 639-1 language code.
@prasadsunny1
prasadsunny1 / abc.html
Created December 30, 2018 10:32
my cool html
<html>
<head>
<title>
Hello sunny
</title>
</head>
</html>
@prasadsunny1
prasadsunny1 / CodeMagicAndroidCrash
Created August 7, 2019 13:48
Facing android build fail in codemagic. Works in local machine
== Building for Android ==
== /usr/local/bin/flutter build appbundle --release --build-name=1.0.25 --build-number=25 -v ==
[ +53 ms] executing: [/Users/builder/programs/flutter/] git log -n 1 --pretty=format:%H
[ +58 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] 20e59316b8b8474554b38493b8ca888794b0234a
[ ] executing: [/Users/builder/programs/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +22 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.7.8+hotfix.4-0-g20e59316b
[ +19 ms] executing: [/Users/builder/programs/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
@prasadsunny1
prasadsunny1 / main.dart
Created August 18, 2019 08:38
main.dart
import "package:flutter/material.dart";
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@prasadsunny1
prasadsunny1 / SaveImagetoPhotoGallary.dart
Last active February 22, 2020 18:22
Save image to image gallery using "image_gallery_saver" and asking for permission using "permission_handler" with flutter
import 'dart:typed_data';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:permission_handler/permission_handler.dart';
//iOS - add these keys to info.plist in your ios folder
// NSPhotoLibraryAddUsageDescription and NSPhotoLibraryUsageDescription
// This gist uses flutter packages
@prasadsunny1
prasadsunny1 / googlesignin.dart
Created March 8, 2020 18:32
Google signin using flirebase in flutter
Future<User> signInWithGoogle() async {
final googleSignIn = GoogleSignIn();
final googleAccount = await googleSignIn.signIn();
if (googleAccount != null) {
final googleAuth = await googleAccount.authentication;
if (googleAuth.accessToken != null && googleAuth.idToken != null) {
final authResult = await _firebaseAuth.signInWithCredential(
GoogleAuthProvider.getCredential(
idToken: googleAuth.idToken,
accessToken: googleAuth.accessToken,
@prasadsunny1
prasadsunny1 / main.dart
Created May 16, 2020 10:50 — forked from iamriya/main.dart
Profile screen demo
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@prasadsunny1
prasadsunny1 / main.dart
Created May 16, 2020 12:59
Milestone 1
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Profile page"),
),
body: Column(
@prasadsunny1
prasadsunny1 / ieee_navigation.dart
Last active May 17, 2020 09:40
Navigate from one page to another
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Page1(),
),
);
}
@prasadsunny1
prasadsunny1 / ieee_input.dart
Last active May 17, 2020 09:37
Take an input from user
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Page1(),
));
}
class Page1 extends StatelessWidget {
TextEditingController usernameController = TextEditingController();