Skip to content

Instantly share code, notes, and snippets.

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

Hashem haashem

🏠
Working from home
View GitHub Profile
@haashem
haashem / CustomCollectionFlowLayout.h
Last active February 12, 2016 04:12 — forked from toblerpwn/CustomCollectionFlowLayout.h
Sticky Headers at the top of a UICollectionView! -- // -- http://stackoverflow.com/questions/13511733/how-to-make-supplementary-view-float-in-uicollectionview-as-section-headers-do-i -- // -- still needs work around contentInsets.bottom and oddly-sized footers.
//
// CustomCollectionFlowLayout.h
// evilapples
//
// http://stackoverflow.com/questions/13511733/how-to-make-supplementary-view-float-in-uicollectionview-as-section-headers-do-i
//
//
#import <UIKit/UIKit.h>
@haashem
haashem / UIImage+ Decompress.swift
Created February 15, 2017 08:05
an extension on UIImage for decompressing it before assigning to UIImageView. Recommended to run on a background thread
//
// UIImage+Decompress.swift
//
// Created by Hashem Aboonajmi on 15/02/2017
//
import UIKit
extension UIImage {
@haashem
haashem / partial.dart
Last active May 21, 2022 06:34
property observation in Dart
/// Is Naurt's Locomotion running at the moment?
Future<bool> isRunning() {
throw UnimplementedError('isRunning() has not been implemented.');
}
ValueChanged<bool>? onRunning;
/// Streams location changes
Stream<NaurtLocation> get onLocationChanged {
throw UnimplementedError('onLocationChanged has not been implemented.');
}
@haashem
haashem / NaurtIOS.dart
Last active May 21, 2022 06:46
NaurtIOS
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:naurt_platfrom_interface/naurt_platform_interface.dart';
/// An implementation of [NaurtIOS] that uses method channels.
class NaurtIOS extends NaurtPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('com.naurt.ios');
@haashem
haashem / SwiftNaurtIosPlugin.dart
Last active May 18, 2022 15:41
Naurt iOS implementation
import Flutter
import Combine
import UIKit
import naurt_framework
public class SwiftNaurtIosPlugin: NSObject, FlutterPlugin {
private var subscriptions = [AnyCancellable]()
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "com.naurt.ios", binaryMessenger: registrar.messenger())
@haashem
haashem / main.dart
Created August 4, 2022 05:49
Buggy Buttons
// You’re making a shopping app called RubberBaby, which sells dolls. Unfortunately, you’ve run into
// a problem on the order page. If a customer makes one order for blue dolls and another order for
// red dolls but then tries to delete the blue doll order, the red doll order is wrong.
// Given only the following code, how would you fix the RubberBaby buggy buttons?
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
@haashem
haashem / Responsive.dart
Created September 25, 2022 17:45
Responsive static methods
import 'package:flutter/material.dart';
// This size work fine on my design, maybe you need some customization depends on your design
const _desktopMinSize = 1100;
const _tabletMinSize = 740;
class Responsive {
// This isMobile, isTablet, isDesktop helep us later
@haashem
haashem / HomePageRow.dart
Created September 25, 2022 17:54
HomePage Row
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
...() {
return Responsive.isMobile(context) == false
? [
SideMenu(
onPressed: ((index) {
_selectedIndex = index;
@haashem
haashem / Responsive.dart
Created September 25, 2022 18:19
Responsive Widget
import 'package:flutter/material.dart';
const _desktopMinSize = 1100;
const _tabletMinSize = 740;
class Responsive extends StatelessWidget {
final Widget mobile;
final Widget? tablet;
final Widget desktop;
@haashem
haashem / SignInAndSecurityPage-Child.dart
Created September 25, 2022 18:33
SignInAndSecurityPage child widget
Center(
child: Responsive(
mobile: _BelowDesktopLayout(),
tablet: _BelowDesktopLayout(),
desktop: _DesktopLayout(),
),
)