-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 907bf87
Showing
208 changed files
with
12,082 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.