Skip to content

Instantly share code, notes, and snippets.

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

ManishRaj androidfanatic

🏠
Working from home
View GitHub Profile
@androidfanatic
androidfanatic / index.html
Created February 17, 2020 12:54
Quick and easy authentication with useAuth()
<!DOCTYPE html>
<html>
<head>
<title>Quick and Easy Authentication with useAuth()</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
/// imports widgets from the material design
import 'package:flutter/material.dart';
void main() => runApp(TodoApp());
/// Stateless widgets must implement the build() method and return a widget.
/// The first parameter passed to build function is the context in which this widget is built
class TodoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
class Todo {
final String label;
bool completed;
Todo(this.label, this.completed);
}
/// State is composed all the variables declared in the State implementation of a Stateful widget
class TodoListState extends State<TodoList> {
final List<Todo> todos = List<Todo>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Todo'),
),
body: Padding(
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add), /// uses the built-in icons
onPressed: () => _promptDialog(context),
),
/// display a dialog that accepts text
_promptDialog(BuildContext context) {
String _todoLabel = '';
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('Enter TODO item'),
content: TextField(
onChanged: (value) => _todoLabel = value,
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
final Random random = new Random();
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:splashscreen/splashscreen.dart';
import 'package:http/http.dart' as http;
void main() => runApp(MyApp());
Color getColorFromHex(String hexColor) {
@androidfanatic
androidfanatic / .bashrc
Last active October 3, 2022 01:51
.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# edit this file
alias srcedit='nano +99999 ~/.zshrc && source ~/.zshrc'
alias srcupdate='source ~/.zshrc'
# npm
alias npms='npm run start'
alias npmd='npm run start:development'
export default class CounterApp extends React.Component {
constructor(props) {
super(props);
this.state = { count: 0 };
}
render() {
return (
<div className="App">
<button
onClick={() => {