diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e34f895..324468b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,11 @@ 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. --> + + + + _HomePageState(); +} + +class _HomePageState extends State { + void getLocation() async { + Position currentLocation = await Geolocator.getCurrentPosition(); + print(currentLocation); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "img/logo_mint.png", + width: 160, + ), + MenuiSearchBar(), + Text( + 'lub', + style: TextStyle(color: Colors.grey[500]), + ), + RaisedButton.icon( + color: Colors.grey[850], + onPressed: getLocation, + icon: Icon( + Icons.my_location, + color: Colors.orange, + ), + label: Text( + 'Pokaż w pobliżu', + style: TextStyle(color: Colors.grey[400]), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12)), + ) + ], + ), + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + showSettings(); + }, + child: Icon( + Icons.settings, + color: Colors.orange, + ), + backgroundColor: Colors.grey[850], + ), + ); + } + + showSettings() { + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + builder: (BuildContext context) { + return ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20)), + child: Container( + height: 260, + decoration: BoxDecoration(color: Colors.grey[850]), + child: ListView( + children: [ + ListTile( + title: Text( + 'Język', + style: TextStyle(color: Colors.grey), + ), + leading: Icon( + Icons.language, + color: Colors.orange, + ), + onTap: () {}), + ListTile( + title: Text( + 'Promień lokalizacji', + style: TextStyle(color: Colors.grey), + ), + leading: Icon( + Icons.location_searching_rounded, + color: Colors.orange, + ), + onTap: () {}), + ListTile( + title: Text( + 'Proponuj restauracje', + style: TextStyle(color: Colors.grey), + ), + leading: Icon( + Icons.restaurant, + color: Colors.orange, + ), + onTap: () {}), + ListTile( + title: Text( + 'O aplikacji', + style: TextStyle(color: Colors.grey), + ), + leading: Icon( + Icons.info, + color: Colors.grey, + ), + onTap: () {}), + ], + ), + ), + ); + }); + } +} diff --git a/lib/components/searchBar.dart b/lib/components/searchBar.dart index 6d9e4e6..40a902b 100644 --- a/lib/components/searchBar.dart +++ b/lib/components/searchBar.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:menui_mobile/main.dart'; import '../services.dart'; +import 'searchResults.dart'; class MenuiSearchBar extends StatefulWidget { @override diff --git a/lib/components/searchResults.dart b/lib/components/searchResults.dart new file mode 100644 index 0000000..c9a4fa5 --- /dev/null +++ b/lib/components/searchResults.dart @@ -0,0 +1,54 @@ +import '../services.dart'; +import 'package:flutter/material.dart'; +import 'package:menui_mobile/components/restaurantCard.dart'; +import 'searchBar.dart'; + +class SearchResults extends StatelessWidget { + final List restaurants; + + SearchResults({@required this.restaurants}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Image.asset( + "img/logo_mint.png", + width: 60, + ), + MenuiSearchBar(), + Row(children: [ + Container( + padding: EdgeInsets.only(left: 12), + child: Text( + 'Znaleziono: ${restaurants.length}', + style: TextStyle(color: Colors.grey), + ), + ) + ]), + Expanded( + child: ListView.builder( + itemCount: restaurants.length, + itemBuilder: (context, index) { + return RestaurantCard( + restaurant: restaurants[index], + ); + }, + )) + ], + ), + ), + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index f4805f4..55509ae 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:menui_mobile/components/restaurantCard.dart'; -import 'components/searchBar.dart'; -import 'services.dart'; +import "components/homeScreen.dart"; void main() { runApp(App()); @@ -18,7 +16,7 @@ class App extends StatelessWidget { } }, child: MaterialApp( - title: 'Menui', + title: 'Menui - food guide', themeMode: ThemeMode.dark, theme: ThemeData( platform: TargetPlatform.iOS, @@ -32,97 +30,3 @@ class App extends StatelessWidget { )); } } - -// ROUTE --- HOME - -class HomePage extends StatefulWidget { - HomePage({Key key}) : super(key: key); - - @override - _HomePageState createState() => _HomePageState(); -} - -class _HomePageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "img/logo_mint.png", - width: 160, - ), - MenuiSearchBar() - ], - ), - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: () {}, - child: Icon( - Icons.settings, - color: Colors.orange, - ), - backgroundColor: Colors.grey[850], - ), - ); - } -} - -// ROUTE --- SEARCH RESULTS - -class SearchResults extends StatelessWidget { - final List restaurants; - - SearchResults({@required this.restaurants}); - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - Image.asset( - "img/logo_mint.png", - width: 60, - ), - MenuiSearchBar(), - Row(children: [ - Container( - padding: EdgeInsets.only(left: 12), - child: Text( - 'Znaleziono: ${restaurants.length}', - style: TextStyle(color: Colors.grey), - ), - ) - ]), - Expanded( - child: ListView.builder( - itemCount: restaurants.length, - itemBuilder: (context, index) { - return RestaurantCard( - restaurant: restaurants[index], - ); - }, - )) - ], - ), - ), - ), - ); - } -} diff --git a/pubspec.lock b/pubspec.lock index d3c2dc7..ede8bc2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -67,6 +67,20 @@ packages: description: flutter source: sdk version: "0.0.0" + geolocator: + dependency: "direct main" + description: + name: geolocator + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" http: dependency: "direct main" description: @@ -109,6 +123,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -172,3 +193,4 @@ packages: version: "2.1.0-nullsafety.3" sdks: dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3305688..9d5727f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,6 +22,7 @@ environment: dependencies: http: ^0.12.2 + geolocator: ^6.1.0 flutter: sdk: flutter