Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:places/theme/colors.dart';

/// App text
class AppTexts {
static const appHeader = 'Список\nинтересных мест';
Expand All @@ -19,14 +15,17 @@ class AppTexts {
'Отмечайте понравившиеся\n места и они появятся здесь.';
static const tagPlacesYouVisited =
'Завершите маршрут,\n чтобы место попало сюда.';
}

// /// Sight card decorations
// class AppDecorations {
// static const cardDecoration = BoxDecoration(
// color: AppColors.ltCardBackground,
// borderRadius: BorderRadius.all(
// Radius.circular(16),
// ),
// );
// }
static const String filtersDistanceMeters = 'м';
static const String filtersDistanceKilometers = 'км';
static const String filtersCategories = 'Категории';
static const String filtersDistance = 'Расстояние';
static const String filtersFrom = 'от';
static const String filtersTo = 'до';
static const String filtersShow = 'Показать';
static const String filtersClear = 'Очистить';

static const String settings = 'Настройки';
static const String darkTheme = 'Тёмная тема';
static const String watchTutorial = 'Смотреть туториал';
}
4 changes: 2 additions & 2 deletions lib/domain/sight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
/// Sight model
class Sight {
final String nameSight;
final double lan;
final double lat;
final double lon;
final String url;
final String details;
Expand All @@ -15,7 +15,7 @@ class Sight {

Sight(
{@required this.nameSight,
@required this.lan,
@required this.lat,
@required this.lon,
@required this.url,
@required this.details,
Expand Down
9 changes: 9 additions & 0 deletions lib/domain/sight_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Sight type for Filter screen
/// Converting 'icon name' to 'String' for SvgImage.asset() by [getIconByName]

class SightType {
final String name;
final String iconName;

const SightType({this.name, this.iconName});
}
28 changes: 28 additions & 0 deletions lib/domain/sight_type_icon_helper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:places/theme/custom_icons.dart';

/// Function returns [String] for SvgImage.asset() by icon's name [iconName]

String getIconByName(String iconName) {
// SvgPicture icon;
switch (iconName) {
case 'Hotel':
iconName = iconHotel;
break;
case 'Restaurant':
iconName = iconRestaurant;
break;
case 'ParticularPlace':
iconName = iconParticularPlace;
break;
case 'Park':
iconName = iconPark;
break;
case 'Museum':
iconName = iconMuseum;
break;
case 'Cafe':
iconName = iconCafe;
break;
}
return iconName;
}
46 changes: 40 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:places/ui/settings_screen.dart';
import 'package:places/ui/widgets/empty_visited_places.dart';
import 'package:places/ui/screen/sight_details.dart';
import 'package:places/ui/sight_card_widgets/sight_card.dart';
Expand All @@ -7,6 +8,10 @@ import 'package:places/ui/screen/visiting_screen.dart';
import 'package:places/ui/widgets/empty_favorites_places.dart';
import 'mocks.dart';
import 'package:places/ui/screen/res/themes.dart';
import 'package:places/ui/screen/filters_screen/filters_screen.dart';

/// current theme storage
final themeState = ThemeState();

void main() {
runApp(MyApp());
Expand All @@ -18,16 +23,45 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
themeState.addListener(_onThemeChange);
}

@override
void dispose() {
themeState.removeListener(_onThemeChange);
super.dispose();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: lightTheme,
theme: themeState.isDark ? darkTheme : lightTheme,
debugShowCheckedModeBanner: false,
//home: SightListScreen(),
home: SightDetails(
sight: mocks[6],
),
//home: VisitingScreen(),
// home: SightListScreen(),
// home: SightDetails(
// sight: mocks[6],
// ),
// home: VisitingScreen(),
//home: FiltersScreen(),
home: SettingsScreen(),
);
}

void _onThemeChange() => setState(() {});
}

// Временно лежит здесь. После прохождения темы "хранение данных" займет положенное место.
// Тема меняется парамаетром [ThemeState.isDark], подписываемся на обновления и меняем тему в MaterialApp. Смена темы происходит в [SettingsScreen]
class ThemeState extends ChangeNotifier {
bool _isDark = false;

bool get isDark => _isDark;

set isDark(bool newVal) {
_isDark = newVal;
notifyListeners();
}
}
67 changes: 49 additions & 18 deletions lib/mocks.dart
Original file line number Diff line number Diff line change
@@ -1,85 +1,116 @@
import 'package:flutter/material.dart';
import 'package:places/domain/sight.dart';
import 'package:places/domain/sight_type.dart';

/// Categories
final List<SightType> typeMocks = [
SightType(
name: 'Отель',
iconName: 'Hotel',
),
SightType(
name: 'Ресторан',
iconName: 'Restaurant',
),
SightType(
name: 'Особое место',
iconName: 'ParticularPlace',
),
SightType(
name: 'Парк',
iconName: 'Park',
),
SightType(
name: 'Музей',
iconName: 'Museum',
),
SightType(
name: 'Кафе',
iconName: 'Cafe',
),
];

/// Places
final List<Sight> mocks = [
Sight(
nameSight: 'Surf Studio',
lan: 51.664264,
lat: 51.664264,
lon: 39.201271,
url: 'https://ia.wampi.ru/2020/12/25/OLE30HKCAqA.jpg',
details:
'офис Surf Studio. Нормальной фотки не нашел, поэтому вот вам я. В камеру смотрю',
type: 'building',
type: 'Музей',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 9, minute: 0),
closeTime: TimeOfDay(hour: 21, minute: 0),
),
Sight(
nameSight: 'Мой дом',
lan: 51.700504,
lat: 51.700504,
lon: 39.204497,
url: 'https://ia.wampi.ru/2020/12/25/IhgbY-glBRY.jpg',
details: 'Мой дом. Здесь я сижу и смотрю вас',
type: 'building',
type: 'Музей',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 7, minute: 0),
closeTime: TimeOfDay(hour: 21, minute: 0),
),
Sight(
nameSight: 'Блошиный рынок',
lan: 51.705625,
lat: 51.705625,
lon: 39.137255,
url: 'https://ia.wampi.ru/2020/12/25/nsMGyaYgKFI.jpg',
details:
'Блошиный рынок. Довольно странное место, но здесь я провожу все выходные покупая ерунду',
type: 'event',
type: 'Парк',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 9, minute: 0),
closeTime: TimeOfDay(hour: 12, minute: 0),
),
Sight(
nameSight: 'Рейв в лесу',
lan: 51.788332,
lat: 51.788332,
lon: 39.205264,
url: 'https://ia.wampi.ru/2021/01/16/IMG_20200822_030142.jpg',
details:
'Меня как-то угораздило сюда попасть. Выглядит клево, но жутковато:D',
type: 'event',
'Меня как-то угораздило сюда попасть. Выглядит клево, но жутковато:D',
type: 'Особое место',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 22, minute: 0),
closeTime: TimeOfDay(hour: 23, minute: 59),
),
Sight(
nameSight: 'Русский магазин в Гуанчжоу',
lan: 23.098822,
lat: 23.098822,
lon: 113.314972,
url: 'https://ia.wampi.ru/2021/01/16/IMG_20190921_203644_105.jpg',
details:
'Самое популярное место сбора моделей в Гуанчжоу. Атмосферные вечера с ребятами из разных стран и знакомые продукты из СНГ. Эх, вернуться бы туда на вечерок)',
type: 'place',
'Самое популярное место сбора моделей в Гуанчжоу. Атмосферные вечера с ребятами из разных стран и знакомые продукты из СНГ. Эх, вернуться бы туда на вечерок)',
type: 'Ресторан',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 20, minute: 0),
closeTime: TimeOfDay(hour: 23, minute: 0),
),
Sight(
nameSight: 'Шанхай',
lan: 31.273409,
lat: 31.273409,
lon: 121.474693,
url: 'https://ia.wampi.ru/2021/01/16/IMG_20190226_095603.jpg',
details:
'А здесь я жил и работал в Шанхае. Очень красивый и невероятно современный город',
type: 'place',
'А здесь я жил и работал в Шанхае. Очень красивый и невероятно современный город',
type: 'Особое место',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 9, minute: 0),
closeTime: TimeOfDay(hour: 21, minute: 0),
),
Sight(
nameSight: 'Хочу на стажировку',
lan: 51.664264,
lat: 51.664264,
lon: 39.201271,
url: 'https://ic.wampi.ru/2021/03/11/Y6iQsGiA1qw.jpg',
details: 'Давно хочу у вас работать! Я даже специально купил новый мак на М1 с 16гб!',
type: 'place',
details:
'Давно хочу у вас работать! Я даже специально купил новый мак на М1 с 16гб!',
type: 'Особое место',
workTime: 'Закрыто до 09:00',
openTime: TimeOfDay(hour: 9, minute: 0),
closeTime: TimeOfDay(hour: 21, minute: 0),
Expand Down
2 changes: 1 addition & 1 deletion lib/theme/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AppColors {
static const ltActiveColor = ltPrimaryColor;

/// Dark theme colors
static const dtGreen = Color(0xFF6ADA6F);
static const dtAccentColor = Color(0xFF6ADA6F);
static const dtRed = Color(0xFFCF2A2A);
static const dtPrimaryColorDark = Color(0xFF1A1A20);
static const dtPrimaryColor = Color(0xFF21222C);
Expand Down
10 changes: 10 additions & 0 deletions lib/theme/custom_icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ const iconShare = 'assets/icons/Share.svg';
const iconGO = 'assets/icons/GO.svg';
const iconGOBig = 'assets/icons/GOBig.svg';
const iconEmptyFavoritesPlaces = 'assets/icons/EmptyFavoritesPlaces.svg';

const iconHotel = 'assets/icons/Hotel.svg';
const iconRestaurant = 'assets/icons/Restaurant.svg';
const iconParticularPlace = 'assets/icons/ParticularPlace.svg';
const iconPark = 'assets/icons/Park.svg';
const iconMuseum = 'assets/icons/Museum.svg';
const iconCafe = 'assets/icons/Cafe.svg';
const iconChoice = 'assets/icons/Choice.svg';

const iconInfo = 'assets/icons/Info.svg';
Loading