Skip to content

Instantly share code, notes, and snippets.

View OmarYehiaDev's full-sized avatar
🔍
Searching for new challenges

Omar Yehia OmarYehiaDev

🔍
Searching for new challenges
View GitHub Profile
@OmarYehiaDev
OmarYehiaDev / quizWhatDoIwear.js
Last active July 14, 2019 20:06 — forked from desinas/quizWhatDoIwear.js
What do I wear Quiz (3-7) of Udacity Front end developer
/*
* Programming Quiz: What do I Wear? (3-7)
*
* Using if/else statements, create a series of logical expressions that logs the size of a t-shirt based on the measurements of:
* - shirtWidth
* - shirtLength
* - shirtSleeve
*
* Use the chart above to print out one of the following correct values:
* - S, M, L, XL, 2XL, or 3XL
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"password": "9hX9rs"
},
{
"id": 2,
import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter/material.dart';
import 'package:overlay_support/overlay_support.dart';
class PushNotificationService {
@OmarYehiaDev
OmarYehiaDev / Application.kt
Last active January 21, 2021 15:11
These're the files for Flutter/Kotlin projects
package com.example.your_app
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
@OmarYehiaDev
OmarYehiaDev / MainActivity.kt
Created February 18, 2021 18:23
This is the native code for creating MethodChannel for Notifications in Flutter
package com.example.app
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.IntentFilter
Widget build(BuildContext context) {
UserDetails _user = widget.user;
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
title: Text("Profile Page"),
centerTitle: true,
),
body: ListView(
Future<void> openOffersPage(RemoteMessage? message) async {
if (message != null) {
if (message.data['type'] == 'offers') {
Navigator.push(
key.currentContext!,
MaterialPageRoute(
builder: (_) => HotOffers(),
),
);
}
@OmarYehiaDev
OmarYehiaDev / streambuilder.dart
Created May 30, 2022 23:54
StreamBuilder Example
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
@OmarYehiaDev
OmarYehiaDev / radiobutton_ui.dart
Last active October 5, 2022 21:49
Made a duplicate UI for Radio button
const double outerSize = 20;
const double innerSize = outerSize - 10;
Obx(
() => Stack(
children: [
Icon(
Icons.circle_outlined,
color: AppColors.primary,
size: outerSize,
),
import 'package:flutter/material.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {