Skip to content

Instantly share code, notes, and snippets.

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

Sahan Amarsha SahanAmarsha

🏠
Working from home
View GitHub Profile
@SahanAmarsha
SahanAmarsha / hinge_animation_controller.dart
Created June 10, 2020 13:04
Defining a Hinge Animation
AnimationController _controller;
Animation _rotateAnimation;
Animation<double> _slideAnimation;
Animation<double> _opacityAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
@SahanAmarsha
SahanAmarsha / hinge_animation.dart
Created June 10, 2020 13:14
Using the Hinge Animation
body:
AnimatedBuilder(
animation: _slideAnimation,
builder: (ctx, ch) => Container(
width: 200,
height: 100,
padding: EdgeInsets.all(0),
margin: EdgeInsets.only(
left: 75,
top: _slideAnimation.value,
@SahanAmarsha
SahanAmarsha / bounce_animation_controller.dart
Created June 10, 2020 17:26
Defining the Bounce Animation
AnimationController _controller;
Animation<double> _slideAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1000),
@SahanAmarsha
SahanAmarsha / bounce_animation.dart
Created June 10, 2020 17:28
How to use the Bounce Animation
body:
AnimatedBuilder(animation: _slideAnimation,
builder: (ctx, ch) => Container(
width: 100,
height: 100,
margin: EdgeInsets.only(
top: _slideAnimation.value,
left: 125
),
decoration: BoxDecoration(
import Link from "next/link";
import React from "react";
const Navbar = () => {
const signOutHandler = () => {};
return (
<nav className="navbar w-100 navbar-expand navbar-dark bg-dark mb-4">
<div className="container">
<a className="navbar-brand" href="#">
Profile App
</a>
@SahanAmarsha
SahanAmarsha / _app.js
Created February 28, 2021 20:32
_app.js
import { Amplify } from "aws-amplify";
import { AmplifyAuthenticator } from "@aws-amplify/ui-react";
import awsExports from "../src/aws-exports";
import "../styles/globals.css";
Amplify.configure({ ...awsExports, ssr: true });
function MyApp({ Component, pageProps }) {
return (
<AmplifyAuthenticator>
<Component {...pageProps} />
</AmplifyAuthenticator>
@SahanAmarsha
SahanAmarsha / Navbar.js
Created February 28, 2021 20:34
Navbar.js
import Link from "next/link";
import { Auth } from "aws-amplify";
import React from "react";
const Navbar = () => {
const signOutHandler = () => {};
return (
<nav className="navbar w-100 navbar-expand navbar-dark bg-dark mb-4">
<div className="container">
<a className="navbar-brand" href="#">
Profile App
@SahanAmarsha
SahanAmarsha / index.js
Created February 28, 2021 20:36
index.js
import React from "react";
import Head from "next/head";
import Navbar from "../components/Navbar";
export default function Home() {
return (
<div className="w-100 h-100 d-flex flex-column justify-content-start">
<Head>
<title>Profile App</title>
<link rel="icon" href="/favicon.ico" />
</Head>
@SahanAmarsha
SahanAmarsha / schema.graphql
Created February 28, 2021 20:38
schema.graphql
type User @model {
id: ID!
firstName: String
lastName: String
description: "String"
image: String
}
@SahanAmarsha
SahanAmarsha / edit-user.js
Created February 28, 2021 20:48
edit-user.js
import React, { useState } from "react";
import { Form } from "react-bootstrap";
import { createUser, updateUser } from "../src/graphql/mutations";
import { API } from "@aws-amplify/api";
import { Auth } from "@aws-amplify/auth";
import Navbar from "../components/Navbar";
const EditUser = () => {
const [firstName, setFirstName] = useState('');
const [secondName, setSecondName] = useState('');
const [description, setDescription] = useState('');