Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.7 #23

Merged
merged 7 commits into from
Apr 25, 2023
Merged
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
4 changes: 2 additions & 2 deletions lib/core/hive_initializer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:cube_system/features/settings/models/app_theme_mode/app_theme_mo
import 'package:cube_system/features/settings/models/lesson_card_recess_display_condition/lesson_card_recess_display_condition.dart';
import 'package:cube_system/models/adapters/time_of_day_adapter.dart';
import 'package:cube_system/models/lesson/lesson.dart';
import 'package:cube_system/models/lesson_timings/lesson_full_timings.dart';
import 'package:cube_system/models/lesson_timings/lesson_date_timings.dart';
import 'package:cube_system/models/lesson_timings/lesson_timings.dart';
import 'package:cube_system/models/lesson_type/lesson_type.dart';
import 'package:cube_system/models/timetable/timetable_type.dart';
Expand All @@ -30,7 +30,7 @@ abstract class HiveInitializer {
_reg(LessonCardRecessDisplayConditionAdapter());
_reg(TimeOfDayAdapter());
_reg(LessonAdapter());
_reg(LessonFullTimingsAdapter());
_reg(LessonDateTimingsAdapter());
_reg(LessonTimingsAdapter());
_reg(LessonTypeAdapter());
_reg(TimetableInfoAdapter());
Expand Down
2 changes: 2 additions & 0 deletions lib/core/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ import 'dart:io';
import 'package:flutter/foundation.dart';

final kIsMobile = !kIsWeb && Platform.isAndroid || Platform.isIOS;
final kIsDesktop =
!kIsWeb && Platform.isWindows || Platform.isMacOS || Platform.isLinux;
16 changes: 6 additions & 10 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.

4 changes: 2 additions & 2 deletions lib/features/settings/ui/widgets/settings_page_app_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class _SettingsPageAppInfo extends ConsumerWidget {
final packageInfo = ref.watch(packageInfoStateHolder);
return packageInfo.when(
data: (packageInfo) => Text(
"${packageInfo.appName} v${packageInfo.version}+${packageInfo.buildNumber}",
"Куб.Расписание v${packageInfo.version}+${packageInfo.buildNumber}",
style: context.textStyles.smallSubTitle.copyWith(
color: context.colors.subduedText,
),
Expand All @@ -27,7 +27,7 @@ class _SettingsPageAppInfo extends ConsumerWidget {
TextSpan(
children: [
TextSpan(
text: 'Built using ',
text: 'Developed using ',
style: context.textStyles.smallSubTitle.copyWith(
color: context.colors.subduedText,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class _SettingsPageLessonCardLessonTypePosition extends ConsumerWidget {

return AppRadioSelector<LessonCardLessonTypePosition>(
label: const Text(
'Расположение типа занятия в карточке \n(1000 и 1 способ - pre-release overview)',
'Расположение типа занятия в карточке',
),
value: lessonCardLessonTypePosition,
onSelect: (value) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final currentLessonTimeToEndProvider = Provider<DateTimeDuration?>((ref) {

if (activeLesson == null) return null;

final endLessonDateTime = activeLesson.timings.endDateTime;
final endLessonDateTime = activeLesson.dateTimings.endDateTime;
final duration = endLessonDateTime.difference(currentDateTime);

return DateTimeDuration(duration);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:cube_system/models/lesson/lesson.dart';
import 'package:cube_system/features/date_time_contol/state_holders/current_date_time_state_holders.dart';
import 'package:cube_system/models/lesson_timings/lesson_date_timings.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final lessonTimeToEndProgressValueProvider =
Provider.family.autoDispose<double, Lesson>((ref, lesson) {
Provider.family.autoDispose<double, LessonDateTimings>((ref, timings) {
final currentDateTime = ref.watch(currentDateTimeLazy);

final lessonStart = lesson.timings.startDateTime;
final lessonEnd = lesson.timings.endDateTime;
final lessonStart = timings.startDateTime;
final lessonEnd = timings.endDateTime;

final lessonIsOver = currentDateTime.isAfter(lessonEnd);
final lessonNotStarted = currentDateTime.isBefore(lessonStart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ final nextLessonTimeToStartProgressValueProvider = Provider<double>((ref) {

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

final startInterval = lessonLast.timings.endDateTime;
final endInterval = lessonNext.timings.startDateTime;
final startInterval = lessonLast.dateTimings.endDateTime;
final endInterval = lessonNext.dateTimings.startDateTime;

final recessTime = endInterval.difference(startInterval);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final nextLessonTimeToStartProvider = Provider<DateTimeDuration?>((ref) {

final dateTime = ref.watch(currentDateTimeQuick);

final startDateTime = next.timings.startDateTime;
final startDateTime = next.dateTimings.startDateTime;
final duration = startDateTime.difference(dateTime);

return DateTimeDuration(duration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class LessonCard extends ConsumerWidget {
child: Column(
children: [
const LessonCardRecess(
margin: EdgeInsets.only(bottom: 8),
margin: EdgeInsets.only(bottom: 12, top: 8),
),
const LessonCardTimeToStart(
margin: EdgeInsets.only(bottom: 8),
margin: EdgeInsets.only(bottom: 8, top: 4),
),
Stack(
children: [
Expand Down Expand Up @@ -112,6 +112,7 @@ class LessonCard extends ConsumerWidget {
),
child: LessonCardFooter(),
),
const SizedBox(height: 4),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ class LessonCardFooter extends ConsumerWidget {
child: Padding(
padding: const EdgeInsets.only(
top: 4,
bottom: 4,
left: 8,
),
child: Text(
leftText,
style: context.textStyles.smallLabel.copyWith(
color: context.colors.subduedText,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
Expand All @@ -87,6 +88,7 @@ class LessonCardFooter extends ConsumerWidget {
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
if (lessonTypePosition.isBeforeBottomRightBlock)
const Padding(
Expand All @@ -97,18 +99,20 @@ class LessonCardFooter extends ConsumerWidget {
constraints: const BoxConstraints(
maxWidth: 160,
),
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
padding: const EdgeInsets.only(top: 4, left: 8),
child: Text(
rigthText,
style: context.textStyles.smallLabel.copyWith(
color: context.colors.subduedText,
),
textAlign: TextAlign.right,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
if (lessonTypePosition.isBottomRight)
const Padding(
padding: EdgeInsets.only(right: 4),
padding: EdgeInsets.only(right: 4, left: 8),
child: LessonCardLessonTypeChip(),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class LessonCardIndicator extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final lesson = ref.watch(_lessonInLessonCard);

double value = ref.watch(lessonTimeToEndProgressValueProvider(lesson));
final value =
ref.watch(lessonTimeToEndProgressValueProvider(lesson.dateTimings));

final color = ref.watch(appLessonColorByLesson(lesson));

Expand All @@ -16,7 +17,7 @@ class LessonCardIndicator extends ConsumerWidget {
.select((value) => value.lessonCardLessonTypePosition.isOnIndicator),
);

double width = isOnIndicator ? 20 : 6;
final width = isOnIndicator ? 20.0 : 6.0;

return Stack(
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,26 @@ class LessonCardRecess extends ConsumerWidget {
final emptyLessonsBefore = ref
.watch(_lessonInLessonCard.select((value) => value.emptyLessonsBefore));

if (emptyLessonsBefore == 0) {
return const SizedBox();
}

final number =
ref.watch(_lessonInLessonCard.select((value) => value.number));

final numberStart = number - emptyLessonsBefore;
final numberEnd = number - 1;

if (emptyLessonsBefore == 0) {
return const SizedBox();
}
final date = ref.watch(
_lessonInLessonCard.select((value) => value.dateTimings.startDateTime),
);

return Padding(
padding: margin ?? EdgeInsets.zero,
child: RecessCard(
numberStart: numberStart,
numberEnd: numberEnd,
startLessonNumber: numberStart,
endLessonNumber: numberEnd,
dateTime: DateUtils.dateOnly(date),
),
);
}
Expand Down
Loading