settings modal | get location
This commit is contained in:
@@ -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. -->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="menui_mobile"
|
||||
|
||||
128
lib/components/homeScreen.dart
Normal file
128
lib/components/homeScreen.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'searchBar.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
HomePage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
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: <Widget>[
|
||||
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: <Widget>[
|
||||
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: () {}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
54
lib/components/searchResults.dart
Normal file
54
lib/components/searchResults.dart
Normal file
@@ -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<Restaurant> 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: <Widget>[
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Image.asset(
|
||||
"img/logo_mint.png",
|
||||
width: 60,
|
||||
),
|
||||
MenuiSearchBar(),
|
||||
Row(children: <Widget>[
|
||||
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],
|
||||
);
|
||||
},
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
100
lib/main.dart
100
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<HomePage> {
|
||||
@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: <Widget>[
|
||||
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<Restaurant> 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: <Widget>[
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Image.asset(
|
||||
"img/logo_mint.png",
|
||||
width: 60,
|
||||
),
|
||||
MenuiSearchBar(),
|
||||
Row(children: <Widget>[
|
||||
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],
|
||||
);
|
||||
},
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
22
pubspec.lock
22
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"
|
||||
|
||||
@@ -22,6 +22,7 @@ environment:
|
||||
|
||||
dependencies:
|
||||
http: ^0.12.2
|
||||
geolocator: ^6.1.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user