Skip to content

Instantly share code, notes, and snippets.

View happyharis's full-sized avatar
🎯
Focusing

Haris Samingan happyharis

🎯
Focusing
View GitHub Profile
@happyharis
happyharis / main.dart
Created April 15, 2020 23:40
Parallax Effect in Flutter Web
import 'package:flutter/material.dart';
// Import transparent_image in pubspec.yaml file
import 'package:transparent_image/transparent_image.dart';
void main() {
runApp(MyPortfolio());
}
class MyPortfolio extends StatelessWidget {
@override
@happyharis
happyharis / ClipShadowPath.dart
Last active April 11, 2023 04:01 — forked from coman3/ClipShadowPath.dart
ClipShadowPath with BoxShadow params
import 'package:flutter/material.dart';
@immutable
class ClipShadowPath extends StatelessWidget {
final BoxShadow shadow;
final CustomClipper<Path> clipper;
final Widget child;
ClipShadowPath({
@required this.shadow,
@happyharis
happyharis / buttons.dart
Created March 23, 2020 09:00
Freezed package implement in a project with firestore
// add
performLinksCrud(linksCollection, Add(newLink));
// edit
performLinksCrud(linksCollection, Update(newLink),documentID: data.documentID);
// delete
performLinksCrud(linksCollection, Delete(), documentID: data.documentID);
@happyharis
happyharis / main.dart
Created March 14, 2020 09:23
Proxy provider with firebase authentication
void main() {
Provider.debugCheckInvalidValueType = null;
runApp(MyAppExample());
}
class MyAppExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MultiProvider(providers: [
@happyharis
happyharis / neumorphic_bar.dart
Created January 22, 2020 12:17
A neumorphic bar
NeumorphicBar(
width: 200,
height: 400,
value: 0.9,
text: 'Tue',
color: Color.fromRGBO(0, 200, 156, 1),
),
class NeumorphicBar extends StatelessWidget {
const NeumorphicBar({
@happyharis
happyharis / firebase_storage.dart
Created January 10, 2020 05:07
Flutter web implemantion of firebase storage
import 'dart:async';
import 'dart:html';
import 'package:flutter/material.dart';
import 'package:firebase/firebase.dart' as fb;
import 'package:firebase/firestore.dart' as fs;
import 'package:linktree_demo_clone/linktree.dart';
class Settings extends StatefulWidget {
@override
firestore.collection('names').add({'text': 'happyharis'}); // create
firestore.collection('names').doc('111').get(); // read
firestore.collection('names').doc('111').update(data:{'text': 'thehappyharis'}); // update
firestore.collection('names').doc('111').delete(); // delete
import 'package:firebase/firebase.dart' as Firebase;
Future<void> main() async {
if (Firebase.apps.isEmpty) {
print(Firebase.apps);
Firebase.initializeApp(
apiKey: '',
authDomain: '',
databaseURL: '',
projectId: '',
class RestaurantBloc {
RestaurantBloc() {
chef.stream.listen(cookOrder);
}
String cookedFood;
final waiter = StreamController();
Sink get tray => waiter.sink;
Stream get deliverFood => waiter.stream;
class RestaurantBloc implements BlocBase {
RestaurantBloc() {
chef.stream.listen(cookOrder);
}
String currentOrder;
final waiter = StreamController();
Sink get tray => waiter.sink;
Stream get deliverFood => waiter.stream;