Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
champ96k committed Apr 15, 2022
0 parents commit 907bf87
Show file tree
Hide file tree
Showing 208 changed files with 12,082 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://www.dartlang.org/guides/libraries/private-files

# Files and directories created by pub
.dart_tool/
.packages
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock

# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/

# dotenv environment variables file
.env*

# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map

.flutter-plugins
.flutter-plugins-dependencies
93 changes: 93 additions & 0 deletions .history/lib/main_20220415093347.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import 'dart:async';

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:navigation_history_observer/navigation_history_observer.dart';
import 'package:ui_color_picker_web/material_page_home.dart';
import 'package:ui_color_picker_web/src/error_screen.dart';
import 'package:ui_color_picker_web/src/splash_screen.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
runZonedGuarded(
() =>
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((value) => runApp(const App())), (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace);
});
}

class App extends StatefulWidget {
const App({Key key}) : super(key: key);

_AppState createState() => _AppState();
}

class _AppState extends State<App> {
static FirebaseAnalytics analytics = FirebaseAnalytics();
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);

// Set default `_initialized` and `_error` state to false
bool _initialized = false;
bool _error = false;

// Define an async function to initialize FlutterFire
void initializeFlutterFire() async {
try {
// Wait for Firebase to initialize and set `_initialized` state to true
await Firebase.initializeApp();

setState(() {
_initialized = true;
});
await _initCrashlytics();
} on Exception catch (_) {
// Set `_error` state to true if Firebase initialization fails
setState(() {
_error = true;
});
}
}

Future _initCrashlytics() async {
if (kDebugMode) {
// Force enable crashlytics collection enabled if we’re testing it.
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(false);
}
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
}

@override
void initState() {
super.initState();
initializeFlutterFire();
}

@override
Widget build(BuildContext context) {
// Show error message if initialization failed
if (_error) {
return ErrorScreen();
}

// Show a loader until FlutterFire is initialized
if (!_initialized) {
return const SplashScreen();
} else {
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorObservers: <NavigatorObserver>[
observer,
NavigationHistoryObserver()
],
home: MaterialPageHome(),
);
}
}
}
91 changes: 91 additions & 0 deletions .history/lib/main_20220415093457.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import 'dart:async';

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:navigation_history_observer/navigation_history_observer.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
runZonedGuarded(
() =>
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((value) => runApp(const App())), (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace);
});
}

class App extends StatefulWidget {
const App({Key key}) : super(key: key);

@override
_AppState createState() => _AppState();
}

class _AppState extends State<App> {
static FirebaseAnalytics analytics = FirebaseAnalytics();
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);

// Set default `_initialized` and `_error` state to false
bool _initialized = false;
bool _error = false;

// Define an async function to initialize FlutterFire
void initializeFlutterFire() async {
try {
// Wait for Firebase to initialize and set `_initialized` state to true
await Firebase.initializeApp();

setState(() {
_initialized = true;
});
await _initCrashlytics();
} on Exception catch (_) {
// Set `_error` state to true if Firebase initialization fails
setState(() {
_error = true;
});
}
}

Future _initCrashlytics() async {
if (kDebugMode) {
// Force enable crashlytics collection enabled if we’re testing it.
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(false);
}
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
}

@override
void initState() {
super.initState();
initializeFlutterFire();
}

@override
Widget build(BuildContext context) {
// Show error message if initialization failed
if (_error) {
return ErrorScreen();
}

// Show a loader until FlutterFire is initialized
if (!_initialized) {
return const SplashScreen();
} else {
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorObservers: <NavigatorObserver>[
observer,
NavigationHistoryObserver()
],
home: MaterialPageHome(),
);
}
}
}
91 changes: 91 additions & 0 deletions .history/lib/main_20220415093505.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import 'dart:async';

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:navigation_history_observer/navigation_history_observer.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
runZonedGuarded(
() =>
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((value) => runApp(const App())), (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace);
});
}

class App extends StatefulWidget {
const App({Key key}) : super(key: key);

@override
_AppState createState() => _AppState();
}

class _AppState extends State<App> {
static FirebaseAnalytics analytics = FirebaseAnalytics();
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);

// Set default `_initialized` and `_error` state to false
bool _initialized = false;
bool _error = false;

// Define an async function to initialize FlutterFire
void initializeFlutterFire() async {
try {
// Wait for Firebase to initialize and set `_initialized` state to true
await Firebase.initializeApp();

setState(() {
_initialized = true;
});
await _initCrashlytics();
} on Exception catch (_) {
// Set `_error` state to true if Firebase initialization fails
setState(() {
_error = true;
});
}
}

Future _initCrashlytics() async {
if (kDebugMode) {
// Force enable crashlytics collection enabled if we’re testing it.
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(false);
}
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
}

@override
void initState() {
super.initState();
initializeFlutterFire();
}

@override
Widget build(BuildContext context) {
// Show error message if initialization failed
if (_error) {
return ErrorScreen();
}

// Show a loader until FlutterFire is initialized
if (!_initialized) {
return const SplashScreen();
} else {
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorObservers: <NavigatorObserver>[
observer,
NavigationHistoryObserver()
],
home: MaterialPageHome(),
);
}
}
}
Loading

0 comments on commit 907bf87

Please sign in to comment.