Skip to content

Commit

Permalink
rm firebase_core to avoid compile error #9614
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy committed Jun 22, 2023
1 parent b5b68fe commit 413620e
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 276 deletions.
15 changes: 6 additions & 9 deletions lib/demos/reference/two_pane_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'dart:ui';
import 'package:dual_screen/dual_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';

Expand Down Expand Up @@ -50,9 +49,7 @@ class TwoPaneDemoState extends State<TwoPaneDemo> with RestorationMixin {
Widget build(BuildContext context) {
var panePriority = TwoPanePriority.both;
if (widget.type == TwoPaneDemoType.smallScreen) {
panePriority = _currentIndex.value == -1
? TwoPanePriority.start
: TwoPanePriority.end;
panePriority = _currentIndex.value == -1 ? TwoPanePriority.start : TwoPanePriority.end;
}
return SimulateScreen(
type: widget.type,
Expand Down Expand Up @@ -139,9 +136,7 @@ class DetailsPane extends StatelessWidget {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
leading: onClose == null
? null
: IconButton(icon: const Icon(Icons.close), onPressed: onClose),
leading: onClose == null ? null : IconButton(icon: const Icon(Icons.close), onPressed: onClose),
title: Text(
GalleryLocalizations.of(context)!.demoTwoPaneDetails,
),
Expand All @@ -152,8 +147,7 @@ class DetailsPane extends StatelessWidget {
child: Text(
selectedIndex == -1
? GalleryLocalizations.of(context)!.demoTwoPaneSelectItem
: GalleryLocalizations.of(context)!
.demoTwoPaneItemDetails(selectedIndex),
: GalleryLocalizations.of(context)!.demoTwoPaneItemDetails(selectedIndex),
),
),
),
Expand All @@ -173,10 +167,13 @@ class SimulateScreen extends StatelessWidget {

// An approximation of a real foldable
static const double foldableAspectRatio = 20 / 18;

// 16x9 candy bar phone
static const double singleScreenAspectRatio = 9 / 16;

// Taller desktop / tablet
static const double tabletAspectRatio = 4 / 3;

// How wide should the hinge be, as a proportion of total width
static const double hingeProportion = 1 / 35;

Expand Down
123 changes: 60 additions & 63 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
Expand All @@ -15,64 +12,64 @@ import 'package:flutter/foundation.dart'
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyBgs8LleVNsfC3om5Z86En1ec6yGOrOakM',
appId: '1:934901241041:web:abc1f7902dfa1d06e621f0',
messagingSenderId: '934901241041',
projectId: 'gallery-flutter-dev',
authDomain: 'gallery-flutter-dev.firebaseapp.com',
databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
storageBucket: 'gallery-flutter-dev.appspot.com',
measurementId: 'G-HBB5H8CECM',
);

static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyCX61HWVIf6k2XZYk43DxWAqE2tp9kwmEY',
appId: '1:934901241041:android:d393674f33a48678e621f0',
messagingSenderId: '934901241041',
projectId: 'gallery-flutter-dev',
databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
storageBucket: 'gallery-flutter-dev.appspot.com',
);

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyDMJsEYAcKIwBUajVyLlaQ1Z7xAQabZTjo',
appId: '1:934901241041:ios:8d4c8bde3db3391fe621f0',
messagingSenderId: '934901241041',
projectId: 'gallery-flutter-dev',
databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
storageBucket: 'gallery-flutter-dev.appspot.com',
iosBundleId: 'io.flutter.demo.gallery',
);
// static FirebaseOptions get currentPlatform {
// if (kIsWeb) {
// return web;
// }
// switch (defaultTargetPlatform) {
// case TargetPlatform.android:
// return android;
// case TargetPlatform.iOS:
// return ios;
// case TargetPlatform.macOS:
// throw UnsupportedError(
// 'DefaultFirebaseOptions have not been configured for macos - '
// 'you can reconfigure this by running the FlutterFire CLI again.',
// );
// case TargetPlatform.windows:
// throw UnsupportedError(
// 'DefaultFirebaseOptions have not been configured for windows - '
// 'you can reconfigure this by running the FlutterFire CLI again.',
// );
// case TargetPlatform.linux:
// throw UnsupportedError(
// 'DefaultFirebaseOptions have not been configured for linux - '
// 'you can reconfigure this by running the FlutterFire CLI again.',
// );
// default:
// throw UnsupportedError(
// 'DefaultFirebaseOptions are not supported for this platform.',
// );
// }
// }
//
// static const FirebaseOptions web = FirebaseOptions(
// apiKey: 'AIzaSyBgs8LleVNsfC3om5Z86En1ec6yGOrOakM',
// appId: '1:934901241041:web:abc1f7902dfa1d06e621f0',
// messagingSenderId: '934901241041',
// projectId: 'gallery-flutter-dev',
// authDomain: 'gallery-flutter-dev.firebaseapp.com',
// databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
// storageBucket: 'gallery-flutter-dev.appspot.com',
// measurementId: 'G-HBB5H8CECM',
// );
//
// static const FirebaseOptions android = FirebaseOptions(
// apiKey: 'AIzaSyCX61HWVIf6k2XZYk43DxWAqE2tp9kwmEY',
// appId: '1:934901241041:android:d393674f33a48678e621f0',
// messagingSenderId: '934901241041',
// projectId: 'gallery-flutter-dev',
// databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
// storageBucket: 'gallery-flutter-dev.appspot.com',
// );
//
// static const FirebaseOptions ios = FirebaseOptions(
// apiKey: 'AIzaSyDMJsEYAcKIwBUajVyLlaQ1Z7xAQabZTjo',
// appId: '1:934901241041:ios:8d4c8bde3db3391fe621f0',
// messagingSenderId: '934901241041',
// projectId: 'gallery-flutter-dev',
// databaseURL: 'https://gallery-flutter-dev.firebaseio.com',
// storageBucket: 'gallery-flutter-dev.appspot.com',
// iosBundleId: 'io.flutter.demo.gallery',
// );
}
4 changes: 1 addition & 3 deletions lib/layout/adaptive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'package:adaptive_breakpoints/adaptive_breakpoints.dart';
import 'package:dual_screen/dual_screen.dart';
import 'package:flutter/material.dart';

/// The maximum width taken up by each item on the home screen.
Expand All @@ -18,8 +17,7 @@ const maxHomeItemWidth = 1400.0;
///
/// Used to build adaptive and responsive layouts.
bool isDisplayDesktop(BuildContext context) =>
!isDisplayFoldable(context) &&
getWindowType(context) >= AdaptiveWindowType.medium;
!isDisplayFoldable(context) && getWindowType(context) >= AdaptiveWindowType.medium;

/// Returns boolean value whether the window is considered medium size.
///
Expand Down
9 changes: 3 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:dual_screen/dual_screen.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';
Expand All @@ -20,7 +18,6 @@ import 'package:get_storage/get_storage.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:screen_recorder/screen_recorder.dart';

import 'firebase_options.dart';
import 'layout/adaptive.dart';

export 'package:gallery/data/demos.dart' show pumpDeferredLibraries;
Expand All @@ -33,9 +30,9 @@ void main() async {
defaultTargetPlatform != TargetPlatform.windows &&
defaultTargetPlatform != TargetPlatform.macOS) {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
// await Firebase.initializeApp(
// options: DefaultFirebaseOptions.currentPlatform,
// );
FlutterError.onError = (errorDetails) {
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
};
Expand Down
Loading

0 comments on commit 413620e

Please sign in to comment.