diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 56be7fc..3295b53 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 93a8ddb..e947afc 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 25549c8..7a9eb14 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index a6d1bba..b034c4c 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 8b90c57..3a189af 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/img/bg.png b/img/bg.png new file mode 100644 index 0000000..faa8c11 Binary files /dev/null and b/img/bg.png differ diff --git a/img/bg_tile.jpg b/img/bg_tile.jpg deleted file mode 100644 index d449d3c..0000000 Binary files a/img/bg_tile.jpg and /dev/null differ diff --git a/img/logo_orange.png b/img/logo_orange.png index 89748e7..2ebb818 100644 Binary files a/img/logo_orange.png and b/img/logo_orange.png differ diff --git a/lib/components/dishList.dart b/lib/components/dishList.dart index 804ebab..e31d374 100644 --- a/lib/components/dishList.dart +++ b/lib/components/dishList.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../services.dart'; import 'dishCard.dart'; +import 'package:menui_mobile/localizations.dart'; class DishList extends StatelessWidget { final String id; @@ -68,14 +69,14 @@ class DishList extends StatelessWidget { elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(25)), - color: Colors.grey[900], + color: Colors.orange, icon: Icon( Icons.keyboard_arrow_down_rounded, - color: Colors.orange, + color: Colors.grey[900], ), label: Text( - "Zwiń", - style: TextStyle(color: Colors.white), + AppLocalizations.instance.text("hideDishes"), + style: TextStyle(color: Colors.grey[900]), ), onPressed: () => Navigator.pop(context), ))) diff --git a/lib/components/dishView.dart b/lib/components/dishView.dart index 488b8db..6fc016c 100644 --- a/lib/components/dishView.dart +++ b/lib/components/dishView.dart @@ -8,6 +8,7 @@ import '../settings.dart'; import 'homeScreen.dart'; import 'package:share/share.dart'; import 'menuiButton.dart'; +import 'package:menui_mobile/localizations.dart'; class DishView extends StatelessWidget { final Dish dish; @@ -19,7 +20,7 @@ class DishView extends StatelessWidget { duration: Duration(seconds: 2), behavior: SnackBarBehavior.floating, content: Text( - "Dodano do zamówienia :)", + AppLocalizations.instance.text("addedToOrder"), style: TextStyle(color: Colors.grey[850]), ), ); @@ -86,7 +87,7 @@ class DishView extends StatelessWidget { if (dish.allergens.hasAllergens()) SizedBox(height: 8), if (dish.allergens.hasAllergens()) Text( - 'Może zawierać', + AppLocalizations.instance.text("mayContain"), style: TextStyle(color: Colors.orange, fontSize: 14), ), Allergens(allergens: dish.allergens), @@ -110,7 +111,7 @@ class DishView extends StatelessWidget { height: 6, ), Text( - 'Składniki', + AppLocalizations.instance.text("ingredients"), style: TextStyle(color: Colors.orange, fontSize: 14), ), SizedBox( @@ -139,7 +140,7 @@ class DishView extends StatelessWidget { children: [ IconChip( icon: Icons.battery_charging_full, - leading: "Wartość energetyczna", + leading: AppLocalizations.instance.text("energy"), value: (() { if (dish.kCal != "") { return dish.kCal + " kcal"; @@ -149,7 +150,8 @@ class DishView extends StatelessWidget { }())), IconChip( icon: Icons.cake, - leading: "Indeks glikemiczny", + leading: + AppLocalizations.instance.text("glicemicIndex"), value: dish.glicemicIndex), ], ), @@ -158,7 +160,7 @@ class DishView extends StatelessWidget { ), if (dish.notes != "") Text( - 'Uwagi', + AppLocalizations.instance.text("notes"), style: TextStyle(color: Colors.orange, fontSize: 14), ), SizedBox( @@ -181,7 +183,7 @@ class DishView extends StatelessWidget { width: 6, ), Text( - 'Danie wegańskie', + AppLocalizations.instance.text("dishVegan"), style: TextStyle(color: Colors.grey[200], fontSize: 12), ), @@ -199,17 +201,17 @@ class DishView extends StatelessWidget { width: 6, ), Text( - 'Danie wegetariańskie', + AppLocalizations.instance.text("dishVegetarian"), style: TextStyle(color: Colors.grey[200], fontSize: 12), ), ], ), + SizedBox( + height: 120, + ) ], ), - SizedBox( - height: 28, - ) ], )), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, @@ -221,28 +223,28 @@ class DishView extends StatelessWidget { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text("search"), onPressed: () => Navigator.push( context, MaterialPageRoute(builder: (context) => HomePage())), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text("order"), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => OrderView())), ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text("favorites"), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FavoritesView())), ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text("settings"), onPressed: () { showSettings(context, settings); }, @@ -263,14 +265,14 @@ class DishView extends StatelessWidget { MenuiButton( color: Colors.grey, icon: Icons.share_rounded, - text: "Udostępnij", + text: AppLocalizations.instance.text("share"), onPressed: () => Share.share('https://www.menui.pl/dish/${dish.id}', subject: '${dish.name}'), ), MenuiButton( color: Colors.grey, icon: Icons.note_add_rounded, - text: "Do zamówienia", + text: AppLocalizations.instance.text("addToOrder"), onPressed: () { showDialog( context: context, @@ -319,7 +321,7 @@ class AddToOrderDialogState extends State { Widget build(BuildContext context) { return SimpleDialog( title: Text( - 'Dodaj do zamówienia', + AppLocalizations.instance.text("addToOrder"), style: TextStyle(color: Colors.white, fontSize: 16), textAlign: TextAlign.center, ), @@ -327,7 +329,7 @@ class AddToOrderDialogState extends State { backgroundColor: Colors.grey[850], children: [ Text( - 'Ilość', + AppLocalizations.instance.text("quantity"), textAlign: TextAlign.center, style: TextStyle(color: Colors.grey), ), @@ -370,7 +372,7 @@ class AddToOrderDialogState extends State { Padding( padding: EdgeInsets.only(bottom: 8), child: Text( - 'Wariant', + AppLocalizations.instance.text("variant"), textAlign: TextAlign.center, style: TextStyle(color: Colors.grey), ), @@ -521,7 +523,9 @@ class AddToOrderDialogState extends State { priceName: priceName)); widget.onSubmit(); }, - child: Text('Dodaj'), + child: Text( + AppLocalizations.instance.text("add"), + ), ), ), ) diff --git a/lib/components/favoriteButton.dart b/lib/components/favoriteButton.dart index b9d3458..be507d0 100644 --- a/lib/components/favoriteButton.dart +++ b/lib/components/favoriteButton.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../settings.dart'; import 'menuiButton.dart'; +import 'package:menui_mobile/localizations.dart'; class FavoriteButton extends StatefulWidget { final String id; @@ -33,7 +34,7 @@ class _FavoriteButtonState extends State { return MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Usuń", + text: AppLocalizations.instance.text("remove"), onPressed: () { settings.addToFavorites(widget.id); setState(() { @@ -45,7 +46,7 @@ class _FavoriteButtonState extends State { return MenuiButton( color: Colors.grey, icon: Icons.favorite_rounded, - text: "Dodaj", + text: AppLocalizations.instance.text("add"), onPressed: () { settings.addToFavorites(widget.id); setState(() { @@ -58,7 +59,7 @@ class _FavoriteButtonState extends State { return MenuiButton( color: Colors.grey, icon: Icons.favorite_rounded, - text: "Dodaj", + text: AppLocalizations.instance.text("add"), onPressed: () {}, ); } diff --git a/lib/components/favoritesView.dart b/lib/components/favoritesView.dart index bf7c3b5..dc89685 100644 --- a/lib/components/favoritesView.dart +++ b/lib/components/favoritesView.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:menui_mobile/components/restaurantCardAsync.dart'; +import 'package:menui_mobile/localizations.dart'; import '../settings.dart'; import 'homeScreen.dart'; import 'orderView.dart'; @@ -28,7 +29,7 @@ class _FavoritesViewState extends State { body: Container( decoration: BoxDecoration( image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + image: AssetImage("img/bg.png"), fit: BoxFit.cover)), child: FutureBuilder( future: favorites, builder: (context, snapshot) { @@ -59,27 +60,27 @@ class _FavoritesViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => HomePage())), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => OrderView())), ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () {}, ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, settings); }, @@ -89,7 +90,7 @@ class _FavoritesViewState extends State { ), appBar: AppBar( title: Text( - 'Ulubione', + AppLocalizations.instance.text('favorites'), style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400), ), backgroundColor: Colors.grey[900], diff --git a/lib/components/filters.dart b/lib/components/filters.dart index c58eebc..a87581d 100644 --- a/lib/components/filters.dart +++ b/lib/components/filters.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:menui_mobile/services.dart'; +import 'package:menui_mobile/localizations.dart'; enum Tags { cardPayments, @@ -96,7 +97,7 @@ class RestaurantFilters extends StatelessWidget { Padding( padding: EdgeInsets.all(8), child: Text( - 'Rodzaj kuchni', + AppLocalizations.instance.text('typeOfFood'), style: TextStyle(color: Colors.orange), ), ), @@ -132,7 +133,7 @@ class RestaurantFilters extends StatelessWidget { Padding( padding: EdgeInsets.all(8), child: Text( - 'Tagi', + AppLocalizations.instance.text('tags'), style: TextStyle(color: Colors.orange), ), ), @@ -141,49 +142,49 @@ class RestaurantFilters extends StatelessWidget { runSpacing: -12, children: [ RestaurantTag( - name: "Płatność kartą", + name: AppLocalizations.instance.text('cardPayments'), img: 'img/i_card_black.png', onTapped: () => onSelectTag(Tags.cardPayments), filters: filters, filterTag: Tags.cardPayments, ), RestaurantTag( - name: "Lubimy zwierzaki", + name: AppLocalizations.instance.text('pets'), img: 'img/i_pets_black.png', onTapped: () => onSelectTag(Tags.petFriendly), filters: filters, filterTag: Tags.petFriendly, ), RestaurantTag( - name: "Bez glutenu", + name: AppLocalizations.instance.text('glutenFree'), img: 'img/i_glutenFree_black.png', onTapped: () => onSelectTag(Tags.glutenFree), filters: filters, filterTag: Tags.glutenFree, ), RestaurantTag( - name: "Wegańskie", + name: AppLocalizations.instance.text('vegan'), img: 'img/i_vegan_black.png', onTapped: () => onSelectTag(Tags.vegan), filters: filters, filterTag: Tags.vegan, ), RestaurantTag( - name: "Wegetariańskie", + name: AppLocalizations.instance.text('vegetarian'), img: 'img/i_vegetarian_black.png', onTapped: () => onSelectTag(Tags.vegetarian), filters: filters, filterTag: Tags.vegetarian, ), RestaurantTag( - name: "Alkohol", + name: AppLocalizations.instance.text('alcohol'), img: 'img/i_alcohol_black.png', onTapped: () => onSelectTag(Tags.alcohol), filters: filters, filterTag: Tags.alcohol, ), RestaurantTag( - name: "Dowozimy", + name: AppLocalizations.instance.text('delivery'), img: 'img/i_delivery_black.png', onTapped: () => onSelectTag(Tags.delivery), filters: filters, diff --git a/lib/components/homeScreen.dart b/lib/components/homeScreen.dart index 7b1a4dd..6b1a1c9 100644 --- a/lib/components/homeScreen.dart +++ b/lib/components/homeScreen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:menui_mobile/localizations.dart'; import 'searchBar.dart'; import '../settings.dart'; import 'mapView.dart'; @@ -11,11 +12,12 @@ class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { + settings.initLanguage(context); return Scaffold( body: Container( decoration: BoxDecoration( image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + image: AssetImage("img/bg.png"), fit: BoxFit.cover)), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -26,7 +28,7 @@ class HomePage extends StatelessWidget { ), MenuiSearchBar(''), Text( - 'lub', + AppLocalizations.instance.text('or'), style: TextStyle(color: Colors.grey[500]), ), RaisedButton.icon( @@ -38,7 +40,7 @@ class HomePage extends StatelessWidget { color: Colors.orange, ), label: Text( - 'Pokaż w pobliżu', + AppLocalizations.instance.text('geosearch'), style: TextStyle(color: Colors.grey[300]), ), shape: RoundedRectangleBorder( @@ -57,27 +59,27 @@ class HomePage extends StatelessWidget { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () {}, ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => OrderView())), ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FavoritesView())), ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, settings); }, diff --git a/lib/components/lineOfAllergens.dart b/lib/components/lineOfAllergens.dart index db65104..80385ab 100644 --- a/lib/components/lineOfAllergens.dart +++ b/lib/components/lineOfAllergens.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import '../services.dart'; +import 'package:menui_mobile/localizations.dart'; class Allergens extends StatelessWidget { final MenuiAllergens allergens; @@ -32,7 +33,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Jaja', + AppLocalizations.instance.text('eggs'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -53,7 +54,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Gluten', + AppLocalizations.instance.text('gluten'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -74,7 +75,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Laktoza', + AppLocalizations.instance.text('lactose'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -95,7 +96,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Orzechy', + AppLocalizations.instance.text('peanuts'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -116,7 +117,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Owoce morza', + AppLocalizations.instance.text('seaFood'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -137,7 +138,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Sezam', + AppLocalizations.instance.text('sesame'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -158,7 +159,7 @@ class Allergens extends StatelessWidget { height: 26, ), Text( - 'Soja', + AppLocalizations.instance.text('soy'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) diff --git a/lib/components/lineOfIcons.dart b/lib/components/lineOfIcons.dart index 6c43c86..ad5cf39 100644 --- a/lib/components/lineOfIcons.dart +++ b/lib/components/lineOfIcons.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'filters.dart'; +import 'package:menui_mobile/localizations.dart'; class LineOfIcons extends StatelessWidget { final List tags; @@ -32,7 +33,7 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Alkohol', + AppLocalizations.instance.text('alcohol'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -54,12 +55,12 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Płatność', + AppLocalizations.instance.text('cardPayments1'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ), Text( - 'kartą', + AppLocalizations.instance.text('cardPayments2'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -80,7 +81,7 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Dowozimy', + AppLocalizations.instance.text('delivery'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -101,7 +102,7 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Bezglutenowe', + AppLocalizations.instance.text('glutenFree'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -122,12 +123,12 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Lubimy', + AppLocalizations.instance.text('pets1'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ), Text( - 'zwierzaczki', + AppLocalizations.instance.text('pets2'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -148,7 +149,7 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Wegańskie', + AppLocalizations.instance.text('vegan'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) @@ -169,7 +170,7 @@ class LineOfIcons extends StatelessWidget { height: 26, ), Text( - 'Wegetariańskie', + AppLocalizations.instance.text('vegetarian'), style: TextStyle(fontSize: fontSize, color: Colors.grey[300]), ) diff --git a/lib/components/mapView.dart b/lib/components/mapView.dart index 9087b98..337f3b6 100644 --- a/lib/components/mapView.dart +++ b/lib/components/mapView.dart @@ -9,6 +9,7 @@ import 'restaurantView.dart'; import 'menuiButton.dart'; import 'orderView.dart'; import 'favoritesView.dart'; +import 'package:menui_mobile/localizations.dart'; class MapView extends StatefulWidget { @override @@ -78,7 +79,8 @@ class MapViewState extends State with SingleTickerProviderStateMixin { builder: (context) => RestaurantView(id: thisRestaurant.id))), title: '${thisRestaurant.name}', - snippet: 'Kuchnia: ${thisRestaurant.type}')); + snippet: + '${AppLocalizations.instance.text('type')} ${thisRestaurant.type}')); markers[markerId] = marker; } } @@ -157,7 +159,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { color: Colors.orange, ), Text( - 'Promień', + AppLocalizations.instance.text("radius"), style: TextStyle( color: Colors.grey[200], fontSize: 11, @@ -198,7 +200,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { color: Colors.orange, ), Text( - 'Filtry', + AppLocalizations.instance.text("filter"), style: TextStyle( color: Colors.grey[200], fontSize: 11, @@ -254,7 +256,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { color: Colors.orange, ), Text( - 'Znaleziono: ${data.markers.length}', + '${AppLocalizations.instance.text('foundCounter')} ${data.markers.length}', style: TextStyle(color: Colors.white, fontSize: 12), ), @@ -282,13 +284,13 @@ class MapViewState extends State with SingleTickerProviderStateMixin { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text("search"), onPressed: () => Navigator.pop(context), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text("order"), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -297,7 +299,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text("favorites"), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -306,7 +308,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text("settings"), onPressed: () { showSettings(context, settings); }, @@ -321,7 +323,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - children: [Text("Błąd...")], + children: [Text(AppLocalizations.instance.text("error"))], ), ); } else { @@ -342,7 +344,7 @@ class MapViewState extends State with SingleTickerProviderStateMixin { Padding( padding: EdgeInsets.only(top: 16), child: Text( - 'Szukam restauracji...', + AppLocalizations.instance.text("searching"), style: TextStyle(color: Colors.grey[200]), ), ) diff --git a/lib/components/orderView.dart b/lib/components/orderView.dart index 65a3daa..b13a8e0 100644 --- a/lib/components/orderView.dart +++ b/lib/components/orderView.dart @@ -4,6 +4,7 @@ import '../settings.dart'; import 'homeScreen.dart'; import 'favoritesView.dart'; import 'menuiButton.dart'; +import 'package:menui_mobile/localizations.dart'; class OrderView extends StatefulWidget { final settings = new MenuiSettings(); @@ -19,7 +20,7 @@ class OrderViewState extends State { body: Container( decoration: BoxDecoration( image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + image: AssetImage("img/bg.png"), fit: BoxFit.cover)), child: Column( children: [ FutureBuilder( @@ -48,7 +49,7 @@ class OrderViewState extends State { child: Padding( padding: EdgeInsets.only(top: 50), child: Text( - "Zamówienie jest puste.", + AppLocalizations.instance.text('orderEmpty'), style: TextStyle(color: Colors.grey), ), )), @@ -75,27 +76,27 @@ class OrderViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => HomePage())), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () {}, ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FavoritesView())), ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, widget.settings); }, @@ -105,7 +106,7 @@ class OrderViewState extends State { ), appBar: AppBar( title: Text( - 'Zamówienie', + AppLocalizations.instance.text('order'), style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400), ), backgroundColor: Colors.grey[900], @@ -123,7 +124,7 @@ class OrderViewState extends State { widget.settings.clearOrder(); setState(() {}); }, - text: "Wyczyść", + text: AppLocalizations.instance.text('clear'), icon: Icons.delete_forever_rounded, ), ], diff --git a/lib/components/restaurantMapView.dart b/lib/components/restaurantMapView.dart index 6113dd6..e74379d 100644 --- a/lib/components/restaurantMapView.dart +++ b/lib/components/restaurantMapView.dart @@ -6,6 +6,7 @@ import 'orderView.dart'; import 'favoritesView.dart'; import 'homeScreen.dart'; import 'menuiButton.dart'; +import 'package:menui_mobile/localizations.dart'; class RestaurantMapView extends StatefulWidget { final List coordinates; @@ -35,7 +36,9 @@ class RestaurantMapViewState extends State { markerId: markerId, position: LatLng(widget.coordinates[0], widget.coordinates[1]), infoWindow: InfoWindow( - title: '${widget.name}', snippet: 'Kuchnia: ${widget.type}')); + title: '${widget.name}', + snippet: + '${AppLocalizations.instance.text('type')} ${widget.type}')); setState(() { markers[MarkerId("restaurant-marker")] = marker; }); @@ -58,28 +61,28 @@ class RestaurantMapViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () => Navigator.push( context, MaterialPageRoute(builder: (context) => HomePage())), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => OrderView())), ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FavoritesView())), ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, settings); }, diff --git a/lib/components/restaurantView.dart b/lib/components/restaurantView.dart index 6ba0c9d..e5ff070 100644 --- a/lib/components/restaurantView.dart +++ b/lib/components/restaurantView.dart @@ -11,6 +11,7 @@ import 'homeScreen.dart'; import 'package:share/share.dart'; import 'favoriteButton.dart'; import 'menuiButton.dart'; +import 'package:menui_mobile/localizations.dart'; class RestaurantView extends StatefulWidget { final String id; @@ -118,7 +119,7 @@ class _RestaurantViewState extends State { height: 8, ), Text( - 'Informacje', + AppLocalizations.instance.text('info'), style: TextStyle( color: Colors.orange, fontSize: 14), ), @@ -126,23 +127,26 @@ class _RestaurantViewState extends State { height: 6, ), MenuiDoubleColorText( - leading: 'Kuchnia: ', + leading: + '${AppLocalizations.instance.text('type')} ', following: '${restaurant.type}', ), MenuiDoubleColorText( - leading: 'Adres: ', + leading: + '${AppLocalizations.instance.text('adress')} ', following: '${restaurant.city}, ${restaurant.adress}', ), MenuiDoubleColorText( - leading: 'Kontakt: ', + leading: + '${AppLocalizations.instance.text('contact')} ', following: '${restaurant.phone}', ), SizedBox( height: 12, ), Text( - 'Godziny otwarcia', + AppLocalizations.instance.text('hours'), style: TextStyle( color: Colors.orange, fontSize: 14), ), @@ -155,7 +159,7 @@ class _RestaurantViewState extends State { height: 12, ), Text( - 'Social media', + AppLocalizations.instance.text('social'), style: TextStyle( color: Colors.orange, fontSize: 14), ), @@ -170,7 +174,7 @@ class _RestaurantViewState extends State { ), ), SizedBox( - height: 80, + height: 120, ) ], ) @@ -192,14 +196,14 @@ class _RestaurantViewState extends State { elevation: 5, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(25)), - color: Colors.grey[900], + color: Colors.orange, icon: Icon( Icons.keyboard_arrow_up_rounded, - color: Colors.orange, + color: Colors.grey[900], ), label: Text( - "Karta dań", - style: TextStyle(color: Colors.white), + AppLocalizations.instance.text('showDishes'), + style: TextStyle(color: Colors.grey[900]), ), onPressed: () => showMenu(context, restaurant.categories), @@ -215,7 +219,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -224,7 +228,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -233,7 +237,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -242,7 +246,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, settings); }, @@ -265,7 +269,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.grey, icon: Icons.map_rounded, - text: "Mapa", + text: AppLocalizations.instance.text('map'), onPressed: () => Navigator.push( context, MaterialPageRoute( @@ -278,7 +282,7 @@ class _RestaurantViewState extends State { MenuiButton( color: Colors.grey, icon: Icons.share_rounded, - text: "Udostępnij", + text: AppLocalizations.instance.text('share'), onPressed: () => Share.share( 'https://www.menui.pl/restaurant/${restaurant.id}', subject: '${restaurant.name}'), @@ -350,7 +354,7 @@ class WorkingHoursDay extends StatelessWidget { String formatTodayHours(String hours) { if (hours == "") { - return 'nieczynne'; + return AppLocalizations.instance.text('closed'); } else { return hours; } @@ -412,13 +416,20 @@ class WorkingHoursList extends StatelessWidget { runSpacing: 8.0, alignment: WrapAlignment.center, children: [ - WorkingHoursDay('Pn', workingHours.pn, 1), - WorkingHoursDay('Wt', workingHours.wt, 2), - WorkingHoursDay('Śr', workingHours.sr, 3), - WorkingHoursDay('Cz', workingHours.cz, 4), - WorkingHoursDay('Pt', workingHours.pt, 5), - WorkingHoursDay('So', workingHours.sb, 6), - WorkingHoursDay('Nd', workingHours.nd, 7), + WorkingHoursDay( + AppLocalizations.instance.text('mo'), workingHours.pn, 1), + WorkingHoursDay( + AppLocalizations.instance.text('tu'), workingHours.wt, 2), + WorkingHoursDay( + AppLocalizations.instance.text('we'), workingHours.sr, 3), + WorkingHoursDay( + AppLocalizations.instance.text('th'), workingHours.cz, 4), + WorkingHoursDay( + AppLocalizations.instance.text('fr'), workingHours.pt, 5), + WorkingHoursDay( + AppLocalizations.instance.text('sa'), workingHours.sb, 6), + WorkingHoursDay( + AppLocalizations.instance.text('su'), workingHours.nd, 7), ], ); } diff --git a/lib/components/searchBar.dart b/lib/components/searchBar.dart index 668bdf8..3629e15 100644 --- a/lib/components/searchBar.dart +++ b/lib/components/searchBar.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../services.dart'; import 'searchResults.dart'; +import 'package:menui_mobile/localizations.dart'; class MenuiSearchBar extends StatefulWidget { final String initialValue; @@ -82,7 +83,7 @@ class MenuiSearchBarState extends State { return OverlayEntry( builder: (context) => GestureDetector( - behavior: HitTestBehavior.translucent, + behavior: HitTestBehavior.opaque, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { @@ -162,22 +163,28 @@ class MenuiSearchBarState extends State { padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: TextFormField( + onFieldSubmitted: (text) => searchRestaurantsByString(), controller: _controller, style: TextStyle(color: Colors.orange, fontSize: 14), decoration: InputDecoration( - hintStyle: TextStyle(color: Colors.grey), + filled: true, + fillColor: Colors.grey[900], + hintStyle: TextStyle(color: Colors.grey[200]), enabledBorder: OutlineInputBorder( borderSide: - BorderSide(color: Colors.grey, width: 1.0), + BorderSide(color: Colors.grey[900], width: 1.0), borderRadius: BorderRadius.circular(16)), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.orange, width: 2.0), borderRadius: BorderRadius.circular(20)), - hintText: 'Wyszukaj miasto lub nazwę restauracji.', - suffixIcon: Icon( - Icons.search, - color: Colors.orange, + hintText: AppLocalizations.instance.text('searchbar'), + suffixIcon: IconButton( + onPressed: () => searchRestaurantsByString(), + icon: Icon( + Icons.search, + color: Colors.orange, + ), )), validator: (value) { if (value.isEmpty) { diff --git a/lib/components/searchResults.dart b/lib/components/searchResults.dart index 39b658f..aa51e26 100644 --- a/lib/components/searchResults.dart +++ b/lib/components/searchResults.dart @@ -8,6 +8,7 @@ import 'orderView.dart'; import 'favoritesView.dart'; import '../settings.dart'; import 'filters.dart'; +import 'package:menui_mobile/localizations.dart'; class SearchResults extends StatefulWidget { SearchResults( @@ -67,7 +68,7 @@ class _SearchResultsState extends State body: Container( decoration: BoxDecoration( image: DecorationImage( - image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)), + image: AssetImage("img/bg.png"), fit: BoxFit.cover)), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -138,28 +139,28 @@ class _SearchResultsState extends State MenuiButton( color: Colors.orange, icon: Icons.home_rounded, - text: "Szukaj", + text: AppLocalizations.instance.text('search'), onPressed: () => Navigator.push( context, MaterialPageRoute(builder: (context) => HomePage())), ), MenuiButton( color: Colors.orange, icon: Icons.note_rounded, - text: "Zamównienie", + text: AppLocalizations.instance.text('order'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => OrderView())), ), MenuiButton( color: Colors.orange, icon: Icons.favorite_rounded, - text: "Ulubione", + text: AppLocalizations.instance.text('favorites'), onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => FavoritesView())), ), MenuiButton( color: Colors.orange, icon: Icons.settings, - text: "Ustawienia", + text: AppLocalizations.instance.text('settings'), onPressed: () { showSettings(context, widget.settings); }, @@ -169,7 +170,7 @@ class _SearchResultsState extends State ), appBar: AppBar( title: Text( - 'Znaleziono: ${filteredRestaurants.length}', + '${AppLocalizations.instance.text('foundCounter')} ${filteredRestaurants.length}', style: TextStyle( color: Colors.white, fontSize: 14, fontWeight: FontWeight.w400), ), @@ -185,7 +186,7 @@ class _SearchResultsState extends State MenuiButton( color: Colors.grey, icon: Icons.filter_alt_rounded, - text: "Filtruj", + text: AppLocalizations.instance.text('filter'), onPressed: () { setState(() { expand = !expand; diff --git a/lib/localizations.dart b/lib/localizations.dart new file mode 100644 index 0000000..c71929c --- /dev/null +++ b/lib/localizations.dart @@ -0,0 +1,46 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class AppLocalizations { + static final AppLocalizations _singleton = new AppLocalizations._internal(); + AppLocalizations._internal(); + static AppLocalizations get instance => _singleton; + + Map _localisedValues; + Locale _currentLocale; + + Future load(Locale locale) async { + String jsonContent = await rootBundle + .loadString("locale/locale_${locale.languageCode}.json"); + _localisedValues = json.decode(jsonContent); + _currentLocale = locale; + return this; + } + + String getLocale() { + return _currentLocale.languageCode; + } + + String text(String key) { + return _localisedValues[key] ?? "$key not found"; + } +} + +class AppLocalizationsDelegate extends LocalizationsDelegate { + const AppLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => + ['en', 'pl', 'de'].contains(locale.languageCode); + + @override + Future load(Locale locale) { + return AppLocalizations.instance.load(locale); + } + + @override + bool shouldReload(AppLocalizationsDelegate old) => true; +} diff --git a/lib/main.dart b/lib/main.dart index 1085b5b..72bcb3a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:menui_mobile/localizations.dart'; +import 'package:menui_mobile/settings.dart'; import "components/homeScreen.dart"; void main() { @@ -8,15 +11,14 @@ void main() { class App extends StatelessWidget { @override Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus.unfocus(); - }, - child: MaterialApp( + return GestureDetector(onTap: () { + FocusManager.instance.primaryFocus.unfocus(); + }, child: AppBuilder( + builder: (context) { + return MaterialApp( title: 'Menui - food guide', themeMode: ThemeMode.dark, theme: ThemeData( - platform: TargetPlatform.iOS, primarySwatch: Colors.orange, primaryColor: Colors.orange, accentColor: Colors.grey, @@ -25,6 +27,28 @@ class App extends StatelessWidget { ), home: HomePage(), debugShowCheckedModeBanner: false, - )); + localizationsDelegates: [ + const AppLocalizationsDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate + ], + supportedLocales: [ + const Locale('pl', ''), + const Locale('en', ''), + const Locale('de', '') + ], + localeResolutionCallback: + (Locale locale, Iterable supportedLocales) { + for (Locale supportedLocale in supportedLocales) { + if (supportedLocale.languageCode == locale.languageCode || + supportedLocale.countryCode == locale.countryCode) { + return supportedLocale; + } + } + return supportedLocales.first; + }, + ); + }, + )); } } diff --git a/lib/settings.dart b/lib/settings.dart index 606fe41..7a04add 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -1,34 +1,45 @@ import 'dart:convert'; +import 'package:menui_mobile/localizations.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter/material.dart'; import 'package:package_info/package_info.dart'; class MenuiSettings { // SET LANGUAGE - void setLanguage(String lang) async { + void setLanguage(String lang, BuildContext context) async { final settings = await SharedPreferences.getInstance(); settings.setString('language', lang); - print('Language set to: $lang'); + await AppLocalizations.instance.load(Locale(lang, '')); + String newLang = AppLocalizations.instance.getLocale(); + AppBuilder.of(context).rebuild(lang); } // GET LANGUAGE - Future getLanguage() async { + Future getLanguage(BuildContext context) async { final settings = await SharedPreferences.getInstance(); if (settings.containsKey('language')) { final String language = settings.getString('language'); return language; } else { - settings.setString('language', 'pl'); + setLanguage('pl', context); return 'pl'; } } + // INIT LANGUAGE + void initLanguage(BuildContext context) async { + final String language = await getLanguage(context); + String currentLanguage = AppLocalizations.instance.getLocale(); + if (currentLanguage != language) { + await setLanguage(language, context); + } + } + // SET RADIUS void setRadius(int radiusMeters) async { final settings = await SharedPreferences.getInstance(); settings.setInt('radius', radiusMeters); - print('Radius set to: $radiusMeters'); } // GET RADIUS @@ -47,7 +58,6 @@ class MenuiSettings { void setRecommendations(bool recommend) async { final settings = await SharedPreferences.getInstance(); settings.setBool('recommendations', recommend); - print('Recommendations set to: $recommend'); } // GET RECOMMENDATIONS @@ -67,13 +77,13 @@ class MenuiSettings { String language; switch (languageCode) { case 'pl': - language = 'Polski'; + language = AppLocalizations.instance.text("pl"); break; case 'en': - language = 'English'; + language = AppLocalizations.instance.text("en"); break; case 'de': - language = 'Deutsch'; + language = AppLocalizations.instance.text("de"); break; } return language; @@ -82,9 +92,9 @@ class MenuiSettings { // DECODE BOOL String decodeBool(bool value) { if (value == true) { - return "Tak"; + return AppLocalizations.instance.text("yes"); } else { - return "Nie"; + return AppLocalizations.instance.text("no"); } } @@ -180,7 +190,6 @@ class MenuiSettings { final List result = settings.getStringList('favorites'); return result; } else { - print('Favorites Empty'); return []; } } @@ -201,9 +210,41 @@ class MenuiSettings { } } +class AppBuilder extends StatefulWidget { + final Function(BuildContext) builder; + + const AppBuilder({Key key, this.builder}) : super(key: key); + + @override + AppBuilderState createState() => new AppBuilderState(); + + static AppBuilderState of(BuildContext context) { + return context.findAncestorStateOfType(); + } +} + +class AppBuilderState extends State { + String languageCode; + + @override + Widget build(BuildContext context) { + return widget.builder(context); + } + + void rebuild(String language) { + print('REBUILDING...'); + if (languageCode == null || languageCode != language) { + print('languageCode: $languageCode /// newLanguage: $language'); + setState(() { + languageCode = language; + }); + } + } +} + void showSettings(BuildContext context, MenuiSettings settings) async { FocusManager.instance.primaryFocus.unfocus(); - final String languageCode = await settings.getLanguage(); + final String languageCode = await settings.getLanguage(context); final String language = settings.decodeLanguage(languageCode); final int radius = await settings.getRadius(); final bool recommendationsValue = await settings.getRecommendations(); @@ -222,7 +263,7 @@ void showSettings(BuildContext context, MenuiSettings settings) async { children: [ ListTile( title: Text( - 'Język', + AppLocalizations.instance.text("language"), style: TextStyle(color: Colors.white), ), subtitle: Text( @@ -239,7 +280,7 @@ void showSettings(BuildContext context, MenuiSettings settings) async { }), ListTile( title: Text( - 'Promień lokalizacji', + AppLocalizations.instance.text("localizationRadius"), style: TextStyle(color: Colors.white), ), subtitle: @@ -254,7 +295,7 @@ void showSettings(BuildContext context, MenuiSettings settings) async { }), ListTile( title: Text( - 'Proponuj restauracje', + AppLocalizations.instance.text("suggest"), style: TextStyle(color: Colors.white), ), subtitle: @@ -269,7 +310,7 @@ void showSettings(BuildContext context, MenuiSettings settings) async { }), ListTile( title: Text( - 'O aplikacji', + AppLocalizations.instance.text("aboutApp"), style: TextStyle(color: Colors.white), ), leading: Icon( @@ -287,13 +328,13 @@ void showSettings(BuildContext context, MenuiSettings settings) async { void showLanguageSelectionDialog( BuildContext context, MenuiSettings settings) async { - final currentLanguage = await settings.getLanguage(); + final currentLanguage = await settings.getLanguage(context); showDialog( context: context, builder: (BuildContext context) { return SimpleDialog( title: Text( - 'Język', + AppLocalizations.instance.text("language"), style: TextStyle(color: Colors.white, fontSize: 16), textAlign: TextAlign.center, ), @@ -303,33 +344,33 @@ void showLanguageSelectionDialog( children: [ SimpleDialogOption( onPressed: () { - settings.setLanguage('pl'); + settings.setLanguage('pl', context); Navigator.pop(context); }, child: Text( - 'Polski', + AppLocalizations.instance.text("pl"), style: TextStyle(color: getOptionColor(currentLanguage, 'pl')), textAlign: TextAlign.center, ), ), SimpleDialogOption( onPressed: () { - settings.setLanguage('en'); + settings.setLanguage('en', context); Navigator.pop(context); }, child: Text( - 'English', + AppLocalizations.instance.text("en"), style: TextStyle(color: getOptionColor(currentLanguage, 'en')), textAlign: TextAlign.center, ), ), SimpleDialogOption( onPressed: () { - settings.setLanguage('de'); + settings.setLanguage('de', context); Navigator.pop(context); }, child: Text( - 'Deutsch', + AppLocalizations.instance.text("de"), style: TextStyle(color: getOptionColor(currentLanguage, 'de')), textAlign: TextAlign.center, ), @@ -349,7 +390,7 @@ void showRecommendationsDialog( builder: (BuildContext context) { return SimpleDialog( title: Text( - 'Polecaj restauracje w okolicy', + AppLocalizations.instance.text("suggest"), style: TextStyle(color: Colors.white, fontSize: 16), textAlign: TextAlign.center, ), @@ -363,7 +404,7 @@ void showRecommendationsDialog( Navigator.pop(context); }, child: Text( - 'Tak', + AppLocalizations.instance.text("yes"), style: TextStyle(color: getOptionColor(showRecommendations, true)), textAlign: TextAlign.center, @@ -375,7 +416,7 @@ void showRecommendationsDialog( Navigator.pop(context); }, child: Text( - 'Nie', + AppLocalizations.instance.text("no"), style: TextStyle( color: getOptionColor(showRecommendations, false)), textAlign: TextAlign.center, @@ -402,7 +443,7 @@ void showAppInfoDialog(BuildContext context) async { children: [ ListTile( title: Text( - 'Wersja aplikacji', + AppLocalizations.instance.text("appVersion"), textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), @@ -413,7 +454,7 @@ void showAppInfoDialog(BuildContext context) async { )), ListTile( title: Text( - 'Wsparcie', + AppLocalizations.instance.text("support"), textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), @@ -469,7 +510,7 @@ class _RadiusSliderState extends State { Widget build(BuildContext context) { return SimpleDialog( title: Text( - 'Promień lokalizacji', + AppLocalizations.instance.text("localizationRadius"), style: TextStyle(color: Colors.white, fontSize: 16), textAlign: TextAlign.center, ), @@ -496,8 +537,8 @@ class _RadiusSliderState extends State { } Navigator.pop(context); }, - child: const Text( - 'Zapisz', + child: Text( + AppLocalizations.instance.text("save"), style: TextStyle(color: Colors.white), textAlign: TextAlign.center, ), diff --git a/locale/locale_de.json b/locale/locale_de.json new file mode 100644 index 0000000..4a73247 --- /dev/null +++ b/locale/locale_de.json @@ -0,0 +1,79 @@ +{ + "geosearch": "Was ist in der Nähe", + "or": "oder", + "search": "Suchen", + "order": "Bestellung", + "favorites": "Beobachten", + "settings": "Einstellungen", + "searchbar": "Stadt/Name des Restaurants eingeben", + "clear": "Löschen", + "orderEmpty": "Noch keine Bestellung", + "language": "Sprache", + "pl": "polnisch", + "en": "englisch", + "de": "deutsch", + "localizationRadius": "Umkreis", + "suggest": "Restaurant vorschlagen", + "yes": "Ja", + "no": "Nein", + "aboutApp": "Über uns", + "appVersion": "App version", + "support": "Hilfe", + "foundCounter": "Suchergebnisse für Ihre Suche:", + "filter": "Filtern", + "typeOfFood": "Küche", + "tags": "Tags", + "cardPayments": "Mit Karte bezahlen", + "pets": "Wir lieben Tiere", + "pets1": "Pet", + "pets2": "friendly", + "glutenFree": "Gluteinfrei", + "vegan": "Vegan", + "vegetarian": "Vegetarisch", + "alcohol": "Alkohol", + "delivery": "Lieferservice", + "map": "Map", + "share": "Share", + "add": "hinzufügen", + "remove": "entfernen", + "info": "Infos", + "type": "Küche", + "adress": "Adresse", + "contact": "Kontakt", + "hours": "Öfnungszeiten", + "social": "Social media", + "showDishes": "Menü", + "hideDishes": "Close", + "addToOrder": "Zur Bestellung hinzufügen", + "mayContain": "Kann enthalten", + "gluten": "Gluten", + "lactose": "Laktose", + "sesame": "Sesam", + "peanuts": "Nüsse", + "seaFood": "Meeresfrüchte", + "eggs": "Eier", + "soy": "Soja", + "ingredients": "Zutaten", + "energy": "Brennwert", + "glicemicIndex": "Glykämischer Index", + "addedToOrder": "Zur Bestellung hinzugefügt", + "notes": "Anmerkungen", + "dishVegan": "Veganische Gerichte", + "dishVegetarian": "Vegetarianische Gerichte", + "quantity": "Anzahl", + "variant": "Variante", + "save": "Save", + "cardPayments1": "Bezahlen", + "cardPayments2": "Karte", + "radius": "Umkreis", + "error": "Fehler", + "searching": "Searching...", + "closed": "Geschlossen", + "mo": "Mo.", + "tu": "Di.", + "we": "Mi.", + "th": "Do.", + "fr": "Fr.", + "sa": "Sa.", + "su": "So." +} \ No newline at end of file diff --git a/locale/locale_en.json b/locale/locale_en.json new file mode 100644 index 0000000..a1b3d56 --- /dev/null +++ b/locale/locale_en.json @@ -0,0 +1,79 @@ +{ + "geosearch": "Show nearby", + "or": "or", + "search": "Search", + "order": "Order", + "favorites": "Favorites", + "settings": "Settings", + "searchbar": "Search by city or name.", + "clear": "Clear", + "orderEmpty": "Order is empty.", + "language": "Language", + "pl": "Polski", + "en": "English", + "de": "Deutsch", + "localizationRadius": "Localization radius", + "suggest": "Suggest restaurants", + "yes": "Yes", + "no": "No", + "aboutApp": "About Menui", + "appVersion": "App version", + "support": "Support", + "foundCounter": "Found:", + "filter": "Filter", + "typeOfFood": "Food", + "tags": "Tags", + "cardPayments": "Card payments", + "pets": "Pet friendly", + "pets1": "Pet", + "pets2": "friendly", + "glutenFree": "Glutenfree", + "vegan": "Vegan", + "vegetarian": "Vegetarian", + "alcohol": "Alcohol", + "delivery": "Delivery", + "map": "Map", + "share": "Share", + "add": "Add", + "remove": "Remove", + "info": "Info", + "type": "Food:", + "adress": "Adress:", + "contact": "Contact:", + "hours": "Working hours", + "social": "Social media", + "showDishes": "Show dishes", + "hideDishes": "Close", + "addToOrder": "Add to order", + "mayContain": "May contain", + "gluten": "Gluten", + "lactose": "Lactose", + "sesame": "Sesame", + "peanuts": "Peanuts", + "seaFood": "Seafood", + "eggs": "Eggs", + "soy": "Soy", + "ingredients": "Ingredients", + "energy": "Energy value", + "glicemicIndex": "Glycemic index", + "addedToOrder": "Dish added to order", + "notes": "Notes", + "dishVegan": "Vegan", + "dishVegetarian": "Vegetarian", + "quantity": "Quantity", + "variant": "Variant", + "save": "Save", + "cardPayments1": "Card", + "cardPayments2": "payments", + "radius": "Radius", + "error": "Error", + "searching": "Searching...", + "closed": "closed", + "mo": "Mo", + "tu": "Tu", + "we": "We", + "th": "Th", + "fr": "Fr", + "sa": "Sa", + "su": "Su" +} \ No newline at end of file diff --git a/locale/locale_pl.json b/locale/locale_pl.json new file mode 100644 index 0000000..6463876 --- /dev/null +++ b/locale/locale_pl.json @@ -0,0 +1,79 @@ +{ + "geosearch": "Pokaż w pobliżu", + "or": "lub", + "search": "Szukaj", + "order": "Zamównienie", + "favorites": "Ulubione", + "settings": "Ustawienia", + "searchbar": "Wyszukaj miasto lub nazwę restauracji.", + "clear": "Wyczyść", + "orderEmpty": "Zamówienie jest puste.", + "language": "Język", + "pl": "Polski", + "en": "English", + "de": "Deutsch", + "localizationRadius": "Promień lokalizacji", + "suggest": "Proponuj restauracje", + "yes": "Tak", + "no": "Nie", + "aboutApp": "O aplikacji", + "appVersion": "Wersja aplikacji", + "support": "Wsparcie", + "foundCounter": "Znaleziono:", + "filter": "Filtruj", + "typeOfFood": "Rodzaj kuchni", + "tags": "Tagi", + "cardPayments": "Płatność kartą", + "pets": "Lubimy zwierzaki", + "pets1": "Lubimy", + "pets2": "zwierzaki", + "glutenFree": "Bez glutenu", + "vegan": "Wegańskie", + "vegetarian": "Wegetariańskie", + "alcohol": "Alkohol", + "delivery": "Dowozimy", + "map": "Mapa", + "share": "Udostępnij", + "add": "Dodaj", + "remove": "Usuń", + "info": "Informacje", + "type": "Kuchnia:", + "adress": "Adres:", + "contact": "Kontakt:", + "hours": "Godziny otwarcia", + "social": "Social media", + "showDishes": "Karta dań", + "hideDishes": "Zwiń", + "addToOrder": "Do zamównienia", + "mayContain": "Może zawierać", + "gluten": "Gluten", + "lactose": "Laktoza", + "sesame": "Sezam", + "peanuts": "Orzechy", + "seaFood": "Owoce morza", + "eggs": "Jaja", + "soy": "Soja", + "ingredients": "Składniki", + "energy": "Wartość energetyczna", + "glicemicIndex": "Indeks glikemiczny", + "addedToOrder": "Dodano do zamównienia", + "notes": "Uwagi", + "dishVegan": "Danie wegańskie", + "dishVegetarian": "Danie wegetariańskie", + "quantity": "Ilość", + "variant": "Wariant", + "save": "Zapisz", + "cardPayments1": "Płatność", + "cardPayments2": "kartą", + "radius": "Promień", + "error": "Błąd", + "searching": "Szukam...", + "closed": "nieczynne", + "mo": "Pn", + "tu": "Wt", + "we": "Śr", + "th": "Czw", + "fr": "Pt", + "sa": "So", + "su": "Nie" +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 1983468..20bf63e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -76,6 +76,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5cce3f4..cac2baf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+3 +version: 1.0.1+4 environment: sdk: ">=2.7.0 <3.0.0" @@ -27,6 +27,8 @@ dependencies: font_awesome_flutter: ^8.10.0 flutter: sdk: flutter + flutter_localizations: + sdk: flutter shared_preferences: ^0.5.12 google_maps_flutter: ^1.0.6 package_info: ^0.4.0+16 @@ -50,6 +52,9 @@ flutter: uses-material-design: true assets: - img/ + - locale/locale_pl.json + - locale/locale_en.json + - locale/locale_de.json # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.