Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Firebase Dependencies #197

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
.DS_Store
.dart_tool/

.flutter-plugins
.flutter-plugins-dependencies

.packages
.pub/
pubspec.lock

build/

28 changes: 14 additions & 14 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:name="${applicationName}"
android:label="geoflutterfire_example"
android:icon="@mipmap/ic_launcher">
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<!-- TODO: Add your Google Map API Key -->
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
android:value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package com.noeatsleepdev.geoflutterfireexample

import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}
16 changes: 13 additions & 3 deletions example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.

This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
26 changes: 14 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ import 'streambuilder_test.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(
runApp(const MaterialApp(
title: 'Geo Flutter Fire example',
home: MyApp(),
debugShowCheckedModeBanner: false,
));
}

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

@override
_MyAppState createState() => _MyAppState();
MyAppState createState() => MyAppState();
}

class _MyAppState extends State<MyApp> {
class MyAppState extends State<MyApp> {
GoogleMapController? _mapController;
TextEditingController? _latitudeController, _longitudeController;

Expand Down Expand Up @@ -82,7 +84,7 @@ class _MyAppState extends State<MyApp> {
: () {
_showHome();
},
icon: Icon(Icons.home),
icon: const Icon(Icons.home),
)
],
),
Expand All @@ -92,7 +94,7 @@ class _MyAppState extends State<MyApp> {
return StreamTestWidget();
}));
},
child: Icon(Icons.navigate_next),
child: const Icon(Icons.navigate_next),
),
body: Container(
child: Column(
Expand All @@ -101,7 +103,7 @@ class _MyAppState extends State<MyApp> {
Center(
child: Card(
elevation: 4,
margin: EdgeInsets.symmetric(vertical: 8),
margin: const EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
width: mediaQuery.size.width - 30,
height: mediaQuery.size.height * (1 / 3),
Expand Down Expand Up @@ -132,7 +134,7 @@ class _MyAppState extends State<MyApp> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
SizedBox(
width: 100,
child: TextField(
controller: _latitudeController,
Expand All @@ -145,7 +147,7 @@ class _MyAppState extends State<MyApp> {
)),
),
),
Container(
SizedBox(
width: 100,
child: TextField(
controller: _longitudeController,
Expand Down Expand Up @@ -236,23 +238,23 @@ class _MyAppState extends State<MyApp> {

void _addMarker(double lat, double lng) {
final id = MarkerId(lat.toString() + lng.toString());
final _marker = Marker(
final marker = Marker(
markerId: id,
position: LatLng(lat, lng),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueViolet),
infoWindow: InfoWindow(title: 'latLng', snippet: '$lat,$lng'),
);
setState(() {
markers[id] = _marker;
markers[id] = marker;
});
}

void _updateMarkers(List<DocumentSnapshot> documentList) {
documentList.forEach((DocumentSnapshot document) {
for (var document in documentList) {
final data = document.data() as Map<String, dynamic>;
final GeoPoint point = data['position']['geopoint'];
_addMarker(point.latitude, point.longitude);
});
}
}

double _value = 20.0;
Expand Down
6 changes: 4 additions & 2 deletions example/lib/streambuilder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class _StreamTestWidgetState extends State<StreamTestWidget> {
if (snapshots.connectionState == ConnectionState.active &&
snapshots.hasData) {
print('data ${snapshots.data}');
return Container(
return SizedBox(
height: MediaQuery.of(context).size.height * 2 / 3,
child: ListView.builder(
itemBuilder: (context, index) {
Expand All @@ -57,7 +57,9 @@ class _StreamTestWidgetState extends State<StreamTestWidget> {
),
subtitle: Text('${point.latitude}, ${point.longitude}'),
trailing: Text(
'${data['documentType'] == DocumentChangeType.added ? 'Added' : 'Modified'}'),
data['documentType'] == DocumentChangeType.added
? 'Added'
: 'Modified'),
);
},
itemCount: snapshots.data!.length,
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the geoflutterfire plugin.
publish_to: "none"

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
Expand All @@ -20,8 +20,8 @@ dev_dependencies:
geoflutterfire:
path: ../

cloud_firestore: ^3.1.6
google_maps_flutter: ^2.1.1
cloud_firestore: ^4.0.2
google_maps_flutter: ^2.2.1

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
Expand Down
9 changes: 5 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ version: 3.0.3
homepage: https://github.com/DarshanGowda0/GeoFlutterFire

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.12.0"

dependencies:
flutter:
sdk: flutter
cloud_firestore: ^3.1.6
rxdart: ^0.27.3
flutter_lints: ^1.0.0
cloud_firestore: ^4.0.2
rxdart: ^0.27.5

dev_dependencies:
flutter_test:
sdk: flutter

flutter_lints: ^2.0.1