settings
This commit is contained in:
@@ -33,18 +33,29 @@ class DishCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Column(
|
||||||
dish.name,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
overflow: TextOverflow.ellipsis,
|
children: [
|
||||||
maxLines: 1,
|
Text(
|
||||||
style: TextStyle(color: Colors.orange[600], fontSize: 16),
|
dish.name,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(color: Colors.orange[600], fontSize: 15),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
dish.weight,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${dish.price} zł',
|
'${dish.price} zł',
|
||||||
style: TextStyle(color: Colors.grey[300], fontSize: 14),
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -1,19 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
|
||||||
import 'searchBar.dart';
|
import 'searchBar.dart';
|
||||||
|
import '../settings.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatelessWidget {
|
||||||
HomePage({Key key}) : super(key: key);
|
final MenuiSettings settings = new MenuiSettings();
|
||||||
|
|
||||||
@override
|
|
||||||
_HomePageState createState() => _HomePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HomePageState extends State<HomePage> {
|
|
||||||
void getLocation() async {
|
|
||||||
Position currentLocation = await Geolocator.getCurrentPosition();
|
|
||||||
print(currentLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -37,7 +27,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
RaisedButton.icon(
|
RaisedButton.icon(
|
||||||
color: Colors.grey[850],
|
color: Colors.grey[850],
|
||||||
onPressed: getLocation,
|
onPressed: () {},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.my_location,
|
Icons.my_location,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
@@ -55,7 +45,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showSettings();
|
showSettings(context);
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.settings,
|
Icons.settings,
|
||||||
@@ -66,63 +56,318 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSettings() {
|
// SHOW SETTINGS
|
||||||
|
|
||||||
|
showSettings(BuildContext context) async {
|
||||||
|
FocusManager.instance.primaryFocus.unfocus();
|
||||||
|
final String languageCode = await settings.getLanguage();
|
||||||
|
final String language = settings.decodeLanguage(languageCode);
|
||||||
|
final int radius = await settings.getRadius();
|
||||||
|
final bool recommendationsValue = await settings.getRecommendations();
|
||||||
|
final recommendations = settings.decodeBool(recommendationsValue);
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.grey[850],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(24), topRight: Radius.circular(24))),
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ClipRRect(
|
return ListView(
|
||||||
borderRadius: BorderRadius.only(
|
shrinkWrap: true,
|
||||||
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
child: Container(
|
children: <Widget>[
|
||||||
height: 260,
|
ListTile(
|
||||||
decoration: BoxDecoration(color: Colors.grey[850]),
|
title: Text(
|
||||||
child: ListView(
|
'Język',
|
||||||
children: <Widget>[
|
style: TextStyle(color: Colors.white),
|
||||||
ListTile(
|
),
|
||||||
title: Text(
|
subtitle: Text(
|
||||||
'Język',
|
language,
|
||||||
style: TextStyle(color: Colors.grey),
|
style: TextStyle(color: Colors.grey),
|
||||||
),
|
),
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.language,
|
Icons.language,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
),
|
),
|
||||||
onTap: () {}),
|
onTap: () {
|
||||||
ListTile(
|
Navigator.pop(context);
|
||||||
title: Text(
|
showLanguageSelectionDialog(context);
|
||||||
'Promień lokalizacji',
|
}),
|
||||||
style: TextStyle(color: Colors.grey),
|
ListTile(
|
||||||
),
|
title: Text(
|
||||||
leading: Icon(
|
'Promień lokalizacji',
|
||||||
Icons.location_searching_rounded,
|
style: TextStyle(color: Colors.white),
|
||||||
color: Colors.orange,
|
),
|
||||||
),
|
subtitle:
|
||||||
onTap: () {}),
|
Text('${radius}m', style: TextStyle(color: Colors.grey)),
|
||||||
ListTile(
|
leading: Icon(
|
||||||
title: Text(
|
Icons.location_searching_rounded,
|
||||||
'Proponuj restauracje',
|
color: Colors.orange,
|
||||||
style: TextStyle(color: Colors.grey),
|
),
|
||||||
),
|
onTap: () {
|
||||||
leading: Icon(
|
Navigator.pop(context);
|
||||||
Icons.restaurant,
|
showRadiusSelectionDialog(context);
|
||||||
color: Colors.orange,
|
}),
|
||||||
),
|
ListTile(
|
||||||
onTap: () {}),
|
title: Text(
|
||||||
ListTile(
|
'Proponuj restauracje',
|
||||||
title: Text(
|
style: TextStyle(color: Colors.white),
|
||||||
'O aplikacji',
|
),
|
||||||
style: TextStyle(color: Colors.grey),
|
subtitle: Text(recommendations,
|
||||||
),
|
style: TextStyle(color: Colors.grey)),
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.info,
|
Icons.notifications,
|
||||||
color: Colors.grey,
|
color: Colors.orange,
|
||||||
),
|
),
|
||||||
onTap: () {}),
|
onTap: () {
|
||||||
],
|
Navigator.pop(context);
|
||||||
),
|
showRecommendationsDialog(context);
|
||||||
),
|
}),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'O aplikacji',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
leading: Icon(
|
||||||
|
Icons.info,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
showAppInfoDialog(context);
|
||||||
|
}),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SELECT LANGUAGE
|
||||||
|
|
||||||
|
void showLanguageSelectionDialog(BuildContext context) async {
|
||||||
|
final currentLanguage = await settings.getLanguage();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Text(
|
||||||
|
'Język',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||||
|
backgroundColor: Colors.grey[850],
|
||||||
|
children: <Widget>[
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
settings.setLanguage('pl');
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Polski',
|
||||||
|
style:
|
||||||
|
TextStyle(color: getOptionColor(currentLanguage, 'pl')),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
settings.setLanguage('en');
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'English',
|
||||||
|
style:
|
||||||
|
TextStyle(color: getOptionColor(currentLanguage, 'en')),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
settings.setLanguage('de');
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Deutsch',
|
||||||
|
style:
|
||||||
|
TextStyle(color: getOptionColor(currentLanguage, 'de')),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET SHOW RECOMMENDATIONS
|
||||||
|
|
||||||
|
void showRecommendationsDialog(BuildContext context) async {
|
||||||
|
final showRecommendations = await settings.getRecommendations();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Text(
|
||||||
|
'Polecaj restauracje w okolicy',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||||
|
backgroundColor: Colors.grey[850],
|
||||||
|
children: <Widget>[
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
settings.setRecommendations(true);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Tak',
|
||||||
|
style: TextStyle(
|
||||||
|
color: getOptionColor(showRecommendations, true)),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
settings.setRecommendations(false);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Nie',
|
||||||
|
style: TextStyle(
|
||||||
|
color: getOptionColor(showRecommendations, false)),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// SHOW APP INFO
|
||||||
|
|
||||||
|
void showAppInfoDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(24)),
|
||||||
|
backgroundColor: Colors.grey[850],
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'Wersja aplikacji',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
'0.0.1 (alpha)',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
)),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'Wsparcie',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
'support@menui.pl',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
)),
|
||||||
|
Text(
|
||||||
|
'Menui Sp. z o.o. - wszelkie prawa zastrzeżone.',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// SELECT RADIUS
|
||||||
|
|
||||||
|
void showRadiusSelectionDialog(BuildContext context) async {
|
||||||
|
final int currentRadius = await settings.getRadius();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return RadiusSlider(
|
||||||
|
initialValue: currentRadius.toDouble(),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Color getOptionColor(targetOption, thisOption) {
|
||||||
|
if (thisOption == targetOption) {
|
||||||
|
return Colors.orange;
|
||||||
|
} else {
|
||||||
|
return Colors.grey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RadiusSlider extends StatefulWidget {
|
||||||
|
final double initialValue;
|
||||||
|
RadiusSlider({Key key, @required this.initialValue}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_RadiusSliderState createState() =>
|
||||||
|
_RadiusSliderState(sliderValue: initialValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RadiusSliderState extends State<RadiusSlider> {
|
||||||
|
double sliderValue;
|
||||||
|
|
||||||
|
_RadiusSliderState({this.sliderValue});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Text(
|
||||||
|
'Promień lokalizacji',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||||
|
backgroundColor: Colors.grey[850],
|
||||||
|
children: <Widget>[
|
||||||
|
Slider(
|
||||||
|
value: sliderValue,
|
||||||
|
min: 300,
|
||||||
|
max: 3000,
|
||||||
|
divisions: 9,
|
||||||
|
label: formatDistance(sliderValue),
|
||||||
|
onChanged: (double value) {
|
||||||
|
setState(() {
|
||||||
|
sliderValue = value;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () async {
|
||||||
|
final MenuiSettings settings = new MenuiSettings();
|
||||||
|
settings.setRadius(sliderValue.toInt());
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Zapisz',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatDistance(double distance) {
|
||||||
|
if (distance > 1000) {
|
||||||
|
final double distanceInKM = distance / 1000;
|
||||||
|
return '${distanceInKM.toString()}km';
|
||||||
|
} else {
|
||||||
|
return '${distance}m';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class MenuiSearchBarState extends State<MenuiSearchBar> {
|
|||||||
final LayerLink layerLink = LayerLink();
|
final LayerLink layerLink = LayerLink();
|
||||||
OverlayEntry _overlayEntry;
|
OverlayEntry _overlayEntry;
|
||||||
final _controller = TextEditingController();
|
final _controller = TextEditingController();
|
||||||
|
String previousText = '';
|
||||||
|
|
||||||
var suggestions = <String>[];
|
var suggestions = <String>[];
|
||||||
bool suggestionsOpen = false;
|
bool suggestionsOpen = false;
|
||||||
@@ -26,7 +27,8 @@ class MenuiSearchBarState extends State<MenuiSearchBar> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchAutocomplete() async {
|
Future<void> fetchAutocomplete() async {
|
||||||
if (_controller.text.isNotEmpty) {
|
if (_controller.text.isNotEmpty && _controller.text != previousText) {
|
||||||
|
previousText = _controller.text;
|
||||||
final List<String> results =
|
final List<String> results =
|
||||||
await services.fetchAutocomplete(_controller.text);
|
await services.fetchAutocomplete(_controller.text);
|
||||||
|
|
||||||
@@ -43,7 +45,6 @@ class MenuiSearchBarState extends State<MenuiSearchBar> {
|
|||||||
} else if (results.isEmpty) {
|
} else if (results.isEmpty) {
|
||||||
hideSuggestions();
|
hideSuggestions();
|
||||||
}
|
}
|
||||||
print(suggestions);
|
|
||||||
} else {
|
} else {
|
||||||
hideSuggestions();
|
hideSuggestions();
|
||||||
}
|
}
|
||||||
@@ -76,6 +77,11 @@ class MenuiSearchBarState extends State<MenuiSearchBar> {
|
|||||||
builder: (context) => GestureDetector(
|
builder: (context) => GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||||
|
print('12345');
|
||||||
|
if (!currentFocus.hasPrimaryFocus) {
|
||||||
|
currentFocus.unfocus();
|
||||||
|
}
|
||||||
hideSuggestions();
|
hideSuggestions();
|
||||||
},
|
},
|
||||||
child: Align(
|
child: Align(
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ class App extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
FocusManager.instance.primaryFocus.unfocus();
|
||||||
if (!currentFocus.hasPrimaryFocus) {
|
|
||||||
currentFocus.focusedChild.unfocus();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
title: 'Menui - food guide',
|
title: 'Menui - food guide',
|
||||||
|
|||||||
86
lib/settings.dart
Normal file
86
lib/settings.dart
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
class MenuiSettings {
|
||||||
|
// SET LANGUAGE
|
||||||
|
void setLanguage(String lang) async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
settings.setString('language', lang);
|
||||||
|
print('Language set to: $lang');
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET LANGUAGE
|
||||||
|
Future<String> getLanguage() async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
if (settings.containsKey('language')) {
|
||||||
|
final String language = settings.getString('language');
|
||||||
|
return language;
|
||||||
|
} else {
|
||||||
|
settings.setString('language', 'pl');
|
||||||
|
return 'pl';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET RADIUS
|
||||||
|
void setRadius(int radiusMeters) async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
settings.setInt('radius', radiusMeters);
|
||||||
|
print('Radius set to: $radiusMeters');
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET RADIUS
|
||||||
|
Future<int> getRadius() async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
if (settings.containsKey('radius')) {
|
||||||
|
final radius = settings.getInt('radius');
|
||||||
|
return radius;
|
||||||
|
} else {
|
||||||
|
settings.setInt('radius', 600);
|
||||||
|
return 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET RECOMMENDATIONS
|
||||||
|
void setRecommendations(bool recommend) async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
settings.setBool('recommendations', recommend);
|
||||||
|
print('Recommendations set to: $recommend');
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET RECOMMENDATIONS
|
||||||
|
Future<bool> getRecommendations() async {
|
||||||
|
final settings = await SharedPreferences.getInstance();
|
||||||
|
if (settings.containsKey('recommendations')) {
|
||||||
|
final recommend = settings.getBool('recommendations');
|
||||||
|
return recommend;
|
||||||
|
} else {
|
||||||
|
settings.setBool('recommendations', false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DECODE LANGUAGE
|
||||||
|
String decodeLanguage(String languageCode) {
|
||||||
|
String language;
|
||||||
|
switch (languageCode) {
|
||||||
|
case 'pl':
|
||||||
|
language = 'Polski';
|
||||||
|
break;
|
||||||
|
case 'en':
|
||||||
|
language = 'English';
|
||||||
|
break;
|
||||||
|
case 'de':
|
||||||
|
language = 'Deutsch';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DECODE BOOL
|
||||||
|
String decodeBool(bool value) {
|
||||||
|
if (value == true) {
|
||||||
|
return "Tak";
|
||||||
|
} else {
|
||||||
|
return "Nie";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
119
pubspec.lock
119
pubspec.lock
@@ -57,6 +57,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.1"
|
version: "1.2.0-nullsafety.1"
|
||||||
|
ffi:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: ffi
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
|
file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.1"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -67,6 +81,11 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
geolocator:
|
geolocator:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -95,6 +114,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "3.1.4"
|
||||||
|
intl:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.16.1"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -116,6 +142,27 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0-nullsafety.1"
|
version: "1.8.0-nullsafety.1"
|
||||||
|
path_provider_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+2"
|
||||||
|
path_provider_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.3"
|
||||||
|
path_provider_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.4+1"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -123,6 +170,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.2"
|
version: "1.9.2"
|
||||||
|
platform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: platform
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.1"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -130,6 +184,55 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "1.0.3"
|
||||||
|
process:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: process
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.13"
|
||||||
|
shared_preferences:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: shared_preferences
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.12+2"
|
||||||
|
shared_preferences_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.2+2"
|
||||||
|
shared_preferences_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_macos
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+10"
|
||||||
|
shared_preferences_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
|
shared_preferences_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.2+7"
|
||||||
|
shared_preferences_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -191,6 +294,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
version: "2.1.0-nullsafety.3"
|
||||||
|
win32:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: win32
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.7.3"
|
||||||
|
xdg_directories:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xdg_directories
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.0-110 <2.11.0"
|
dart: ">=2.10.0-110 <2.11.0"
|
||||||
flutter: ">=1.10.0"
|
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ dependencies:
|
|||||||
geolocator: ^6.1.0
|
geolocator: ^6.1.0
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
shared_preferences: ^0.5.12
|
||||||
|
|
||||||
# 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user