maps api implementation started

This commit is contained in:
Felix 2019-08-21 12:35:21 +01:00
parent cf6753363c
commit 19021a9a09
8 changed files with 59 additions and 3 deletions

3
.gitignore vendored
View file

@ -234,4 +234,5 @@ fabric.properties
!**/ios/**/default.perspectivev3 !**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
# End of https://www.gitignore.io/api/android,flutter,androidstudio # End of https://www.gitignore.io/api/android,flutter,androidstudio
lib/common/felixApiCreds.dart

View file

@ -30,6 +30,11 @@
<meta-data <meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" /> android:value="true" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API KEY HERE" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>

View file

@ -47,5 +47,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict> </dict>
</plist> </plist>

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:local_spend/pages/receipt_page_2.dart'; import 'package:local_spend/pages/receipt_page_2.dart';
import 'package:local_spend/pages/more_page.dart'; import 'package:local_spend/pages/more_page.dart';
import 'package:local_spend/pages/stats_page.dart'; import 'package:local_spend/pages/stats_page.dart';
import 'package:local_spend/pages/map_page.dart';
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
static String _title = 'Text here'; static String _title = 'Text here';
@ -24,11 +25,13 @@ class HomePageWidget extends StatefulWidget {
class _HomePageState extends State<HomePageWidget> { class _HomePageState extends State<HomePageWidget> {
int _selectedIndex = 0; int _selectedIndex = 0;
static const TextStyle optionStyle = static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold); TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[ static List<Widget> _widgetOptions = <Widget>[
ReceiptPage2(), ReceiptPage2(),
StatsPage(), StatsPage(),
MapPage(),
MorePage() MorePage()
]; ];
@ -40,6 +43,8 @@ class _HomePageState extends State<HomePageWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var _itemText = TextStyle(color: Colors.grey[400]);
return Scaffold( return Scaffold(
body: Center( body: Center(
child: _widgetOptions.elementAt(_selectedIndex), child: _widgetOptions.elementAt(_selectedIndex),
@ -54,12 +59,17 @@ class _HomePageState extends State<HomePageWidget> {
icon: Icon(Icons.show_chart), icon: Icon(Icons.show_chart),
title: Text('Statistics'), title: Text('Statistics'),
), ),
BottomNavigationBarItem(
icon: Icon(Icons.map),
title: Text('Locations'),
),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.more_horiz), icon: Icon(Icons.more_horiz),
title: Text('More'), title: Text('More'),
), ),
], ],
currentIndex: _selectedIndex, currentIndex: _selectedIndex,
unselectedItemColor: Colors.grey[400],
selectedItemColor: Colors.blue[400], selectedItemColor: Colors.blue[400],
onTap: _onItemTapped, onTap: _onItemTapped,
), ),

32
lib/pages/map_page.dart Normal file
View file

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter_maps/flutter_maps.dart';
import 'package:local_spend/common/felixApiCreds.dart';
class MapPage extends StatefulWidget {
MapPage({Key key}) : super(key: key);
@override
_MapPageState createState() {
return _MapPageState();
}
}
class _MapPageState extends State<MapPage> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
var fac = new FelixApiCreds();
// TODO: implement build
return Text(fac.mapsApiKey);
}
}

View file

@ -100,8 +100,6 @@ class ReceiptPage2State extends State<ReceiptPage2> {
var _widgetHeight = MediaQuery.of(context).size.height * 0.06 < 40.0 ? 40.0 : MediaQuery.of(context).size.height * 0.06; var _widgetHeight = MediaQuery.of(context).size.height * 0.06 < 40.0 ? 40.0 : MediaQuery.of(context).size.height * 0.06;
debugPrint(_widgetHeight.toString());
if (_categories.length == 0) { if (_categories.length == 0) {
Future<List<String>> _futureCats = getCats(); Future<List<String>> _futureCats = getCats();
_categories.add("Fetching categories..."); _categories.add("Fetching categories...");

View file

@ -193,6 +193,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_maps:
dependency: "direct main"
description:
name: flutter_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

View file

@ -26,6 +26,7 @@ dependencies:
flutter_fadein: ^1.1.1 flutter_fadein: ^1.1.1
charts_flutter: ^0.6.0 charts_flutter: ^0.6.0
simple_animations: ^1.3.3 simple_animations: ^1.3.3
flutter_maps: ^0.1.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2 cupertino_icons: ^0.1.2