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
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);
// 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
var window: UIWindow?
var contentView: ContentView?
var appState: AppState?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
self.window = window
reloadDashboard()
}
import SwiftUI
import Combine
class AppState: ObservableObject {
func reloadDashboard() {
(UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate)?.reloadDashboard()
}
}
import SwiftUI
struct ContentView: View {
@EnvironmentObject var appState: AppState
var body: some View {
NavigationView {
VStack {
// TabView1()
tabsView