diff --git a/android/app/build.gradle b/android/app/build.gradle
index 26178e4..437fd9e 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+ throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
@@ -19,7 +19,7 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
- compileSdkVersion 27
+ compileSdkVersion 30
lintOptions {
disable 'InvalidPackage'
@@ -29,7 +29,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.comunes.fires"
minSdkVersion 16
- targetSdkVersion 27
+ targetSdkVersion 30
versionCode 9
versionName "1.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -78,7 +78,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
- implementation 'com.google.firebase:firebase-core:15.0.2'
+ // implementation 'com.google.firebase:firebase-core:15.0.2'
// google recommends 16 but fails because location flutter package deps in 15
}
diff --git a/android/app/src/main/java/org/comunes/fires/MainActivity.java b/android/app/src/main/java/org/comunes/fires/MainActivity.java
index 0caf39c..1d51087 100644
--- a/android/app/src/main/java/org/comunes/fires/MainActivity.java
+++ b/android/app/src/main/java/org/comunes/fires/MainActivity.java
@@ -1,14 +1,6 @@
package org.comunes.fires;
-import android.os.Bundle;
-
-import io.flutter.app.FlutterActivity;
-import io.flutter.plugins.GeneratedPluginRegistrant;
+import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- GeneratedPluginRegistrant.registerWith(this);
- }
}
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index 00fa441..af831f5 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -5,4 +5,8 @@
Flutter draws its first frame -->
- @drawable/launch_background
+
+
diff --git a/android/build.gradle b/android/build.gradle
index abea04c..7013083 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -5,8 +5,8 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
- classpath 'com.google.gms:google-services:4.0.1'
+ classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath 'com.google.gms:google-services:4.3.4'
}
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 8bd86f6..94adc3a 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index aa901e1..bc6a58a 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/build.yaml b/build.yaml
index 3c7137f..c1992bf 100644
--- a/build.yaml
+++ b/build.yaml
@@ -9,11 +9,9 @@ targets:
# defined in `package:source_gen/source_gen.dart`.
#
# Note: use `|` to define a multi-line block.
- header: |
- // Copyright (c) 2018, Comunes Association.
-
- // GENERATED CODE - DO NOT MODIFY BY HAND
-
+ # header: |
+ # // Copyright (c) 2018, Comunes Association.
+ # // GENERATED CODE - DO NOT MODIFY BY HAND
# Options configure how source code is generated for every
# `@JsonSerializable`-annotated class in the package.
#
@@ -21,8 +19,9 @@ targets:
#
# For usage information, reference the corresponding field in
# `JsonSerializableGenerator`.
- use_wrappers: true
+ #use_wrappers: true
any_map: true
checked: true
explicit_to_json: true
- generate_to_json_function: true
+ #generate_to_json_function: true
+ create_to_json: true
diff --git a/lib/activeFires.dart b/lib/activeFires.dart
index f440a44..5ae2871 100644
--- a/lib/activeFires.dart
+++ b/lib/activeFires.dart
@@ -5,7 +5,7 @@ import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_fab_dialer/flutter_fab_dialer.dart';
import 'package:flutter_redux/flutter_redux.dart';
-import 'package:redux/src/store.dart';
+import 'package:redux/redux.dart';
import 'colors.dart';
import 'firesSpinner.dart';
@@ -91,7 +91,7 @@ class _ActiveFiresPageState extends State {
icon: new Icon(loc.subscribed
? Icons.notifications_active
: Icons.notifications_off),
- color: loc.subscribed ? fires600: null,
+ color: loc.subscribed ? fires600 : null,
onPressed: () {
loc.subscribed = !loc.subscribed;
onToggle(loc);
@@ -125,7 +125,8 @@ class _ActiveFiresPageState extends State {
}
void showSnackMsg(String msg) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ // _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(msg),
));
}
@@ -183,7 +184,7 @@ class _ActiveFiresPageState extends State {
},
onDelete: (loc) {
store.dispatch(new DeleteYourLocationAction(loc));
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(S.of(context).youDeletedThisPlace),
action: new SnackBarAction(
label: S.of(context).UNDO,
@@ -242,6 +243,7 @@ class _ActiveFiresPageState extends State {
view.onRefresh(completer);
return completer.future;
}),
+ // TODO: Evaluate: https://github.com/tiagojencmartins/unicornspeeddial
new FabDialer(_fabMiniMenuItemList(context, view.onAdd),
fires600, new Icon(Icons.add))
])
diff --git a/lib/attributionMapPlugin.dart b/lib/attributionMapPlugin.dart
index a33b457..b10534a 100644
--- a/lib/attributionMapPlugin.dart
+++ b/lib/attributionMapPlugin.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_map/plugin_api.dart';
class AttributionPluginOptions extends LayerOptions {
@@ -10,7 +9,8 @@ class AttributionPluginOptions extends LayerOptions {
class AttributionPlugin implements MapPlugin {
@override
- Widget createLayer(LayerOptions options, MapState mapState) {
+ Widget createLayer(
+ LayerOptions options, MapState mapState, Stream stream) {
if (options is AttributionPluginOptions) {
var style = new TextStyle(
// fontWeight: FontWeight.bold,
diff --git a/lib/customBottomAppBar.dart b/lib/customBottomAppBar.dart
index 162a433..48fa5a7 100644
--- a/lib/customBottomAppBar.dart
+++ b/lib/customBottomAppBar.dart
@@ -34,12 +34,17 @@ class CustomBottomAppBar extends StatelessWidget {
rowContents.addAll(this.actions);
- return new BottomAppBar(
- color: color,
- hasNotch: showNotch,
- child: new Row(
- mainAxisAlignment: mainAxisAlignment,
- children: rowContents),
- );
+ return showNotch
+ ? new BottomAppBar(
+ color: color,
+ shape: CircularNotchedRectangle(),
+ child: new Row(
+ mainAxisAlignment: mainAxisAlignment, children: rowContents),
+ )
+ : new BottomAppBar(
+ color: color,
+ child: new Row(
+ mainAxisAlignment: mainAxisAlignment, children: rowContents),
+ );
}
}
diff --git a/lib/customStepper.dart b/lib/customStepper.dart
index 5d0c3fd..4fafac3 100644
--- a/lib/customStepper.dart
+++ b/lib/customStepper.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
-
// TODO(dragostis): Missing functionality:
// * mobile horizontal mode with adding/removing steps
// * alternative labeling
@@ -53,7 +52,8 @@ const Color _kCircleActiveDark = Colors.black87;
const Color _kDisabledLight = Colors.black38;
const Color _kDisabledDark = Colors.white30;
const double _kCustomStepSize = 24.0;
-const double _kTriangleHeight = _kCustomStepSize * 0.866025; // Triangle height. sqrt(3.0) / 2.0
+const double _kTriangleHeight =
+ _kCustomStepSize * 0.866025; // Triangle height. sqrt(3.0) / 2.0
/// A material step used in [CustomStepper]. The step can have a title and subtitle,
/// an icon within its circle, some content and a state that governs its
@@ -75,9 +75,9 @@ class CustomStep {
@required this.content,
this.state: CustomStepState.indexed,
this.isActive: false,
- }) : assert(title != null),
- assert(content != null),
- assert(state != null);
+ }) : assert(title != null),
+ assert(content != null),
+ assert(state != null);
/// The title of the step that typically describes it.
final Widget title;
@@ -130,11 +130,11 @@ class CustomStepper extends StatefulWidget {
this.onCustomStepTapped,
this.onCustomStepContinue,
this.onCustomStepCancel,
- }) : assert(steps != null),
- assert(type != null),
- assert(currentCustomStep != null),
- assert(0 <= currentCustomStep && currentCustomStep < steps.length),
- super(key: key);
+ }) : assert(steps != null),
+ assert(type != null),
+ assert(currentCustomStep != null),
+ assert(0 <= currentCustomStep && currentCustomStep < steps.length),
+ super(key: key);
/// The steps of the stepper whose titles, subtitles, icons always get shown.
///
@@ -177,7 +177,7 @@ class _CustomStepperState extends State {
super.initState();
_keys = new List.generate(
widget.steps.length,
- (int i) => new GlobalKey(),
+ (int i) => new GlobalKey(),
);
for (int i = 0; i < widget.steps.length; i += 1)
@@ -218,7 +218,8 @@ class _CustomStepperState extends State {
}
Widget _buildCircleChild(int index, bool oldState) {
- final CustomStepState state = oldState ? _oldStates[index] : widget.steps[index].state;
+ final CustomStepState state =
+ oldState ? _oldStates[index] : widget.steps[index].state;
final bool isDarkActive = _isDark() && widget.steps[index].isActive;
assert(state != null);
switch (state) {
@@ -226,7 +227,9 @@ class _CustomStepperState extends State {
case CustomStepState.disabled:
return new Text(
'${index + 1}',
- style: isDarkActive ? _kCustomStepStyle.copyWith(color: Colors.black87) : _kCustomStepStyle,
+ style: isDarkActive
+ ? _kCustomStepStyle.copyWith(color: Colors.black87)
+ : _kCustomStepStyle,
);
case CustomStepState.editing:
return new Icon(
@@ -247,9 +250,13 @@ class _CustomStepperState extends State {
Color _circleColor(int index) {
final ThemeData themeData = Theme.of(context);
if (!_isDark()) {
- return widget.steps[index].isActive ? themeData.primaryColor : Colors.black38;
+ return widget.steps[index].isActive
+ ? themeData.primaryColor
+ : Colors.black38;
} else {
- return widget.steps[index].isActive ? themeData.accentColor : themeData.backgroundColor;
+ return widget.steps[index].isActive
+ ? themeData.accentColor
+ : themeData.backgroundColor;
}
}
@@ -266,7 +273,8 @@ class _CustomStepperState extends State {
shape: BoxShape.circle,
),
child: new Center(
- child: _buildCircleChild(index, oldState && widget.steps[index].state == CustomStepState.error),
+ child: _buildCircleChild(index,
+ oldState && widget.steps[index].state == CustomStepState.error),
),
),
);
@@ -280,14 +288,19 @@ class _CustomStepperState extends State {
child: new Center(
child: new SizedBox(
width: _kCustomStepSize,
- height: _kTriangleHeight, // Height of 24dp-long-sided equilateral triangle.
+ height:
+ _kTriangleHeight, // Height of 24dp-long-sided equilateral triangle.
child: new CustomPaint(
painter: new _TrianglePainter(
color: _isDark() ? _kErrorDark : _kErrorLight,
),
child: new Align(
- alignment: const Alignment(0.0, 0.8), // 0.8 looks better than the geometrical 0.33.
- child: _buildCircleChild(index, oldState && widget.steps[index].state != CustomStepState.error),
+ alignment: const Alignment(
+ 0.0, 0.8), // 0.8 looks better than the geometrical 0.33.
+ child: _buildCircleChild(
+ index,
+ oldState &&
+ widget.steps[index].state != CustomStepState.error),
),
),
),
@@ -303,7 +316,9 @@ class _CustomStepperState extends State {
firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn,
- crossFadeState: widget.steps[index].state == CustomStepState.error ? CrossFadeState.showSecond : CrossFadeState.showFirst,
+ crossFadeState: widget.steps[index].state == CustomStepState.error
+ ? CrossFadeState.showSecond
+ : CrossFadeState.showFirst,
duration: kThemeAnimationDuration,
);
} else {
@@ -328,8 +343,9 @@ class _CustomStepperState extends State {
assert(cancelColor != null);
- final ThemeData themeData = Theme.of(context);
- final MaterialLocalizations localizations = MaterialLocalizations.of(context);
+ // final ThemeData themeData = Theme.of(context);
+ // final MaterialLocalizations localizations =
+ // MaterialLocalizations.of(context);
return new Container(
margin: const EdgeInsets.only(top: 16.0),
@@ -368,15 +384,13 @@ class _CustomStepperState extends State {
case CustomStepState.indexed:
case CustomStepState.editing:
case CustomStepState.complete:
- return textTheme.body2;
+ return textTheme.bodyText1;
case CustomStepState.disabled:
- return textTheme.body2.copyWith(
- color: _isDark() ? _kDisabledDark : _kDisabledLight
- );
+ return textTheme.bodyText1
+ .copyWith(color: _isDark() ? _kDisabledDark : _kDisabledLight);
case CustomStepState.error:
- return textTheme.body2.copyWith(
- color: _isDark() ? _kErrorDark : _kErrorLight
- );
+ return textTheme.bodyText1
+ .copyWith(color: _isDark() ? _kErrorDark : _kErrorLight);
}
return null;
}
@@ -392,13 +406,11 @@ class _CustomStepperState extends State {
case CustomStepState.complete:
return textTheme.caption;
case CustomStepState.disabled:
- return textTheme.caption.copyWith(
- color: _isDark() ? _kDisabledDark : _kDisabledLight
- );
+ return textTheme.caption
+ .copyWith(color: _isDark() ? _kDisabledDark : _kDisabledLight);
case CustomStepState.error:
- return textTheme.caption.copyWith(
- color: _isDark() ? _kErrorDark : _kErrorLight
- );
+ return textTheme.caption
+ .copyWith(color: _isDark() ? _kErrorDark : _kErrorLight);
}
return null;
}
@@ -427,33 +439,26 @@ class _CustomStepperState extends State {
);
return new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: children
- );
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: children);
}
Widget _buildVerticalHeader(int index) {
return new Container(
- margin: const EdgeInsets.symmetric(horizontal: 24.0),
- child: new Row(
- children: [
- new Column(
- children: [
- // Line parts are always added in order for the ink splash to
- // flood the tips of the connector lines.
- _buildLine(!_isFirst(index)),
- _buildIcon(index),
- _buildLine(!_isLast(index)),
- ]
- ),
+ margin: const EdgeInsets.symmetric(horizontal: 24.0),
+ child: new Row(children: [
+ new Column(children: [
+ // Line parts are always added in order for the ink splash to
+ // flood the tips of the connector lines.
+ _buildLine(!_isFirst(index)),
+ _buildIcon(index),
+ _buildLine(!_isLast(index)),
+ ]),
new Container(
- margin: const EdgeInsetsDirectional.only(start: 12.0),
- child: _buildHeaderText(index)
- )
- ]
- )
- );
+ margin: const EdgeInsetsDirectional.only(start: 12.0),
+ child: _buildHeaderText(index))
+ ]));
}
Widget _buildVerticalBody(int index) {
@@ -493,7 +498,9 @@ class _CustomStepperState extends State {
firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
secondCurve: const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn,
- crossFadeState: _isCurrent(index) ? CrossFadeState.showSecond : CrossFadeState.showFirst,
+ crossFadeState: _isCurrent(index)
+ ? CrossFadeState.showSecond
+ : CrossFadeState.showFirst,
duration: kThemeAnimationDuration,
),
],
@@ -504,29 +511,25 @@ class _CustomStepperState extends State {
final List children = [];
for (int i = 0; i < widget.steps.length; i += 1) {
- children.add(
- new Column(
- key: _keys[i],
- children: [
- new InkWell(
- onTap: widget.steps[i].state != CustomStepState.disabled ? () {
- // In the vertical case we need to scroll to the newly tapped
- // step.
- Scrollable.ensureVisible(
- _keys[i].currentContext,
- curve: Curves.fastOutSlowIn,
- duration: kThemeAnimationDuration,
- );
+ children.add(new Column(key: _keys[i], children: [
+ new InkWell(
+ onTap: widget.steps[i].state != CustomStepState.disabled
+ ? () {
+ // In the vertical case we need to scroll to the newly tapped
+ // step.
+ Scrollable.ensureVisible(
+ _keys[i].currentContext,
+ curve: Curves.fastOutSlowIn,
+ duration: kThemeAnimationDuration,
+ );
- if (widget.onCustomStepTapped != null)
- widget.onCustomStepTapped(i);
- } : null,
- child: _buildVerticalHeader(i)
- ),
- _buildVerticalBody(i)
- ]
- )
- );
+ if (widget.onCustomStepTapped != null)
+ widget.onCustomStepTapped(i);
+ }
+ : null,
+ child: _buildVerticalHeader(i)),
+ _buildVerticalBody(i)
+ ]));
}
return new ListView(
@@ -541,10 +544,12 @@ class _CustomStepperState extends State {
for (int i = 0; i < widget.steps.length; i += 1) {
children.add(
new InkResponse(
- onTap: widget.steps[i].state != CustomStepState.disabled ? () {
- if (widget.onCustomStepTapped != null)
- widget.onCustomStepTapped(i);
- } : null,
+ onTap: widget.steps[i].state != CustomStepState.disabled
+ ? () {
+ if (widget.onCustomStepTapped != null)
+ widget.onCustomStepTapped(i);
+ }
+ : null,
child: new Row(
children: [
new Container(
@@ -593,7 +598,7 @@ class _CustomStepperState extends State {
new AnimatedSize(
curve: Curves.fastOutSlowIn,
duration: kThemeAnimationDuration,
- //vsync: this,
+ vsync: null,
child: widget.steps[widget.currentCustomStep].content,
),
_buildVerticalControls(),
@@ -608,12 +613,11 @@ class _CustomStepperState extends State {
Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context));
assert(() {
- if (context.ancestorWidgetOfExactType(CustomStepper) != null)
+ if (context.findAncestorWidgetOfExactType() != null)
throw new FlutterError(
- 'CustomSteppers must not be nested. The material specification advises '
+ 'CustomSteppers must not be nested. The material specification advises '
'that one should avoid embedding steppers within steppers. '
- 'https://material.google.com/components/steppers.html#steppers-usage\n'
- );
+ 'https://material.google.com/components/steppers.html#steppers-usage\n');
return true;
}());
assert(widget.type != null);
@@ -630,9 +634,7 @@ class _CustomStepperState extends State {
// Paints a triangle whose base is the bottom of the bounding rectangle and its
// top vertex the middle of its top.
class _TrianglePainter extends CustomPainter {
- _TrianglePainter({
- this.color
- });
+ _TrianglePainter({this.color});
final Color color;
diff --git a/lib/dummyMapPlugin.dart b/lib/dummyMapPlugin.dart
index 565d549..6a1df20 100644
--- a/lib/dummyMapPlugin.dart
+++ b/lib/dummyMapPlugin.dart
@@ -1,6 +1,5 @@
-import 'package:flutter/src/widgets/framework.dart';
-import 'package:flutter_map/plugin_api.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_map/plugin_api.dart';
class DummyMapPluginOptions extends LayerOptions {
final String text;
@@ -10,9 +9,9 @@ class DummyMapPluginOptions extends LayerOptions {
// https://github.com/apptreesoftware/flutter_map/blob/master/flutter_map_example/lib/pages/plugin_api.dart
class DummyMapPlugin extends MapPlugin {
-
@override
- Widget createLayer(LayerOptions options, MapState mapState) {
+ Widget createLayer(
+ LayerOptions options, MapState mapState, Stream stream) {
if (options is DummyMapPluginOptions) {
return const SizedBox();
}
diff --git a/lib/fileUtils.dart b/lib/fileUtils.dart
index 54a8151..8950bab 100644
--- a/lib/fileUtils.dart
+++ b/lib/fileUtils.dart
@@ -1,25 +1,34 @@
import 'dart:async';
+
import 'package:flutter/services.dart' show rootBundle;
import 'package:meta/meta.dart';
final esRegExp = new RegExp("^es-");
-String getFallbackLang(String lang) {
- if (lang == 'ast' || lang == 'gl' || lang == 'eu' ||
- lang == 'es' || lang == 'ca' || (esRegExp).allMatches(lang).length > 0) {
+String getFallbackLang(String lang) {
+ if (lang == 'ast' ||
+ lang == 'gl' ||
+ lang == 'eu' ||
+ lang == 'es' ||
+ lang == 'ca' ||
+ (esRegExp).allMatches(lang).length > 0) {
return 'es';
}
return 'en';
}
-Future getFileNameOfLang({@required String dir,@required String fileName,@required String ext,@required String lang}) async {
+Future getFileNameOfLang(
+ {@required String dir,
+ @required String fileName,
+ @required String ext,
+ @required String lang}) async {
String base = '$dir/$fileName';
String fallback = getFallbackLang(lang);
- String file = '${base}-${lang}.${ext}';
+ String file = '$base-$lang.$ext';
if (await assetNotExists(file)) {
- file = '${base}-${fallback}.${ext}';
+ file = '$base-$fallback.$ext';
if (await assetNotExists(file)) {
- file = '${base}.${ext}';
+ file = '$base.$ext';
}
}
return file;
@@ -28,5 +37,9 @@ Future getFileNameOfLang({@required String dir,@required String fileNam
// https://github.com/flutter/flutter/issues/15325
Future assetNotExists(String asset) {
print('Does not exists $asset ?');
- return rootBundle.load(asset).then((_) => false).catchError((err, stack) { print (err); print(stack); return true;});
-}
\ No newline at end of file
+ return rootBundle.load(asset).then((_) => false).catchError((err, stack) {
+ print(err);
+ print(stack);
+ return true;
+ });
+}
diff --git a/lib/fireAlert.dart b/lib/fireAlert.dart
index 3fd2322..87bb76b 100644
--- a/lib/fireAlert.dart
+++ b/lib/fireAlert.dart
@@ -3,10 +3,10 @@ import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:share/share.dart';
import 'package:url_launcher/url_launcher.dart';
-import 'customStepper.dart';
-import 'mainDrawer.dart';
+import 'customStepper.dart';
import 'generated/i18n.dart';
+import 'mainDrawer.dart';
import 'placesAutocompleteUtils.dart';
class FireAlert extends StatefulWidget {
@@ -40,7 +40,7 @@ class _FireAlertState extends State {
heroTag: 'neighAction',
child: const Icon(CommunityMaterialIcons.bullhorn),
onPressed: () {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(S.of(context).inDevelopment),
));
},
@@ -48,7 +48,6 @@ class _FireAlertState extends State {
);
}
-
Widget buildTweetButton() {
return new Align(
alignment: const Alignment(0.0, -0.2),
@@ -62,9 +61,11 @@ class _FireAlertState extends State {
String where =
yourLocation.description.replaceAll(' ', '').split(',')[0];
print(where);
- Share.share(S.of(context).tweetAboutSelf(yourLocation.description, '#IF${where}'));
+ Share.share(S
+ .of(context)
+ .tweetAboutSelf(yourLocation.description, '#IF$where'));
}).catchError((onError) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(
S.of(_scaffoldKey.currentContext).errorFirePlaceDialog)));
});
@@ -87,13 +88,13 @@ class _FireAlertState extends State {
buildCallButton()
])),
new CustomStep(
- title: new Text(S.of(context).notifyNeighbours),
- // state: CustomStepState.disabled,
- content: new Column(children: [
- new Text(S.of(context).notifyNeighboursDescription),
- new SizedBox(height: 20.0),
- buildNotifyNeighboursButton()
- ])),
+ title: new Text(S.of(context).notifyNeighbours),
+ // state: CustomStepState.disabled,
+ content: new Column(children: [
+ new Text(S.of(context).notifyNeighboursDescription),
+ new SizedBox(height: 20.0),
+ buildNotifyNeighboursButton()
+ ])),
// TODO conditional: this only in Spain
new CustomStep(
title: new Text(S.of(context).tweetAboutAFireTitle),
diff --git a/lib/fireMarker.dart b/lib/fireMarker.dart
index a11092b..df4f584 100644
--- a/lib/fireMarker.dart
+++ b/lib/fireMarker.dart
@@ -2,30 +2,33 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:latlong/latlong.dart';
-import 'fireMarkerIcon.dart';
+
import 'fireMarkType.dart';
+import 'fireMarkerIcon.dart';
class FireMarker extends Marker {
-
FireMarker(LatLng pos, type,
- [onTap = null, AnchorPos anchor = AnchorPos.center, Anchor anchorOverride])
+ [onTap,
+ // AnchorPos anchor = AnchorPos.center,
+ Anchor anchorOverride])
: super(
width: 80.0,
height: 80.0,
point: pos,
builder: (ctx) => new Container(
- child: new GestureDetector(
- child: new FireMarkerIcon(type), onTap: onTap)
- ),
- anchor: anchor,
- anchorOverride: anchorOverride ?? type == FireMarkType.position
- ? new Anchor(40.0, 20.0)
+ child: new GestureDetector(
+ child: new FireMarkerIcon(type), onTap: onTap)),
+ // anchor: anchor,
+ anchorPos: anchorOverride ?? type == FireMarkType.position
+ ? AnchorPos.exactly(new Anchor(40.0, 20.0))
: type == FireMarkType.fire
- ? new Anchor(40.0, 24.0)
+ ? AnchorPos.exactly(new Anchor(40.0, 24.0))
: type == FireMarkType.pixel
? null // auto calculate with height/width in Marker
// industries, etc (below)
// FIXME check if this is accurate
- : new Anchor(40.0, 35.0),
- );
+ : AnchorPos.exactly(new Anchor(40.0, 35.0)),
+ ) {
+ // anchor = anchorOverride;
+ }
}
diff --git a/lib/fireNotificationList.dart b/lib/fireNotificationList.dart
index da131e5..dfb5d6d 100644
--- a/lib/fireNotificationList.dart
+++ b/lib/fireNotificationList.dart
@@ -5,15 +5,15 @@ import 'package:fires_flutter/models/fireNotification.dart';
import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
-import 'package:redux/src/store.dart';
+import 'package:redux/redux.dart';
import 'customMoment.dart';
+import 'firesSpinner.dart';
import 'generated/i18n.dart';
import 'genericMap.dart';
import 'mainDrawer.dart';
import 'models/appState.dart';
import 'redux/actions.dart';
-import 'firesSpinner.dart';
@immutable
class _ViewModel {
@@ -76,7 +76,7 @@ class _FireNotificationListState extends State {
return new ListTile(
dense: true,
leading: const Icon(Icons.whatshot),
- title: new Text('${prefix}${notif.description}',
+ title: new Text('$prefix${notif.description}',
style: new TextStyle(
fontWeight: notif.read ? FontWeight.normal : FontWeight.bold)),
subtitle: new Text(Moment.now().from(context, notif.when)),
@@ -89,7 +89,7 @@ class _FireNotificationListState extends State {
}
void showSnackMsg(String msg) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(msg),
));
}
@@ -149,8 +149,8 @@ class _FireNotificationListState extends State {
return new StoreConnector(
distinct: true,
converter: (store) {
- print('New ViewModel of Fires Notifications (unread: ${store.state
- .fireNotificationsUnread})');
+ print(
+ 'New ViewModel of Fires Notifications (unread: ${store.state.fireNotificationsUnread})');
return new _ViewModel(
isLoaded: store.state.isLoaded,
onDeleteAll: () {
@@ -158,7 +158,7 @@ class _FireNotificationListState extends State {
},
onDelete: (notif) {
store.dispatch(new DeleteFireNotificationAction(notif));
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: new Text(S.of(context).youDeletedThisNotification),
action: new SnackBarAction(
label: S.of(context).UNDO,
@@ -202,25 +202,33 @@ class _FireNotificationListState extends State {
onPressed: () => _showConfirmDialog(view))
: null
])),
- body: !view.isLoaded ? new FiresSpinner() : !hasFireNotifications
- ? Padding(
- padding: const EdgeInsets.all(20.0),
- child: new Card(
- child: new Padding(
- padding: const EdgeInsets.all(20.0),
- child: new CenteredColumn(children: [
- new Icon(Icons.notifications_none,
- size: 150.0, color: Colors.black26),
- new SizedBox(height: 20.0),
- new Text(
- S.of(context).fireNotificationsDescription,
- textAlign: TextAlign.center,
- textScaleFactor: 1.1,
- style: new TextStyle(
- height: 1.3, color: Colors.black45))
- ]))))
- : _buildSavedFireNotifications(context, view.yourLocations,
- view.fireNotifications, view.onDelete, view.onTap));
+ body: !view.isLoaded
+ ? new FiresSpinner()
+ : !hasFireNotifications
+ ? Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: new Card(
+ child: new Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: new CenteredColumn(children: [
+ new Icon(Icons.notifications_none,
+ size: 150.0, color: Colors.black26),
+ new SizedBox(height: 20.0),
+ new Text(
+ S
+ .of(context)
+ .fireNotificationsDescription,
+ textAlign: TextAlign.center,
+ textScaleFactor: 1.1,
+ style: new TextStyle(
+ height: 1.3, color: Colors.black45))
+ ]))))
+ : _buildSavedFireNotifications(
+ context,
+ view.yourLocations,
+ view.fireNotifications,
+ view.onDelete,
+ view.onTap));
});
}
diff --git a/lib/firesApp.dart b/lib/firesApp.dart
index 5d0d4f2..4952e66 100644
--- a/lib/firesApp.dart
+++ b/lib/firesApp.dart
@@ -1,20 +1,18 @@
-
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
-import 'package:redux/src/store.dart';
-import 'globals.dart';
-import 'monitoredAreas.dart';
import 'activeFires.dart';
import 'fireAlert.dart';
import 'fireNotificationList.dart';
import 'generated/i18n.dart';
+import 'globals.dart';
import 'homePage.dart';
import 'introPage.dart';
import 'models/appState.dart';
+import 'monitoredAreas.dart';
import 'privacyPage.dart';
import 'redux/actions.dart';
import 'sandbox.dart';
@@ -47,16 +45,15 @@ class _FiresAppState extends State {
SupportPage.routeName: (BuildContext context) => new SupportPage(),
FireNotificationList.routeName: (BuildContext context) =>
new FireNotificationList(),
- MonitoredAreasPage.routeName: (BuildContext context) => new MonitoredAreasPage()
+ MonitoredAreasPage.routeName: (BuildContext context) =>
+ new MonitoredAreasPage()
};
final Store store;
-
// globals.getIt.registerSingleton
_FiresAppState(this.store);
-
@override
Widget build(BuildContext context) {
StatefulWidget home = new MaterialAppWithIntroHome(
@@ -82,7 +79,7 @@ class _FiresAppState extends State {
}
return S.of(context).appName;
},
- theme: isDevelopment? devFiresTheme: firesTheme,
+ theme: isDevelopment ? devFiresTheme : firesTheme,
routes: routes));
}
}
diff --git a/lib/genericMap.dart b/lib/genericMap.dart
index 7b74864..6f181ac 100644
--- a/lib/genericMap.dart
+++ b/lib/genericMap.dart
@@ -1,5 +1,5 @@
import 'dart:core';
-import 'locationUtils.dart';
+
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
@@ -11,6 +11,7 @@ import 'package:share/share.dart';
import 'attributionMapPlugin.dart';
import 'colors.dart';
+import 'customMoment.dart';
import 'dummyMapPlugin.dart';
import 'fireMarkType.dart';
import 'fireMarker.dart';
@@ -18,13 +19,13 @@ import 'generated/i18n.dart';
import 'genericMapBottom.dart';
import 'globals.dart' as globals;
import 'layerSelectorMapPlugin.dart';
+import 'locationUtils.dart';
import 'models/appState.dart';
import 'models/fireMapState.dart';
import 'redux/actions.dart';
import 'sentryReport.dart';
import 'slider.dart';
import 'zoomMapPlugin.dart';
-import 'customMoment.dart';
@immutable
class _ViewModel {
@@ -142,33 +143,34 @@ class _genericMapState extends State {
double maxZoom = 18.0; // works?
MapOptions mapOptions = new MapOptions(
- center: new LatLng(_location.lat, _location.lon),
- plugins: globals.isDevelopment
- ? [
- new ZoomMapPlugin(),
- new AttributionPlugin(),
- new LayerSelectorMapPlugin()
- ]
- : [
- new DummyMapPlugin(),
- new AttributionPlugin(),
- new LayerSelectorMapPlugin()
- ],
- // this works ?
- interactive: false,
- zoom: 13.0,
- // THIS does not works as expected
- maxZoom: maxZoom,
- onTap: (callback) {
- if (status == FireMapStatus.edit) {
- _location = _location.copyWith(
- lat: callback.latitude, lon: callback.longitude);
- view.onEditing(_location);
- }
- },
- onPositionChanged: (positionCallback) {
- // print('${positionCallback.center}, ${positionCallback.zoom}');
- });
+ center: new LatLng(_location.lat, _location.lon),
+ plugins: globals.isDevelopment
+ ? [
+ new ZoomMapPlugin(),
+ new AttributionPlugin(),
+ new LayerSelectorMapPlugin()
+ ]
+ : [
+ new DummyMapPlugin(),
+ new AttributionPlugin(),
+ new LayerSelectorMapPlugin()
+ ],
+ // this works ?
+ interactive: true,
+ zoom: 13.0,
+ // THIS does not works as expected
+ maxZoom: maxZoom,
+ onTap: (callback) {
+ if (status == FireMapStatus.edit) {
+ _location = _location.copyWith(
+ lat: callback.latitude, lon: callback.longitude);
+ view.onEditing(_location);
+ }
+ },
+ // onPositionChanged: (positionCallback) {
+ // print('${positionCallback.center}, ${positionCallback.zoom}');
+ //}
+ );
var mapController = new MapController();
// mapController.fitBounds(bounds);
@@ -312,7 +314,7 @@ class _genericMapState extends State {
}
},
// https://github.com/flutter/flutter/issues/17583
- heroTag: "firesmap" + _location.id.toHexString(),
+ heroTag: "firesmap" + _location.id.hexString,
icon: new Icon(btnIcon, color: fires600),
label: new Text(
btnText,
@@ -388,8 +390,7 @@ class _genericMapState extends State {
icon: new Icon(Icons.share),
onPressed: () {
Share.share(
- '${view.mapState.fireNotification.description}. ${view
- .serverUrl}fire/${view.mapState.fireNotification.sealed}');
+ '${view.mapState.fireNotification.description}. ${view.serverUrl}fire/${view.mapState.fireNotification.sealed}');
})
];
default:
@@ -405,14 +406,14 @@ class _genericMapState extends State {
bool isNotif,
OnFirePressedInMap onFirePressed) {
List markers = [];
- print('building markers: fires: ${fires.length} falsePos: ${falsePosList
- .length} industries: ${industries.length}, isNotif: ${isNotif} ');
+ print(
+ 'building markers: fires: ${fires.length} falsePos: ${falsePosList.length} industries: ${industries.length}, isNotif: $isNotif ');
const calibrate = false; // useful when we change the fire icons size
falsePosList.forEach((falsePos) {
try {
var coords = falsePos['geo']['coordinates'];
// print('false pos: ${coords}');
- var loc = LatLng(coords[1], coords[0]);
+ var loc = LatLng(coords[1].toDouble(), coords[0].toDouble());
markers.add(FireMarker(loc, FireMarkType.falsePos));
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
} catch (e) {
diff --git a/lib/genericMapBottom.dart b/lib/genericMapBottom.dart
index 9cd257c..8457687 100644
--- a/lib/genericMapBottom.dart
+++ b/lib/genericMapBottom.dart
@@ -1,8 +1,8 @@
import 'dart:async';
import 'package:comunes_flutter/comunes_flutter.dart';
-import 'package:fires_flutter/models/yourLocation.dart';
import 'package:fires_flutter/models/fireNotification.dart';
+import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
import 'colors.dart';
@@ -27,7 +27,7 @@ class GenericMapBottom extends StatelessWidget {
GenericMapBottom(
{@required this.onSave,
@required this.onCancel,
- @required this.onFalsePositive,
+ @required this.onFalsePositive,
@required this.state,
@required this.scaffoldKey});
@@ -45,7 +45,7 @@ class GenericMapBottom extends StatelessWidget {
List buildActionList(YourLocation loc, BuildContext context,
int kmAround, GlobalKey scaffoldState) {
- List actionList = new List();
+ List actionList = [];
switch (state.status) {
case FireMapStatus.edit:
actionList.add(new FlatButton(
@@ -74,8 +74,7 @@ class GenericMapBottom extends StatelessWidget {
children: [
new Icon(Icons.access_time),
new SizedBox(width: 5.0),
- new Text(Moment
- .now()
+ new Text(Moment.now()
.from(context, state.fireNotification.when)),
],
),
@@ -113,7 +112,8 @@ class GenericMapBottom extends StatelessWidget {
onFalsePositive(state.fireNotification, value);
await new Future.delayed(
new Duration(milliseconds: 500));
- scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(context)
+ .showSnackBar(new SnackBar(
content: new Text(
S.of(context).thanksForParticipating),
));
diff --git a/lib/homePage.dart b/lib/homePage.dart
index f4c2544..d03bb27 100644
--- a/lib/homePage.dart
+++ b/lib/homePage.dart
@@ -1,21 +1,21 @@
import 'dart:async';
-import 'package:bson_objectid/bson_objectid.dart';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:connectivity/connectivity.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:fires_flutter/models/fireNotification.dart';
+import 'package:fires_flutter/objectIdUtils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
import 'package:redux/redux.dart';
-import 'firesSpinner.dart';
import 'activeFires.dart';
import 'colors.dart';
import 'fireAlert.dart';
import 'fireNotificationList.dart';
+import 'firesSpinner.dart';
import 'generated/i18n.dart';
import 'mainDrawer.dart';
import 'models/appState.dart';
@@ -28,14 +28,13 @@ class _ViewModel {
@override
bool operator ==(Object other) =>
- identical(this, other) ||
+ identical(this, other) ||
other is _ViewModel &&
- runtimeType == other.runtimeType &&
- isLoaded == other.isLoaded;
+ runtimeType == other.runtimeType &&
+ isLoaded == other.isLoaded;
@override
int get hashCode => isLoaded.hashCode;
-
}
class HomePage extends StatefulWidget {
@@ -83,16 +82,20 @@ class _HomePageState extends State {
void initState() {
super.initState();
_firebaseMessaging.configure(onMessage: (Map message) {
- debugPrint("onMessage in fireApp (isLoaded: ${store.state.isLoaded}): $message");
+ debugPrint(
+ "onMessage in fireApp (isLoaded: ${store.state.isLoaded}): $message");
_showItemDialog(message, _notifForMessage(message, store.state.isLoaded));
+ return;
}, onLaunch: (Map message) {
debugPrint("onLaunch (isLoaded: ${store.state.isLoaded}): $message");
_notifForMessage(message, store.state.isLoaded);
_navigateToItemDetail(message);
+ return;
}, onResume: (Map message) {
debugPrint("onResume (isLoaded: ${store.state.isLoaded}): $message");
_notifForMessage(message, store.state.isLoaded);
_navigateToItemDetail(message);
+ return;
});
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(sound: true, badge: true, alert: true));
@@ -140,9 +143,7 @@ class _HomePageState extends State {
});
newNotifications.clear();
}
- return new _ViewModel(
- isLoaded: store.state.isLoaded
- );
+ return new _ViewModel(isLoaded: store.state.isLoaded);
},
builder: (context, view) {
return new Scaffold(
@@ -179,45 +180,47 @@ class _HomePageState extends State {
),
),
]),
- body: !view.isLoaded? new FiresSpinner(): new SafeArea(
- child: Center(
- child: new CenteredColumn(children: [
- new Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- new IconButton(
- onPressed: () {
- _scaffoldKey.currentState.openDrawer();
- },
- icon: new Icon(Icons.menu,
- size: 30.0, color: Colors.black38)),
- ]),
- new Expanded(
- child: new FractionallySizedBox(
- alignment: FractionalOffset.center,
- heightFactor: 0.7,
- child: new Image.asset('images/logo-200.png',
- fit: BoxFit.fitHeight))),
- new Expanded(
- child: new FractionallySizedBox(
- alignment: FractionalOffset.topCenter,
- heightFactor: 1.0,
- child: new Column(
+ body: !view.isLoaded
+ ? new FiresSpinner()
+ : new SafeArea(
+ child: Center(
+ child: new CenteredColumn(children: [
+ new Row(
+ mainAxisAlignment: MainAxisAlignment.start,
children: [
- new Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 10.0, horizontal: 20.0),
- child: FittedBox(
- child: new Text(S.of(context).appName,
- maxLines: 2,
- textAlign: TextAlign.center,
- style: _homeFont),
- fit: BoxFit.scaleDown,
- )),
- ],
- )))
- ])),
- ));
+ new IconButton(
+ onPressed: () {
+ _scaffoldKey.currentState.openDrawer();
+ },
+ icon: new Icon(Icons.menu,
+ size: 30.0, color: Colors.black38)),
+ ]),
+ new Expanded(
+ child: new FractionallySizedBox(
+ alignment: FractionalOffset.center,
+ heightFactor: 0.7,
+ child: new Image.asset('images/logo-200.png',
+ fit: BoxFit.fitHeight))),
+ new Expanded(
+ child: new FractionallySizedBox(
+ alignment: FractionalOffset.topCenter,
+ heightFactor: 1.0,
+ child: new Column(
+ children: [
+ new Padding(
+ padding: const EdgeInsets.symmetric(
+ vertical: 10.0, horizontal: 20.0),
+ child: FittedBox(
+ child: new Text(S.of(context).appName,
+ maxLines: 2,
+ textAlign: TextAlign.center,
+ style: _homeFont),
+ fit: BoxFit.scaleDown,
+ )),
+ ],
+ )))
+ ])),
+ ));
});
}
@@ -282,12 +285,13 @@ class _HomePageState extends State {
// https://pub.dartlang.org/packages/firebase_messaging#-example-tab-
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
- FireNotification _notifForMessage(Map message, bool isLoaded) {
+ FireNotification _notifForMessage(
+ Map message, bool isLoaded) {
FireNotification notif;
try {
notif = new FireNotification(
- id: new ObjectId.fromHexString(message['id']),
- subsId: new ObjectId.fromHexString(message['subsId']),
+ id: objectIdFromJson(message['id']),
+ subsId: objectIdFromJson(message['subsId']),
lat: double.parse(message['lat']),
lon: double.parse(message['lon']),
description: message['description'],
@@ -299,12 +303,12 @@ class _HomePageState extends State {
debugPrint(e.toString());
}
if (notif != null)
- // if our store is loaded, we just dispatch the notification, if not, we wait til is loaded
- if (isLoaded) {
- store.dispatch(new AddFireNotificationAction(notif));
- } else {
- newNotifications.add(notif);
- }
+ // if our store is loaded, we just dispatch the notification, if not, we wait til is loaded
+ if (isLoaded) {
+ store.dispatch(new AddFireNotificationAction(notif));
+ } else {
+ newNotifications.add(notif);
+ }
return notif;
}
}
diff --git a/lib/layerSelectorMapPlugin.dart b/lib/layerSelectorMapPlugin.dart
index d5dc01c..084c989 100644
--- a/lib/layerSelectorMapPlugin.dart
+++ b/lib/layerSelectorMapPlugin.dart
@@ -1,6 +1,5 @@
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
import 'package:redux/redux.dart';
@@ -18,16 +17,19 @@ class LayerSelectorMapPluginOptions extends LayerOptions {
class LayerSelectorMapPlugin extends MapPlugin {
Widget LayerSelectorButton(Store store) {
return new FloatingActionButton(
- backgroundColor: Colors.black26,
- mini: true,
- child: Icon(Icons.layers, /* size: 40.0, color: Colors.black45, */ ),
+ backgroundColor: Colors.black26,
+ mini: true,
+ child: Icon(
+ Icons.layers, /* size: 40.0, color: Colors.black45, */
+ ),
onPressed: () {
store.dispatch(new ToggleMapLayerAction());
});
}
@override
- Widget createLayer(LayerOptions options, MapState mapState) {
+ Widget createLayer(
+ LayerOptions options, MapState mapState, Stream stream) {
Store store = Injector.getInjector().get>();
if (options is LayerSelectorMapPluginOptions) {
return LayoutBuilder(
diff --git a/lib/locationUtils.dart b/lib/locationUtils.dart
index 2f3b55a..29fc522 100644
--- a/lib/locationUtils.dart
+++ b/lib/locationUtils.dart
@@ -1,29 +1,32 @@
-import 'package:location/location.dart';
-import 'package:flutter/services.dart';
import 'dart:async';
+
import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
-import 'package:geocoder/geocoder.dart';
-import 'generated/i18n.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
+import 'package:geocoder/geocoder.dart';
+import 'package:location/location.dart';
+
+import 'generated/i18n.dart';
Future getUserLocation(
GlobalKey scaffoldKey) async {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
Location _location = new Location();
- Map location = await _location.getLocation;
+
+ LocationData location = await _location.getLocation();
// It seems that the lib fails with lat/lon values
- var yl = new YourLocation(
- lat: location['latitude'], lon: location['longitude']);
+ var yl = new YourLocation(lat: location.latitude, lon: location.longitude);
var address;
try {
address = await getReverseLocation(lat: yl.lat, lon: yl.lon);
yl.description = address;
} catch (e) {
try {
- address = await getReverseLocation(lat: yl.lat, lon: yl.lon, external: true);
+ address =
+ await getReverseLocation(lat: yl.lat, lon: yl.lon, external: true);
yl.description = address;
} catch (e) {
print('We cannot reverse geolocate');
@@ -32,22 +35,25 @@ Future getUserLocation(
return yl;
} on PlatformException catch (e) {
if (e.code == 'PERMISSION_DENIED') {
- scaffoldKey.currentState.showSnackBar(new SnackBar(
+ ScaffoldMessenger.of(scaffoldKey.currentContext)
+ .showSnackBar(new SnackBar(
content: new Text(S.of(scaffoldKey.currentContext).notPermsUbication),
));
} else if (e.code == 'PERMISSION_DENIED_NEVER_ASK') {}
- scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text(S.of(scaffoldKey.currentContext).isYourUbicationEnabled
- ),
+ ScaffoldMessenger.of(scaffoldKey.currentContext).showSnackBar(new SnackBar(
+ content:
+ new Text(S.of(scaffoldKey.currentContext).isYourUbicationEnabled),
));
return YourLocation.noLocation;
}
}
-Future getReverseLocation({@required lat, @required lon,
- bool external = false}) async {
+Future getReverseLocation(
+ {@required lat, @required lon, bool external = false}) async {
final coordinates = new Coordinates(lat, lon);
- var geoCoder = external ? Geocoder.google(Injector.getInjector().get(key: "gmapKey")) : Geocoder.local;
+ var geoCoder = external
+ ? Geocoder.google(Injector.getInjector().get(key: "gmapKey"))
+ : Geocoder.local;
var addresses = await geoCoder.findAddressesFromCoordinates(coordinates);
var first = addresses.first;
print("${first.featureName} : ${first.addressLine}");
diff --git a/lib/mainCommon.dart b/lib/mainCommon.dart
index eaf76e2..3b6876e 100644
--- a/lib/mainCommon.dart
+++ b/lib/mainCommon.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
+import 'package:package_info/package_info.dart';
import 'package:redux/redux.dart';
import 'package:sentry/sentry.dart';
@@ -12,7 +13,6 @@ import 'models/appState.dart';
import 'models/firesApi.dart';
import 'redux/fetchDataMiddleware.dart';
import 'redux/reducers.dart';
-import 'package:package_info/package_info.dart';
import 'sentryReport.dart';
Future loadPackageInfo() async {
@@ -22,13 +22,14 @@ Future loadPackageInfo() async {
Future