Skip to content

Instantly share code, notes, and snippets.

View mahmudahsan's full-sized avatar

Mahmud Ahsan mahmudahsan

View GitHub Profile
upload_dsym_to_firebase()
{
echo "-> Uploading dSYMs files to Google Crashlytics"
if [ "$1" == "beta" ]
then
fastlane upload_crashlytics_beta
elif [ "$1" == "prod" ]
then
fastlane upload_crashlytics_prod
fi
@mahmudahsan
mahmudahsan / ios_detect.swift
Last active July 9, 2021 09:07
iPhone X and other iOS device detection by Swift and Objective-C
struct Device {
// iDevice detection code
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad
static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone
static let IS_RETINA = UIScreen.main.scale >= 2.0
static let SCREEN_WIDTH = Int(UIScreen.main.bounds.size.width)
static let SCREEN_HEIGHT = Int(UIScreen.main.bounds.size.height)
static let SCREEN_MAX_LENGTH = Int( max(SCREEN_WIDTH, SCREEN_HEIGHT) )
static let SCREEN_MIN_LENGTH = Int( min(SCREEN_WIDTH, SCREEN_HEIGHT) )
import 'package:flutter/material.dart';
import 'package:states_bloc/drawer_menu.dart';
import 'package:states_bloc/bloc/settings/settings_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class Settings extends StatelessWidget {
double _value = 0.5;
bool isBold = false;
bool isItalic = false;
@override
import 'package:flutter/material.dart';
import 'package:states_bloc/home.dart';
import 'package:states_bloc/about.dart';
import 'package:states_bloc/settings.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:states_bloc/bloc/settings/settings_bloc.dart';
void main() {
final BlocProvider<SettingsBloc> blocProvider = BlocProvider<SettingsBloc>(
builder: (_) => SettingsBloc(),
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
part 'settings_event.dart';
part 'settings_state.dart';
class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
@override
SettingsState get initialState => InitialSettingsState();
part of 'settings_bloc.dart';
@immutable
abstract class SettingsState {
final double sliderFontSize;
final bool isBold;
final bool isItalic;
SettingsState({this.sliderFontSize, this.isBold, this.isItalic});
double get fontSize => sliderFontSize * 30;
}
part of 'settings_bloc.dart';
@immutable
abstract class SettingsEvent {
final dynamic payload;
SettingsEvent(this.payload);
}
class FontSize extends SettingsEvent {
FontSize(double payload) : super(payload);
import SwiftUI
//MARK:- Checkbox Field
struct CheckboxField: View {
let id: String
let label: String
let size: CGFloat
let color: Color
let textSize: Int
let callback: (String, Bool)->()
// MARK:- View 2
struct View2: View {
@EnvironmentObject var appState: AppState
var body: some View {
VStack {
Text("View 2")
.font(.headline)
Button(action: {
// FIXME:- add move to dashboard functionality
import SwiftUI
struct ContentView: View {
@EnvironmentObject var appState: AppState
var body: some View {
NavigationView {
VStack {
// TabView1()
tabsView