Skip to content

Commit

Permalink
Merge pull request #338 from mirea-ninja/release/v1.3.6
Browse files Browse the repository at this point in the history
Release/v1.3.6
  • Loading branch information
0niel authored Sep 15, 2023
2 parents d45ae9f + 9c6880b commit 9f87d04
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 88 deletions.
12 changes: 11 additions & 1 deletion lib/presentation/bloc/news_bloc/news_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ class NewsBloc extends Bloc<NewsEvent, NewsState> {
return tag;
}

static bool isTagsNotEmpty(List<String> tags) {
if (tags.isEmpty) {
return false;
} else if (tags.length == 1 && tags[0].isEmpty) {
return false;
}

return true;
}

void _onNewsLoadEvent(NewsLoadEvent event, Emitter<NewsState> emit) async {
if (state is NewsLoaded) {
final st = state as NewsLoaded;
Expand All @@ -48,7 +58,7 @@ class NewsBloc extends Bloc<NewsEvent, NewsState> {
emit(NewsLoaded(
news: event.refresh == true ? r : st.news + r,
tags: st.tags,
selectedTag: st.selectedTag,
selectedTag: event.tag,
page: st.page + 1,
));
},
Expand Down
5 changes: 3 additions & 2 deletions lib/presentation/pages/news/news_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter_html_iframe/flutter_html_iframe.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:intl/intl.dart';
import 'package:rtu_mirea_app/domain/entities/news_item.dart';
import 'package:rtu_mirea_app/presentation/bloc/news_bloc/news_bloc.dart';
import 'package:rtu_mirea_app/presentation/pages/news/widgets/tag_badge.dart';
import 'package:rtu_mirea_app/presentation/widgets/images_horizontal_slider.dart';
import 'package:url_launcher/url_launcher_string.dart';
Expand Down Expand Up @@ -103,11 +104,11 @@ class _NewsItemInfo extends StatelessWidget {
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: tags.isNotEmpty
mainAxisAlignment: NewsBloc.isTagsNotEmpty(tags)
? MainAxisAlignment.spaceBetween
: MainAxisAlignment.start,
children: [
tags.isNotEmpty
NewsBloc.isTagsNotEmpty(tags)
? Expanded(
child: Wrap(
spacing: 8,
Expand Down
36 changes: 20 additions & 16 deletions lib/presentation/pages/news/news_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,30 @@ class _NewsPageState extends State<NewsPage> {
),
const SizedBox(height: 16),
Expanded(
child: Wrap(
spacing: 8,
runSpacing: 8,
children: List.generate(loadedState.tags.length, (index) {
if (loadedState.selectedTag ==
loadedState.tags[index]) {
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Wrap(
spacing: 8,
runSpacing: 8,
children:
List.generate(loadedState.tags.length, (index) {
if (loadedState.selectedTag ==
loadedState.tags[index]) {
return TagBadge(
tag: loadedState.tags[index],
color: AppTheme.colors.colorful04,
onPressed: () => _filterNewsByTag(
context.read<NewsBloc>(), "все"),
);
}
return TagBadge(
tag: loadedState.tags[index],
color: AppTheme.colors.colorful04,
onPressed: () => _filterNewsByTag(
context.read<NewsBloc>(), "все"),
context.read<NewsBloc>(),
loadedState.tags[index]),
);
}
return TagBadge(
tag: loadedState.tags[index],
onPressed: () => _filterNewsByTag(
context.read<NewsBloc>(),
loadedState.tags[index]),
);
}),
}),
),
),
),
],
Expand Down
17 changes: 5 additions & 12 deletions lib/presentation/pages/news/widgets/news_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:rtu_mirea_app/domain/entities/news_item.dart';
import 'package:intl/intl.dart';
import 'package:rtu_mirea_app/presentation/bloc/news_bloc/news_bloc.dart';
import 'package:rtu_mirea_app/presentation/core/routes/routes.gr.dart';
import 'package:rtu_mirea_app/presentation/pages/news/widgets/tag_badge.dart';
import 'package:rtu_mirea_app/presentation/theme.dart';
Expand All @@ -17,16 +18,6 @@ class NewsCard extends StatelessWidget {
const NewsCard({Key? key, required this.newsItem, this.onClickNewsTag})
: super(key: key);

bool isTagsNotEmpty() {
if (newsItem.tags.isEmpty) {
return false;
} else if (newsItem.tags.length == 1 && newsItem.tags[0].isEmpty) {
return false;
}

return true;
}

@override
Widget build(BuildContext context) {
return GestureDetector(
Expand Down Expand Up @@ -123,8 +114,10 @@ class NewsCard extends StatelessWidget {
textAlign: TextAlign.start,
style: AppTextStyle.captionL
.copyWith(color: AppTheme.colors.secondary)),
isTagsNotEmpty() ? const SizedBox(height: 16) : Container(),
isTagsNotEmpty()
NewsBloc.isTagsNotEmpty(newsItem.tags)
? const SizedBox(height: 16)
: Container(),
NewsBloc.isTagsNotEmpty(newsItem.tags)
? _Tags(
tags: newsItem.tags,
onClick: onClickNewsTag,
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/pages/onboarding/onboarding_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _OnBoardingPageState extends State<OnBoardingPage> {
static const List titlesTexts = [
'Добро пожаловать!',
'Смотри расписание!',
'Будь в курсе, не надевая штаны!',
'Будь в курсе в любой момент!',
// 'Ставь цели!',
//'Коммуницируй!',
];
Expand Down
117 changes: 66 additions & 51 deletions lib/presentation/pages/schedule/widgets/schedule_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class _SchedulePageViewState extends State<SchedulePageView> {
late int _selectedPage;
late int _selectedWeek;

final _scrollNotifier = ValueNotifier<double>(0);

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -160,30 +162,38 @@ class _SchedulePageViewState extends State<SchedulePageView> {
lessons = _getLessonsWithEmpty(lessons, state.activeGroup);
}

return ListView.separated(
itemCount: lessons.length,
physics: const BouncingScrollPhysics(),
itemBuilder: (context, i) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: lessons[i].name.replaceAll(' ', '') != ''
? LessonCard(
name: lessons[i].name,
timeStart: lessons[i].timeStart,
timeEnd: lessons[i].timeEnd,
room: lessons[i].rooms.join(', '),
type: lessons[i].types,
teacher: lessons[i].teachers.join(', '),
)
: EmptyLessonCard(
timeStart: lessons[i].timeStart,
timeEnd: lessons[i].timeEnd,
),
);
},
separatorBuilder: (context, index) {
return const SizedBox(height: 8);
return NotificationListener<ScrollNotification>(
onNotification: (notification) {
if (notification is ScrollUpdateNotification) {
_scrollNotifier.value = notification.metrics.extentBefore;
}
return true;
},
child: ListView.separated(
itemCount: lessons.length,
physics: const BouncingScrollPhysics(),
itemBuilder: (context, i) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: lessons[i].name.replaceAll(' ', '') != ''
? LessonCard(
name: lessons[i].name,
timeStart: lessons[i].timeStart,
timeEnd: lessons[i].timeEnd,
room: lessons[i].rooms.join(', '),
type: lessons[i].types,
teacher: lessons[i].teachers.join(', '),
)
: EmptyLessonCard(
timeStart: lessons[i].timeStart,
timeEnd: lessons[i].timeEnd,
),
);
},
separatorBuilder: (context, index) {
return const SizedBox(height: 8);
},
),
);
}
}
Expand Down Expand Up @@ -420,35 +430,40 @@ class _SchedulePageViewState extends State<SchedulePageView> {
}

Widget _buildStories(List<Story> stories) {
return SizedBox(
height: 120,
child: ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 20),
scrollDirection: Axis.horizontal,
itemBuilder: (_, int i) {
if (DateTime.now().compareTo(stories[i].stopShowDate) == -1) {
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Theme.of(context).shadowColor.withOpacity(
AppTheme.themeMode == ThemeMode.dark ? 0.1 : 0.1),
blurRadius: 10,
offset: const Offset(0, 4),
return ValueListenableBuilder<double>(
valueListenable: _scrollNotifier,
builder: (context, value, child) {
return SizedBox(
height: value > 80 ? 0 : 80 - value,
child: ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 20),
scrollDirection: Axis.horizontal,
itemBuilder: (_, int i) {
if (DateTime.now().compareTo(stories[i].stopShowDate) == -1) {
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Theme.of(context).shadowColor.withOpacity(
AppTheme.themeMode == ThemeMode.dark ? 0.1 : 0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
],
),
child: StoryWidget(
stories: stories,
storyIndex: i,
),
);
}
return Container();
},
separatorBuilder: (_, int i) => const SizedBox(width: 10),
itemCount: stories.length,
),
child: StoryWidget(
stories: stories,
storyIndex: i,
),
);
}
return Container();
},
separatorBuilder: (_, int i) => const SizedBox(width: 10),
itemCount: stories.length,
),
);
},
);
}

Expand Down
5 changes: 2 additions & 3 deletions lib/presentation/pages/schedule/widgets/story_item.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:rtu_mirea_app/domain/entities/story.dart';
Expand All @@ -23,8 +22,8 @@ class StoryWidget extends StatelessWidget {
child: Hero(
tag: stories[storyIndex].title,
child: Container(
height: 120,
width: 88,
height: 80,
width: 68,
padding: const EdgeInsets.all(8),
clipBehavior: Clip.antiAlias,
alignment: Alignment.bottomLeft,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish_to: 'none'
# 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.3.5+29
version: 1.3.6+30

environment:
sdk: ">=3.1.1"
Expand Down Expand Up @@ -170,7 +170,7 @@ dependencies:
firebase_core_web: ^2.5.0
firebase_analytics: ^10.4.1

oauth2_client: ^3.2.1
oauth2_client: ^3.2.2

# Flutter Secure Storage provides API to store data in secure storage.
# See https://pub.dev/packages/flutter_secure_storage
Expand Down
5 changes: 5 additions & 0 deletions windows/runner/flutter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
this->Show();
});

// Flutter can complete the first frame before the "show window" callback is
// registered. The following call ensures a frame is pending to ensure the
// window is shown. It is a no-op if the first frame hasn't completed yet.
flutter_controller_->ForceRedraw();

return true;
}

Expand Down

0 comments on commit 9f87d04

Please sign in to comment.