Skip to content

Commit

Permalink
Merge pull request #25 from StarProxima/release-v0.8
Browse files Browse the repository at this point in the history
Release v0.8
  • Loading branch information
StarProxima authored May 6, 2023
2 parents cfd6658 + 16f3698 commit 22fe949
Show file tree
Hide file tree
Showing 57 changed files with 1,416 additions and 604 deletions.
2 changes: 1 addition & 1 deletion lib/api/cube_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';

final cubeApi = Provider<CubeApi>((ref) {
return CubeApi.create(
baseUrl: Uri.tryParse('https://api.cube.nlabs.su/'),
baseUrl: Uri.tryParse('http://2qkhm0fz-test.api.cube.nlabs.su'),
);
});
4 changes: 2 additions & 2 deletions lib/features/analytics/analytical_logger_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'package:proxima_logger/proxima_logger.dart' as pr;

import 'package:cube_system/features/analytics/log_type.dart';

import 'package:cube_system/core/utils.dart';
import 'package:cube_system/features/analytics/logger.dart';

mixin AnalyticalLoggerMixin on pr.ProximaLogger {
Future<void> event(String name, [Map<String, Object>? attributes]) async {
if (kIsMobile) {
if (shouldReportEvent) {
await AppMetrica.reportEventWithMap(name, attributes);
}
}
Expand Down
8 changes: 5 additions & 3 deletions lib/features/analytics/logger.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:appmetrica_plugin/appmetrica_plugin.dart';
import 'package:cube_system/core/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:proxima_logger/proxima_logger.dart' as pr;

import 'package:cube_system/features/analytics/analytical_logger_mixin.dart';
Expand All @@ -9,6 +9,8 @@ import 'package:cube_system/features/analytics/log_type.dart';

final logger = AppLogger();

final shouldReportEvent = kIsMobile && !kDebugMode;

class AppLogger extends pr.ProximaLogger with AnalyticalLoggerMixin {
AppLogger()
: super(
Expand All @@ -27,7 +29,7 @@ class AppLogger extends pr.ProximaLogger with AnalyticalLoggerMixin {
);

void error(Object error, StackTrace stackTrace) {
if (kIsMobile) {
if (shouldReportEvent) {
AppMetrica.reportError(
errorDescription: AppMetricaErrorDescription.fromObjectAndStackTrace(
error,
Expand All @@ -44,7 +46,7 @@ class AppLogger extends pr.ProximaLogger with AnalyticalLoggerMixin {
}

void flutterError(FlutterErrorDetails details) {
if (kIsMobile) {
if (shouldReportEvent) {
AppMetrica.reportError(
message: null,
errorDescription:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class _LandingWelcomePageState extends ConsumerState<LandingWelcomePage>
],
),
Text(
"Расписание",
'Расписание',
style: context.textStyles.largeTitle.copyWith(
fontSize: 32,
color: context.colors.text,
Expand All @@ -156,7 +156,7 @@ class _LandingWelcomePageState extends ConsumerState<LandingWelcomePage>
),
const SizedBox(height: 48),
Text(
"Организуйте свою академическую жизнь c современным электронным расписанием: актуальность, легкий доступ и приятный дизайн для студентов и преподавателей.",
'Cовременный сервис учебного расписания для студентов, преподавателей и всех желающих, предоставляющий удобный и быстрый доступ, где бы вы ни находились.',
style: context.textStyles.subTitle.copyWith(
fontSize: 16,
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/settings/managers/settings_manager.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 2 additions & 5 deletions lib/features/settings/models/app_settings/app_settings.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,24 @@ part 'lesson_card_lesson_type_position.g.dart';
@HiveType(typeId: 10)
enum LessonCardLessonTypePosition {
@HiveField(0)
@JsonValue('afterBottomLeftBlock')
afterBottomLeftBlock,
@JsonValue('onIndicator')
onIndicator,
@HiveField(1)
@JsonValue('afterTopLeftBlock')
afterTopLeftBlock,
@HiveField(2)
@JsonValue('bottomLeft')
bottomLeft,
@HiveField(3)
@JsonValue('topRight')
topRight,
@HiveField(4)
@JsonValue('bottomRight')
bottomRight,
@HiveField(5)
@HiveField(2)
@JsonValue('afterBottomLeftBlock')
afterBottomLeftBlock,
@HiveField(3)
@JsonValue('beforeBottomRightBlock')
beforeBottomRightBlock,
@HiveField(6)
@JsonValue('onIndicator')
onIndicator,
@HiveField(7)
@HiveField(4)
@JsonValue('none')
none;

bool get isAfterBottomLeftBlock =>
this == LessonCardLessonTypePosition.afterBottomLeftBlock;
bool get isAfterTopLeftBlock =>
this == LessonCardLessonTypePosition.afterTopLeftBlock;
bool get isBottomLeft => this == LessonCardLessonTypePosition.bottomLeft;
bool get isTopRight => this == LessonCardLessonTypePosition.topRight;

bool get isBottomRight => this == LessonCardLessonTypePosition.bottomRight;
bool get isBeforeBottomRightBlock =>
this == LessonCardLessonTypePosition.beforeBottomRightBlock;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ class _SettingsPageLessonCardLessonTypePosition extends ConsumerWidget {
settingsNotifier.editLessonCardLessonTypePosition(value),
items: const [
AppRadioSelectorItem(
title: Text('Снизу справа'),
description: Text('Выбор по умолчанию'),
value: LessonCardLessonTypePosition.bottomRight,
title: Text('На идикаторе'),
description: Text(
'Выбор по умолчанию. Вертикальный текст на левом индикаторе.',
),
value: LessonCardLessonTypePosition.onIndicator,
),
AppRadioSelectorItem(
title: Text('Снизу слева'),
value: LessonCardLessonTypePosition.bottomLeft,
title: Text('Снизу справа'),
value: LessonCardLessonTypePosition.bottomRight,
),
AppRadioSelectorItem(
title: Text('После нижнего левого блока'),
Expand All @@ -37,19 +39,6 @@ class _SettingsPageLessonCardLessonTypePosition extends ConsumerWidget {
title: Text('Перед нижним правым блоком'),
value: LessonCardLessonTypePosition.beforeBottomRightBlock,
),
AppRadioSelectorItem(
title: Text('Сверху справа'),
value: LessonCardLessonTypePosition.topRight,
),
AppRadioSelectorItem(
title: Text('После верхнего левого блока'),
value: LessonCardLessonTypePosition.afterTopLeftBlock,
),
AppRadioSelectorItem(
title: Text('На идикаторе'),
description: Text('Вертикальное расположение слева'),
value: LessonCardLessonTypePosition.onIndicator,
),
AppRadioSelectorItem(
title: Text('Отсутствует'),
description: Text('Впрочем, действительно, можно и без него'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:cube_system/features/timetable_page/state_holders/lessons/curren

final currentLessonTimeToEndProvider = Provider<DateTimeDuration?>((ref) {
final currentDateTime = ref.watch(currentDateTimeQuick);
final activeLesson = ref.watch(currentLesson);
final activeLesson = ref.watch(currentLessonStateHolder);

if (activeLesson == null) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ final nextLessonTimeToStartProgressValueProvider = Provider<double>((ref) {
final timeLeft = ref.read(nextLessonTimeToStartProvider)?.duration;
if (timeLeft == null) return 1;

final lessonNext = ref.watch(nextLesson);
final lessonLast = ref.watch(lastLesson);
final lessonNext = ref.watch(nextLessonStateHolder);
final lessonLast = ref.watch(lastLessonStateHolder);

if (lessonNext == null || lessonLast == null) return 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ final nextLessonTimeToStartProvider = Provider<DateTimeDuration?>((ref) {
if (condition.isNever) return null;

if (condition.isOnlyRecessBetweenLessons) {
final last = ref.watch(lastLesson);
final next = ref.watch(nextLesson);
final last = ref.watch(lastLessonStateHolder);
final next = ref.watch(nextLessonStateHolder);
if (last == null || next == null) return null;
if (next.number - last.number != 1) return null;
}

final next = ref.watch(nextLesson);
final next = ref.watch(nextLessonStateHolder);

if (next == null) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:math';

import 'package:cube_system/features/settings/state_holders/app_settings_state_holder.dart';
import 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/recess_card.dart';
import 'package:cube_system/features/timetable_page/managers/timetable_page_manager.dart';
import 'package:cube_system/features/timetable_page/state_holders/selected_timetable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand All @@ -24,12 +23,16 @@ import 'package:cube_system/features/settings/state_holders/app_lesson_colors.da

import 'package:cube_system/features/timetable_page/state_holders/lessons/next_lesson.dart';

import 'package:cube_system/features/timetable_page/managers/timetable_lessons_manager.dart';

part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_body.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_footer.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_header.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_icons.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/info_panel/lesson_card_info_panel_icon.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/info_panel/lesson_card_info_panel_chip.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/info_panel/lesson_card_info_panel_time_to_end.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/info_panel/lesson_card_info_panel.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_indicator.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_time_left.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/next_lesson_time_to_start_progress_bar.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_lesson_type_chip.dart';
part 'package:cube_system/features/timetable_page/features/lesson_card/ui/widgets/lesson_card_time_to_start.dart';
Expand All @@ -46,23 +49,22 @@ class LessonCard extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final manager = ref.watch(timetablePageManager);
return ProviderScope(
overrides: [
_lessonInLessonCard.overrideWithValue(lesson),
],
child: Column(
children: [
const LessonCardRecess(
margin: EdgeInsets.only(bottom: 12, top: 8),
margin: EdgeInsets.only(bottom: 12, top: 9),
),
const LessonCardTimeToStart(
margin: EdgeInsets.only(bottom: 8, top: 4),
margin: EdgeInsets.only(bottom: 9, top: 4),
),
Stack(
children: [
Container(
margin: const EdgeInsets.only(top: 8),
margin: const EdgeInsets.only(top: 9),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: context.colors.background,
Expand All @@ -84,7 +86,6 @@ class LessonCard extends ConsumerWidget {
const LessonCardIndicator(),
Expanded(
child: InkWell(
onTap: manager.findLastCurrentNextLesson,
child: Column(
children: [
Padding(
Expand Down Expand Up @@ -125,7 +126,7 @@ class LessonCard extends ConsumerWidget {
const Positioned(
top: 0,
right: 8,
child: LessonCardIcons(),
child: LessonCardInfoPanel(),
),
],
),
Expand Down
Loading

0 comments on commit 22fe949

Please sign in to comment.