diff --git a/lib/config/theme_data.dart b/lib/config/theme_data.dart index 5bbab96..fbebcb1 100644 --- a/lib/config/theme_data.dart +++ b/lib/config/theme_data.dart @@ -8,9 +8,7 @@ class LightThemeConfig { static const Color _background = Color(0xFFF8F8FA); static ThemeData get themeData => ThemeData( - backgroundColor: _background, scaffoldBackgroundColor: _background, - colorScheme: _colorScheme, textTheme: _TextThemeData.data, cardColor: _colorScheme.surface, checkboxTheme: CheckboxThemeData( @@ -21,7 +19,7 @@ class LightThemeConfig { ), iconTheme: IconThemeData( color: _colorScheme.text, - ), + ), colorScheme: _colorScheme.copyWith(background: _background), ); static const ColorScheme _colorScheme = ColorScheme( @@ -47,9 +45,7 @@ class DarkThemeConfig { static const Color _background = Color(0xFF202224); static ThemeData get themeData => ThemeData( - backgroundColor: _background, scaffoldBackgroundColor: _background, - colorScheme: _colorScheme, textTheme: _TextThemeData.data, iconTheme: IconThemeData( color: _colorScheme.text, @@ -61,7 +57,7 @@ class DarkThemeConfig { borderRadius: BorderRadius.circular(4), ), ), - cardColor: _colorScheme.surface, + cardColor: _colorScheme.surface, colorScheme: _colorScheme.copyWith(background: _background), ); static const ColorScheme _colorScheme = ColorScheme( @@ -98,13 +94,13 @@ class _TextThemeData { static TextTheme get data => DesignConfig.context == null ? const TextTheme() : TextTheme( - bodyText1: _body1Text, - bodyText2: _body2Text, - caption: _captionText, - subtitle2: _subtitle2Text, - subtitle1: _subtitle1Text, - headline3: _headline3Text, - overline: _overlineText, + bodyLarge: _body1Text, + bodyMedium: _body2Text, + bodySmall: _captionText, + titleSmall: _subtitle2Text, + titleMedium: _subtitle1Text, + displaySmall: _headline3Text, + labelSmall: _overlineText, ); static TextStyle get _headline3Text => TextStyle( diff --git a/lib/models/overview_data.dart b/lib/models/overview_data.dart index f4995b0..4fc6be9 100644 --- a/lib/models/overview_data.dart +++ b/lib/models/overview_data.dart @@ -1,4 +1,5 @@ import 'package:didvan/models/category.dart'; +// ignore: depend_on_referenced_packages import 'package:html/parser.dart'; class OverviewData { diff --git a/lib/providers/server_data.dart b/lib/providers/server_data.dart index d5b2da0..ea601c3 100644 --- a/lib/providers/server_data.dart +++ b/lib/providers/server_data.dart @@ -1,5 +1,6 @@ import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request_helper.dart'; +// ignore: depend_on_referenced_packages import 'package:collection/collection.dart'; class ServerDataProvider { diff --git a/lib/providers/user.dart b/lib/providers/user.dart index 30508f9..1a420c6 100644 --- a/lib/providers/user.dart +++ b/lib/providers/user.dart @@ -1,3 +1,4 @@ +// ignore: depend_on_referenced_packages import 'package:collection/collection.dart'; import 'package:didvan/models/enums.dart'; import 'package:didvan/models/user.dart'; diff --git a/lib/services/app_initalizer.dart b/lib/services/app_initalizer.dart index ee0cb2d..e98e752 100644 --- a/lib/services/app_initalizer.dart +++ b/lib/services/app_initalizer.dart @@ -25,6 +25,7 @@ class AppInitializer { (await getApplicationDocumentsDirectory()).path; StorageService.appTempsDir = (await getTemporaryDirectory()).path; } + // ignore: use_build_context_synchronously final studioState = context.read(); MediaService.audioPlayer.isPlaying.listen((event) { if (event && diff --git a/lib/services/network/request.dart b/lib/services/network/request.dart index d444a9a..de6b12e 100644 --- a/lib/services/network/request.dart +++ b/lib/services/network/request.dart @@ -1,7 +1,9 @@ import 'dart:convert'; import 'dart:developer'; import 'package:didvan/services/storage/storage.dart'; +// ignore: depend_on_referenced_packages import 'package:http/http.dart' as http; +// ignore: depend_on_referenced_packages import 'package:http_parser/http_parser.dart' as parser; import 'package:permission_handler/permission_handler.dart'; @@ -125,7 +127,7 @@ class RequestService { fieldName, file.readAsBytes().asStream(), length, - filename: fileName + '.' + mediaExtension, + filename: '$fileName.$mediaExtension', contentType: parser.MediaType(mediaFormat, mediaExtension), ), ); diff --git a/lib/utils/action_sheet.dart b/lib/utils/action_sheet.dart index 6fe6f37..1c550dd 100644 --- a/lib/utils/action_sheet.dart +++ b/lib/utils/action_sheet.dart @@ -11,7 +11,6 @@ import 'package:didvan/views/widgets/didvan/button.dart'; import 'package:didvan/views/widgets/didvan/text.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; class ActionSheetUtils { static late BuildContext context; @@ -131,7 +130,7 @@ class ActionSheetUtils { if (data.titleIcon != null) const SizedBox(width: 8), DidvanText( data.title!, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, color: data.titleColor ?? Theme.of(context).colorScheme.title, ) @@ -209,7 +208,7 @@ class ActionSheetUtils { Expanded( child: DidvanText( data.title!, - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, color: data.titleColor, fontWeight: FontWeight.bold, ), diff --git a/lib/utils/date_time.dart b/lib/utils/date_time.dart index 57c26eb..bee8947 100644 --- a/lib/utils/date_time.dart +++ b/lib/utils/date_time.dart @@ -51,7 +51,7 @@ class DateTimeUtils { data: Theme.of(context).copyWith( textTheme: Theme.of(context) .textTheme - .copyWith(headline4: Theme.of(context).textTheme.headline3)), + .copyWith(headlineMedium: Theme.of(context).textTheme.displaySmall)), child: child!, ), ); diff --git a/lib/views/authentication/screens/password.dart b/lib/views/authentication/screens/password.dart index d558a49..e6655b0 100644 --- a/lib/views/authentication/screens/password.dart +++ b/lib/views/authentication/screens/password.dart @@ -51,7 +51,7 @@ class _PasswordInputState extends State { onTap: () => state.currentPageIndex++, child: DidvanText( 'فراموشی رمز عبور', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, color: Theme.of(context).colorScheme.primary, ), ), @@ -79,7 +79,9 @@ class _PasswordInputState extends State { ActionSheetUtils.showLogoLoadingIndicator(); await ServerDataProvider.getData(); ActionSheetUtils.pop(); - Navigator.of(context).pushReplacementNamed(Routes.home); + if (mounted) { + Navigator.of(context).pushReplacementNamed(Routes.home); + } _showResetPasswordDialog(); } } diff --git a/lib/views/authentication/screens/reset_password.dart b/lib/views/authentication/screens/reset_password.dart index 560ea4b..84fc75f 100644 --- a/lib/views/authentication/screens/reset_password.dart +++ b/lib/views/authentication/screens/reset_password.dart @@ -53,6 +53,7 @@ class _ResetPasswordState extends State { final result = await context .read() .resetPassword(_password); + if (!mounted) return; if (result && context.read().isAuthenticated) { Navigator.of(context).pop(); Navigator.of(context).pop(); diff --git a/lib/views/authentication/screens/username.dart b/lib/views/authentication/screens/username.dart index ebc696a..7d2b73a 100644 --- a/lib/views/authentication/screens/username.dart +++ b/lib/views/authentication/screens/username.dart @@ -63,14 +63,14 @@ class _UsernameInputState extends State { child: RichText( textAlign: TextAlign.center, text: TextSpan( - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, children: [ const TextSpan(text: 'با ورود به دیدوان،'), TextSpan( text: ' شرایط ', style: Theme.of(context) .textTheme - .caption! + .bodySmall! .copyWith(color: Theme.of(context).colorScheme.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchUrl( @@ -84,7 +84,7 @@ class _UsernameInputState extends State { text: ' قوانین حریم خصوصی ', style: Theme.of(context) .textTheme - .caption! + .bodySmall! .copyWith(color: Theme.of(context).colorScheme.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchUrl( diff --git a/lib/views/authentication/screens/verification.dart b/lib/views/authentication/screens/verification.dart index 161d73b..74afa88 100644 --- a/lib/views/authentication/screens/verification.dart +++ b/lib/views/authentication/screens/verification.dart @@ -52,7 +52,7 @@ class _VerificationState extends State { children: [ DidvanText( 'کد 6 رقمی ارسال شده به موبایل', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, fontWeight: FontWeight.normal, ), const SizedBox( @@ -60,14 +60,14 @@ class _VerificationState extends State { ), DidvanText( state.username, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), const SizedBox( height: 8, ), DidvanText( 'را وارد کنید:', - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, fontWeight: FontWeight.normal, ), const SizedBox( diff --git a/lib/views/authentication/widgets/authentication_app_bar.dart b/lib/views/authentication/widgets/authentication_app_bar.dart index 81e86f3..eccc62a 100644 --- a/lib/views/authentication/widgets/authentication_app_bar.dart +++ b/lib/views/authentication/widgets/authentication_app_bar.dart @@ -30,7 +30,7 @@ class AuthenticationAppBar extends StatelessWidget { if (title != null) DidvanText( title!, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, color: Theme.of(context).colorScheme.title, ) ], diff --git a/lib/views/authentication/widgets/authentication_layout.dart b/lib/views/authentication/widgets/authentication_layout.dart index b1fb3f4..3179bef 100644 --- a/lib/views/authentication/widgets/authentication_layout.dart +++ b/lib/views/authentication/widgets/authentication_layout.dart @@ -1,5 +1,4 @@ import 'package:didvan/views/authentication/widgets/authentication_app_bar.dart'; -import 'package:didvan/views/widgets/logos/didvan_horizontal_logo.dart'; import 'package:didvan/views/widgets/logos/didvan_vertical_logo.dart'; import 'package:flutter/material.dart'; diff --git a/lib/views/home/comments/comments.dart b/lib/views/home/comments/comments.dart index fbeb4bf..02a3f15 100644 --- a/lib/views/home/comments/comments.dart +++ b/lib/views/home/comments/comments.dart @@ -144,7 +144,7 @@ class _MessageBoxState extends State<_MessageBox> { DidvanText( 'پاسخ به ${state.replyingTo!.fullName}:', color: Theme.of(context).colorScheme.caption, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), const Spacer(), DidvanIconButton( @@ -185,13 +185,13 @@ class _MessageBoxState extends State<_MessageBox> { controller: _controller, keyboardType: TextInputType.multiline, textInputAction: TextInputAction.send, - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, onEditingComplete: () {}, onSubmitted: (value) => _onSend(state), decoration: InputDecoration( border: InputBorder.none, hintText: 'پیام خود را ارسال کنید', - hintStyle: Theme.of(context).textTheme.caption!.copyWith( + hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith( color: Theme.of(context).colorScheme.disabledText), ), onChanged: (value) => state.text = value, diff --git a/lib/views/home/comments/widgets/comment.dart b/lib/views/home/comments/widgets/comment.dart index 7d439db..8ca602c 100644 --- a/lib/views/home/comments/widgets/comment.dart +++ b/lib/views/home/comments/widgets/comment.dart @@ -92,12 +92,12 @@ class CommentState extends State { children: [ DidvanText( comment.user.fullName, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), const Spacer(), DidvanText( DateTimeUtils.momentGenerator(comment.createdAt), - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.caption, ), const SizedBox(width: 4), @@ -113,7 +113,7 @@ class CommentState extends State { if (isReply) DidvanText( 'پاسخ به ${comment.toUser.fullName}', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.caption, ), const SizedBox(height: 8), @@ -153,7 +153,7 @@ class CommentState extends State { }, child: DidvanText( 'پاسخ', - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, color: Theme.of(context).colorScheme.primary, ), ), @@ -167,7 +167,7 @@ class CommentState extends State { children: [ DidvanText( 'پاسخ‌ها(${comment.replies.length})', - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, color: Theme.of(context).colorScheme.primary, ), AnimatedRotation( @@ -284,7 +284,7 @@ class _FeedbackButtonsState extends State<_FeedbackButtons> { children: [ DidvanText( _likeCount.toString(), - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.caption, ), const SizedBox(width: 4), @@ -312,7 +312,7 @@ class _FeedbackButtonsState extends State<_FeedbackButtons> { const SizedBox(width: 16), DidvanText( _dislikeCount.toString(), - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.caption, ), const SizedBox(width: 4), diff --git a/lib/views/home/direct/direct.dart b/lib/views/home/direct/direct.dart index 2c0ba84..915d3c0 100644 --- a/lib/views/home/direct/direct.dart +++ b/lib/views/home/direct/direct.dart @@ -131,7 +131,7 @@ class _DirectState extends State { ), DidvanText( '${state.deletionQueue.length} مورد انتخاب شد', - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, color: Theme.of(context).colorScheme.secondary, ), const Spacer(), diff --git a/lib/views/home/direct/widgets/message.dart b/lib/views/home/direct/widgets/message.dart index d1c5e6a..1f2476e 100644 --- a/lib/views/home/direct/widgets/message.dart +++ b/lib/views/home/direct/widgets/message.dart @@ -60,7 +60,7 @@ class Message extends StatelessWidget { ), child: DidvanText( DateTime.parse(message.createdAt).toPersianDateStr(), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: DesignConfig.isDark ? Theme.of(context).colorScheme.white : Theme.of(context).colorScheme.black, @@ -103,7 +103,7 @@ class Message extends StatelessWidget { children: [ DidvanText( DateTimeUtils.timeWithAmPm(message.createdAt), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), if (!message.writedByAdmin) @@ -150,7 +150,7 @@ class _ReplyRadarOverview extends StatelessWidget { children: [ DidvanText( message.radar!.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, maxLines: 1, overflow: TextOverflow.ellipsis, color: Theme.of(context).colorScheme.focusedBorder, @@ -158,18 +158,15 @@ class _ReplyRadarOverview extends StatelessWidget { Row( children: [ DidvanText( - 'رادار ' + message.radar!.categories.first.label, - style: Theme.of(context).textTheme.overline, + 'رادار ${message.radar!.categories.first.label}', + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.focusedBorder, ), const Spacer(), DidvanText( - DateTimeUtils.momentGenerator(message.radar!.createdAt) + - ' | خواندن در ' + - message.radar!.timeToRead.toString() + - ' دقیقه', + '${DateTimeUtils.momentGenerator(message.radar!.createdAt)} | خواندن در ${message.radar!.timeToRead} دقیقه', color: Theme.of(context).colorScheme.focusedBorder, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, ), // DidvanText('text'), ], diff --git a/lib/views/home/direct/widgets/message_box.dart b/lib/views/home/direct/widgets/message_box.dart index 554e336..528b68f 100644 --- a/lib/views/home/direct/widgets/message_box.dart +++ b/lib/views/home/direct/widgets/message_box.dart @@ -144,11 +144,11 @@ class _TypingState extends State<_Typing> { key: _formKey, child: TextFormField( textInputAction: TextInputAction.send, - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, decoration: InputDecoration( border: InputBorder.none, hintText: 'بنویسید یا پیام صوتی بگذارید...', - hintStyle: Theme.of(context).textTheme.caption!.copyWith( + hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith( color: Theme.of(context).colorScheme.disabledText), ), onChanged: (value) { @@ -181,7 +181,7 @@ class _Recording extends StatelessWidget { Expanded( child: DidvanText( 'در حال ضبط صدا ...', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ), DidvanIconButton( diff --git a/lib/views/home/hashtag/hashtag.dart b/lib/views/home/hashtag/hashtag.dart index 551e1f2..d69ee86 100644 --- a/lib/views/home/hashtag/hashtag.dart +++ b/lib/views/home/hashtag/hashtag.dart @@ -18,7 +18,7 @@ class Hashtag extends StatefulWidget { const Hashtag({Key? key, required this.pageData}) : super(key: key); @override - _HashtagState createState() => _HashtagState(); + State createState() => _HashtagState(); } class _HashtagState extends State { @@ -35,7 +35,7 @@ class _HashtagState extends State { @override Widget build(BuildContext context) { return DidvanScaffold( - appBarData: AppBarData(title: '#' + _tag.label, hasBack: true), + appBarData: AppBarData(title: '#${_tag.label}', hasBack: true), slivers: [ Consumer( builder: (context, state, child) => SliverStateHandler( diff --git a/lib/views/home/news/news.dart b/lib/views/home/news/news.dart index afa9c9e..a0d0038 100644 --- a/lib/views/home/news/news.dart +++ b/lib/views/home/news/news.dart @@ -117,7 +117,7 @@ class _NewsState extends State { children: [ ItemTitle( title: 'تاریخ خبر', - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, icon: DidvanIcons.calendar_range_regular, ), const SizedBox(height: 8), diff --git a/lib/views/home/radar/radar.dart b/lib/views/home/radar/radar.dart index 42f3b08..c547731 100644 --- a/lib/views/home/radar/radar.dart +++ b/lib/views/home/radar/radar.dart @@ -104,7 +104,7 @@ class _RadarState extends State { duration: DesignConfig.lowAnimationDuration, child: DidvanText( 'آخرین رصد', - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, color: Theme.of(context).colorScheme.title, ), ), @@ -260,7 +260,7 @@ class _RadarState extends State { children: [ ItemTitle( title: 'تاریخ رادار', - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, icon: DidvanIcons.calendar_range_regular, ), const SizedBox(height: 8), @@ -287,7 +287,7 @@ class _RadarState extends State { ItemTitle( title: 'دسته بندی', icon: DidvanIcons.radar_regular, - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, ), const SizedBox(height: 12), Wrap( diff --git a/lib/views/home/settings/bookmarks/bookmarks.dart b/lib/views/home/settings/bookmarks/bookmarks.dart index 186bb45..27289e9 100644 --- a/lib/views/home/settings/bookmarks/bookmarks.dart +++ b/lib/views/home/settings/bookmarks/bookmarks.dart @@ -46,6 +46,33 @@ class _BookmarksState extends State { title: 'نشان شده‌ها', hasBack: true, ), + slivers: [ + SliverStateHandler( + state: state, + centerEmptyState: state.searching, + builder: (context, state, index) { + index++; + if (index % 15 == 0 && state.lastPage != state.page) { + state.getBookmarks(page: state.page + 1); + } + index--; + return MultitypeOverview( + item: state.bookmarks[index], + onMarkChanged: state.onMarkChanged, + hasUnmarkConfirmation: true, + ); + }, + placeholder: MultitypeOverview.placeholder, + itemPadding: const EdgeInsets.only(bottom: 8), + emptyState: state.searching + ? EmptyResult(onNewSearch: _focuseNode.requestFocus) + : const EmptyList(), + enableEmptyState: state.bookmarks.isEmpty, + childCount: + state.bookmarks.length + (state.page != state.lastPage ? 1 : 0), + onRetry: () => state.getBookmarks(page: state.page), + ), + ], children: [ SearchField( title: 'نشان شده‌ها', @@ -99,33 +126,6 @@ class _BookmarksState extends State { ), ), ], - slivers: [ - SliverStateHandler( - state: state, - centerEmptyState: state.searching, - builder: (context, state, index) { - index++; - if (index % 15 == 0 && state.lastPage != state.page) { - state.getBookmarks(page: state.page + 1); - } - index--; - return MultitypeOverview( - item: state.bookmarks[index], - onMarkChanged: state.onMarkChanged, - hasUnmarkConfirmation: true, - ); - }, - placeholder: MultitypeOverview.placeholder, - itemPadding: const EdgeInsets.only(bottom: 8), - emptyState: state.searching - ? EmptyResult(onNewSearch: _focuseNode.requestFocus) - : const EmptyList(), - enableEmptyState: state.bookmarks.isEmpty, - childCount: - state.bookmarks.length + (state.page != state.lastPage ? 1 : 0), - onRetry: () => state.getBookmarks(page: state.page), - ), - ], ); } diff --git a/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmark.dart b/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmark.dart index 0ecc547..7a78de1 100644 --- a/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmark.dart +++ b/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmark.dart @@ -16,7 +16,7 @@ class FilteredBookmarks extends StatefulWidget { const FilteredBookmarks({Key? key, this.onDeleted}) : super(key: key); @override - _FilteredBookmarksState createState() => _FilteredBookmarksState(); + State createState() => _FilteredBookmarksState(); } class _FilteredBookmarksState extends State { diff --git a/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmarks_state.dart b/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmarks_state.dart index 0940883..555c953 100644 --- a/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmarks_state.dart +++ b/lib/views/home/settings/bookmarks/filtered_bookmark/filtered_bookmarks_state.dart @@ -20,7 +20,7 @@ class FilteredBookmarksState extends CoreProvier { } else if (type == 'news') { typeString = type; } else { - typeString = type + 's'; + typeString = '${type}s'; } final service = RequestService( RequestHelper.bookmarks( diff --git a/lib/views/home/settings/direct_list/direct_list_state.dart b/lib/views/home/settings/direct_list/direct_list_state.dart index 40aaee9..0bc1505 100644 --- a/lib/views/home/settings/direct_list/direct_list_state.dart +++ b/lib/views/home/settings/direct_list/direct_list_state.dart @@ -19,9 +19,9 @@ class DirectListState extends CoreProvier { await service.httpGet(); if (service.isSuccess) { _unreadCount = service.result['unread'] ?? 0; - final List _chatRooms = service.result['chatRooms'] ?? []; - for (var i = 0; i < _chatRooms.length; i++) { - chatRooms.add(ChatRoom.fromJson(_chatRooms[i])); + final List chatRooms = service.result['chatRooms'] ?? []; + for (var i = 0; i < chatRooms.length; i++) { + chatRooms.add(ChatRoom.fromJson(chatRooms[i])); } appState = AppState.idle; return; diff --git a/lib/views/home/settings/direct_list/widgets/direct_item.dart b/lib/views/home/settings/direct_list/widgets/direct_item.dart index 2a5fdbf..4b15423 100644 --- a/lib/views/home/settings/direct_list/widgets/direct_item.dart +++ b/lib/views/home/settings/direct_list/widgets/direct_item.dart @@ -43,7 +43,7 @@ class ChatRoomItem extends StatelessWidget { Expanded( child: DidvanText( chatRoom.type, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), ), if (chatRoom.unread != 0) @@ -83,7 +83,7 @@ class ChatRoomItem extends StatelessWidget { ), DidvanText( DateTimeUtils.momentGenerator(chatRoom.updatedAt), - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.caption, ) ], diff --git a/lib/views/home/settings/general_settings/settings.dart b/lib/views/home/settings/general_settings/settings.dart index 30a78ad..e3e6816 100644 --- a/lib/views/home/settings/general_settings/settings.dart +++ b/lib/views/home/settings/general_settings/settings.dart @@ -54,14 +54,11 @@ class _GeneralSettingsState extends State { title: 'زمان دریافت اعلان', onTap: () => _pickTimeRange(context), icon: DidvanIcons.notification_regular, - suffix: 'از' + - DateTimeUtils.normalizeTimeDuration( + suffix: 'از${DateTimeUtils.normalizeTimeDuration( Duration(minutes: state.notificationTimeRange[0]), - ) + - ' تا ' + - DateTimeUtils.normalizeTimeDuration( + )} تا ${DateTimeUtils.normalizeTimeDuration( Duration(minutes: state.notificationTimeRange[1]), - ), + )}', ), ), const ItemTitle( @@ -254,8 +251,8 @@ class _GeneralSettingsState extends State { okText: 'تایید', cancelText: 'بازگشت', accentColor: Theme.of(context).colorScheme.primary, - okStyle: Theme.of(context).textTheme.bodyText2!, - cancelStyle: Theme.of(context).textTheme.bodyText2!, + okStyle: Theme.of(context).textTheme.bodyMedium!, + cancelStyle: Theme.of(context).textTheme.bodyMedium!, unselectedColor: Theme.of(context).colorScheme.text, blurredBackground: true, disableMinute: true, diff --git a/lib/views/home/settings/profile/profile.dart b/lib/views/home/settings/profile/profile.dart index a74689a..82f8aca 100644 --- a/lib/views/home/settings/profile/profile.dart +++ b/lib/views/home/settings/profile/profile.dart @@ -87,7 +87,7 @@ class _ProfileState extends State { isVisible: !_usernameIsAvailible, child: DidvanText( 'نام کاربری در دسترس نمی‌باشد', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.error, ), ), diff --git a/lib/views/home/settings/profile/widgets/profile_photo.dart b/lib/views/home/settings/profile/widgets/profile_photo.dart index 3984ee0..5a1e01d 100644 --- a/lib/views/home/settings/profile/widgets/profile_photo.dart +++ b/lib/views/home/settings/profile/widgets/profile_photo.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'package:didvan/config/theme_data.dart'; import 'package:didvan/constants/app_icons.dart'; diff --git a/lib/views/home/settings/settings.dart b/lib/views/home/settings/settings.dart index 80a4335..49d9759 100644 --- a/lib/views/home/settings/settings.dart +++ b/lib/views/home/settings/settings.dart @@ -131,7 +131,7 @@ class Settings extends StatelessWidget { const SizedBox(height: 16), DidvanText( 'نسخه نرم‌افزار: 2.2.5', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ], ), diff --git a/lib/views/home/statistic/statistic.dart b/lib/views/home/statistic/statistic.dart index 5720ce0..527ad87 100644 --- a/lib/views/home/statistic/statistic.dart +++ b/lib/views/home/statistic/statistic.dart @@ -74,7 +74,7 @@ class _StatisticState extends State { duration: DesignConfig.lowAnimationDuration, child: DidvanText( 'شاخص‌های منتخب', - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, color: Theme.of(context).colorScheme.title, ), ), diff --git a/lib/views/home/statistic/statistic_details/statistic_details.dart b/lib/views/home/statistic/statistic_details/statistic_details.dart index 4175aae..15b97ff 100644 --- a/lib/views/home/statistic/statistic_details/statistic_details.dart +++ b/lib/views/home/statistic/statistic_details/statistic_details.dart @@ -16,6 +16,7 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:provider/provider.dart'; +// ignore: depend_on_referenced_packages import 'package:intl/intl.dart' as intl; class StatisticDetails extends StatefulWidget { @@ -95,7 +96,7 @@ class _StatisticDetailsState extends State { )}', Theme.of(context) .textTheme - .caption! + .bodySmall! .copyWith( color: Colors.white, ), @@ -284,8 +285,8 @@ class _StatisticDetailsState extends State { DidvanText( title, style: isBold - ? Theme.of(context).textTheme.bodyText1 - : Theme.of(context).textTheme.bodyText2, + ? Theme.of(context).textTheme.bodyLarge + : Theme.of(context).textTheme.bodyMedium, ), const Spacer(), if (icon != null) Icon(icon, color: color), diff --git a/lib/views/home/statistic/statistic_details/statistic_details_state.dart b/lib/views/home/statistic/statistic_details/statistic_details_state.dart index 291f791..6db7aee 100644 --- a/lib/views/home/statistic/statistic_details/statistic_details_state.dart +++ b/lib/views/home/statistic/statistic_details/statistic_details_state.dart @@ -6,6 +6,7 @@ import 'package:didvan/models/tag.dart'; import 'package:didvan/providers/core.dart'; import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request_helper.dart'; +// ignore: depend_on_referenced_packages import 'package:collection/collection.dart'; class StatisticDetailsState extends CoreProvier { diff --git a/lib/views/home/statistic/statistic_state.dart b/lib/views/home/statistic/statistic_state.dart index 00f6c9f..887363c 100644 --- a/lib/views/home/statistic/statistic_state.dart +++ b/lib/views/home/statistic/statistic_state.dart @@ -1,4 +1,5 @@ import 'package:didvan/constants/assets.dart'; +// ignore: depend_on_referenced_packages import 'package:collection/collection.dart'; import 'package:didvan/models/category.dart'; import 'package:didvan/models/enums.dart'; diff --git a/lib/views/home/statistic/widgets/statistic_overview.dart b/lib/views/home/statistic/widgets/statistic_overview.dart index 8ff4d11..7ffe595 100644 --- a/lib/views/home/statistic/widgets/statistic_overview.dart +++ b/lib/views/home/statistic/widgets/statistic_overview.dart @@ -46,7 +46,7 @@ class StatisticOverview extends StatelessWidget { ), DidvanText( statistic.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), const Spacer(), if (_hasDiff) @@ -57,7 +57,7 @@ class StatisticOverview extends StatelessWidget { if (_hasDiff) const SizedBox(width: 8), DidvanText( statistic.data.p, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ) ], ), @@ -71,7 +71,7 @@ class StatisticOverview extends StatelessWidget { ), DidvanText( statistic.data.l, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.hint, ), const SizedBox(width: 8), @@ -82,7 +82,7 @@ class StatisticOverview extends StatelessWidget { ), DidvanText( statistic.data.h, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.hint, ), const Spacer(), @@ -98,7 +98,7 @@ class StatisticOverview extends StatelessWidget { if (_hasDiff) DidvanText( '${statistic.data.dp}%', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: _diffColor(context), ), ], diff --git a/lib/views/home/studio/studio.dart b/lib/views/home/studio/studio.dart index e8f6e1e..b6fdfd0 100644 --- a/lib/views/home/studio/studio.dart +++ b/lib/views/home/studio/studio.dart @@ -245,7 +245,7 @@ class _StudioState extends State { children: [ ItemTitle( title: 'تاریخ رادار', - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, icon: DidvanIcons.calendar_range_regular, ), const SizedBox(height: 8), diff --git a/lib/views/home/studio/studio_details/studio_details.mobile.dart b/lib/views/home/studio/studio_details/studio_details.mobile.dart index 7fba6a4..deb7a97 100644 --- a/lib/views/home/studio/studio_details/studio_details.mobile.dart +++ b/lib/views/home/studio/studio_details/studio_details.mobile.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'package:better_player/better_player.dart'; import 'package:didvan/models/view/app_bar_data.dart'; import 'package:didvan/services/media/media.dart'; diff --git a/lib/views/home/studio/studio_details/widgets/details_tab_bar.dart b/lib/views/home/studio/studio_details/widgets/details_tab_bar.dart index ba160e7..b257817 100644 --- a/lib/views/home/studio/studio_details/widgets/details_tab_bar.dart +++ b/lib/views/home/studio/studio_details/widgets/details_tab_bar.dart @@ -115,7 +115,7 @@ class _TabItem extends StatelessWidget { DidvanText( title, color: _color(context), - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ) ], ), diff --git a/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart b/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart index 0ff34fb..ce302c7 100644 --- a/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart +++ b/lib/views/home/studio/studio_details/widgets/studio_details_widget.dart @@ -243,7 +243,7 @@ class _StudioPreview extends StatelessWidget { const SizedBox(height: 8), DidvanText( _previewTitle, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, textAlign: TextAlign.center, ), const SizedBox(height: 8), @@ -252,7 +252,7 @@ class _StudioPreview extends StatelessWidget { maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), ], diff --git a/lib/views/home/studio/widgets/slider.dart b/lib/views/home/studio/widgets/slider.dart index 78bf110..783f891 100644 --- a/lib/views/home/studio/widgets/slider.dart +++ b/lib/views/home/studio/widgets/slider.dart @@ -93,7 +93,7 @@ class _StudioSliderState extends State { child: DidvanText( state.sliders[i].title, color: Theme.of(context).colorScheme.title, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ), ), diff --git a/lib/views/home/studio/widgets/tab_bar.dart b/lib/views/home/studio/widgets/tab_bar.dart index ca27288..849f348 100644 --- a/lib/views/home/studio/widgets/tab_bar.dart +++ b/lib/views/home/studio/widgets/tab_bar.dart @@ -97,7 +97,7 @@ class _StudioTypeButton extends StatelessWidget { ), DidvanText( title, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: _color(context), ) ], diff --git a/lib/views/home/widgets/audio/audio_player_widget.dart b/lib/views/home/widgets/audio/audio_player_widget.dart index c04b5e6..0df1647 100644 --- a/lib/views/home/widgets/audio/audio_player_widget.dart +++ b/lib/views/home/widgets/audio/audio_player_widget.dart @@ -54,7 +54,7 @@ class AudioPlayerWidget extends StatelessWidget { const SizedBox(height: 16), DidvanText( podcast.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), const SizedBox(height: 16), Padding( @@ -89,7 +89,7 @@ class AudioPlayerWidget extends StatelessWidget { ? 'پایان پادکست' : '\'${state.timerValue}', isEnglishFont: true, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.title, ), ], @@ -223,7 +223,7 @@ class AudioPlayerWidget extends StatelessWidget { const SizedBox(height: 24), DidvanText( '$timerValue دقیقه', - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, ), const SizedBox(height: 12), const Icon(DidvanIcons.caret_down_solid), diff --git a/lib/views/home/widgets/category_item.dart b/lib/views/home/widgets/category_item.dart index a0c1311..da1f561 100644 --- a/lib/views/home/widgets/category_item.dart +++ b/lib/views/home/widgets/category_item.dart @@ -78,7 +78,7 @@ class CategoryItem extends StatelessWidget { ), DidvanText( category.label, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, color: Theme.of(context).colorScheme.title, ), ], diff --git a/lib/views/home/widgets/duration_widget.dart b/lib/views/home/widgets/duration_widget.dart index b27f210..80b0131 100644 --- a/lib/views/home/widgets/duration_widget.dart +++ b/lib/views/home/widgets/duration_widget.dart @@ -31,7 +31,7 @@ class DurationWidget extends StatelessWidget { Duration(seconds: duration), ), isEnglishFont: true, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.focusedBorder, ), const SizedBox(width: 4), diff --git a/lib/views/home/widgets/menu_item.dart b/lib/views/home/widgets/menu_item.dart index ba3292b..a258a17 100644 --- a/lib/views/home/widgets/menu_item.dart +++ b/lib/views/home/widgets/menu_item.dart @@ -55,7 +55,7 @@ class MenuOption extends StatelessWidget { suffix!, style: Theme.of(context) .textTheme - .subtitle2! + .titleSmall! .copyWith(fontWeight: FontWeight.w400), color: Theme.of(context).colorScheme.primary, ), diff --git a/lib/views/home/widgets/overview/multitype.dart b/lib/views/home/widgets/overview/multitype.dart index ab99a2d..e085f29 100644 --- a/lib/views/home/widgets/overview/multitype.dart +++ b/lib/views/home/widgets/overview/multitype.dart @@ -113,7 +113,7 @@ class MultitypeOverview extends StatelessWidget { children: [ DidvanText( item.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -126,7 +126,7 @@ class MultitypeOverview extends StatelessWidget { const SizedBox(width: 4), DidvanText( DateTime.parse(item.createdAt).toPersianDateStr(), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, ), const Spacer(), if ((item.timeToRead ?? item.duration) != null) ...[ @@ -141,7 +141,7 @@ class MultitypeOverview extends StatelessWidget { : DateTimeUtils.normalizeTimeDuration( Duration(seconds: item.duration!), ), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, ), ] ], diff --git a/lib/views/home/widgets/overview/news.dart b/lib/views/home/widgets/overview/news.dart index 44e03cb..80ff37a 100644 --- a/lib/views/home/widgets/overview/news.dart +++ b/lib/views/home/widgets/overview/news.dart @@ -51,7 +51,7 @@ class NewsOverview extends StatelessWidget { height: 64, child: DidvanText( news.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), ), ), @@ -70,11 +70,11 @@ class NewsOverview extends StatelessWidget { children: [ DidvanText( news.reference!, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), DidvanText( ' - ${DateTimeUtils.momentGenerator(news.createdAt)}', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ], ), diff --git a/lib/views/home/widgets/overview/podcast.dart b/lib/views/home/widgets/overview/podcast.dart index 24ce673..11ff3d2 100644 --- a/lib/views/home/widgets/overview/podcast.dart +++ b/lib/views/home/widgets/overview/podcast.dart @@ -56,12 +56,12 @@ class PodcastOverview extends StatelessWidget { children: [ DidvanText( podcast.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), const SizedBox(height: 4), DidvanText( DateTimeUtils.momentGenerator(podcast.createdAt), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), ], diff --git a/lib/views/home/widgets/overview/radar.dart b/lib/views/home/widgets/overview/radar.dart index 3d0e6ff..0fa140e 100644 --- a/lib/views/home/widgets/overview/radar.dart +++ b/lib/views/home/widgets/overview/radar.dart @@ -70,7 +70,7 @@ class RadarOverview extends StatelessWidget { ), child: DidvanText( 'برای مدیران', - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.white, ), ), @@ -82,13 +82,13 @@ class RadarOverview extends StatelessWidget { children: [ DidvanText( radar.categories!.first.label, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), const Spacer(), DidvanText( '${DateTimeUtils.momentGenerator(radar.createdAt)} | خواندن در ${radar.timeToRead} دقیقه', - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), ], diff --git a/lib/views/home/widgets/overview/video.dart b/lib/views/home/widgets/overview/video.dart index b70918b..3a838b0 100644 --- a/lib/views/home/widgets/overview/video.dart +++ b/lib/views/home/widgets/overview/video.dart @@ -71,7 +71,7 @@ class VideoOverview extends StatelessWidget { children: [ DidvanText( video.title, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), const SizedBox(height: 4), Row( @@ -83,7 +83,7 @@ class VideoOverview extends StatelessWidget { const SizedBox(width: 4), DidvanText( DateTimeUtils.momentGenerator(video.createdAt), - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), ], diff --git a/lib/views/home/widgets/search_field.dart b/lib/views/home/widgets/search_field.dart index d0fb92d..691e4c6 100644 --- a/lib/views/home/widgets/search_field.dart +++ b/lib/views/home/widgets/search_field.dart @@ -45,7 +45,7 @@ class _SearchFieldState extends State { ), child: TextFormField( focusNode: widget.focusNode, - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, textAlignVertical: TextAlignVertical.center, onChanged: widget.onChanged, keyboardType: TextInputType.text, diff --git a/lib/views/home/widgets/tag_item.dart b/lib/views/home/widgets/tag_item.dart index 56d14ef..4d2d603 100644 --- a/lib/views/home/widgets/tag_item.dart +++ b/lib/views/home/widgets/tag_item.dart @@ -50,7 +50,7 @@ class TagItem extends StatelessWidget { DidvanText( tag.label, color: Theme.of(context).colorScheme.focusedBorder, - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, ), ], ), diff --git a/lib/views/splash/splash.dart b/lib/views/splash/splash.dart index dea28df..b06a3a8 100644 --- a/lib/views/splash/splash.dart +++ b/lib/views/splash/splash.dart @@ -99,6 +99,9 @@ class _SplashState extends State { }); } final settingsData = await AppInitializer.initilizeSettings(); + if (!mounted) { + return; + } final themeProvider = context.read(); themeProvider.themeMode = settingsData.themeMode; themeProvider.fontFamily = settingsData.fontFamily; @@ -109,18 +112,24 @@ class _SplashState extends State { _isGettingThemeData = false; }), ); + if (!mounted) { + return; + } await AppInitializer.setupServices(context); + if (!mounted) { + return; + } final userProvider = context.read(); final String? token = await userProvider.setAndGetToken(); if (token != null) { log(token); - if (!kIsWeb) { + if (!kIsWeb && mounted) { context.read().getDownloadsList(); } RequestService.token = token; final result = await userProvider.getUserInfo(); await userProvider.getUnreadMessageCount(); - if (!result) { + if (!result && mounted) { StorageService.delete(key: 'token'); Navigator.of(context).pushNamedAndRemoveUntil( Routes.splash, @@ -130,10 +139,12 @@ class _SplashState extends State { } await ServerDataProvider.getData(); } - Navigator.of(context).pushReplacementNamed( - token == null ? Routes.authenticaion : Routes.home, - arguments: token == null ? false : null, - ); + if (mounted) { + Navigator.of(context).pushReplacementNamed( + token == null ? Routes.authenticaion : Routes.home, + arguments: token == null ? false : null, + ); + } } catch (e) { setState(() { _errorOccured = true; diff --git a/lib/views/widgets/didvan/app_bar.dart b/lib/views/widgets/didvan/app_bar.dart index ab7a949..99627bf 100644 --- a/lib/views/widgets/didvan/app_bar.dart +++ b/lib/views/widgets/didvan/app_bar.dart @@ -51,7 +51,7 @@ class DidvanAppBar extends StatelessWidget { if (appBarData.title != null) DidvanText( appBarData.title!, - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, color: Theme.of(context).colorScheme.title, overflow: TextOverflow.ellipsis, ), @@ -60,7 +60,7 @@ class DidvanAppBar extends StatelessWidget { appBarData.subtitle!, maxLines: 1, overflow: TextOverflow.clip, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.caption, ), ], diff --git a/lib/views/widgets/didvan/badge.dart b/lib/views/widgets/didvan/badge.dart index c88c0fd..112da3d 100644 --- a/lib/views/widgets/didvan/badge.dart +++ b/lib/views/widgets/didvan/badge.dart @@ -26,7 +26,7 @@ class DidvanBadge extends StatelessWidget { text, isEnglishFont: true, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.overline, + style: Theme.of(context).textTheme.labelSmall, color: Theme.of(context).colorScheme.white, ), ), diff --git a/lib/views/widgets/didvan/bnb.dart b/lib/views/widgets/didvan/bnb.dart index 7c9f94c..d344bc2 100644 --- a/lib/views/widgets/didvan/bnb.dart +++ b/lib/views/widgets/didvan/bnb.dart @@ -440,7 +440,7 @@ class _NavBarItem extends StatelessWidget { ), DidvanText( title, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.title, ), const Spacer(), diff --git a/lib/views/widgets/didvan/chip.dart b/lib/views/widgets/didvan/chip.dart index a1a7e73..e676213 100644 --- a/lib/views/widgets/didvan/chip.dart +++ b/lib/views/widgets/didvan/chip.dart @@ -26,7 +26,7 @@ class DidvanChip extends StatelessWidget { ), child: DidvanText( label, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.white, ), ), diff --git a/lib/views/widgets/didvan/page_view.dart b/lib/views/widgets/didvan/page_view.dart index b8bbab7..18edf1b 100644 --- a/lib/views/widgets/didvan/page_view.dart +++ b/lib/views/widgets/didvan/page_view.dart @@ -101,7 +101,7 @@ class _DidvanPageViewState extends State { const EdgeInsets.symmetric(horizontal: 16), child: DidvanText( item.title, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), ), const SizedBox(height: 8), @@ -120,7 +120,7 @@ class _DidvanPageViewState extends State { color: Theme.of(context).colorScheme.hint, ), borderRadius: DesignConfig.lowBorderRadius, - color: Theme.of(context).backgroundColor, + color: Theme.of(context).colorScheme.background, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -287,7 +287,7 @@ class _DidvanPageViewState extends State { const SizedBox(width: 8), DidvanText( element!.text, - style: Theme.of(context).textTheme.subtitle2, + style: Theme.of(context).textTheme.titleSmall, ), ], ), @@ -361,7 +361,7 @@ class _DidvanPageViewState extends State { child: DidvanText( content.caption, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ), ], @@ -377,17 +377,17 @@ class _DidvanPageViewState extends State { children: [ DidvanText( 'رادار ', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), for (var i = 0; i < item.categories.length; i++) DidvanText( item.categories[i].label + '${i != item.categories.length - 1 ? '،' : ''} ', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), DidvanText( ' - ${DateTimeUtils.momentGenerator(item.createdAt)}', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ], ); @@ -396,11 +396,11 @@ class _DidvanPageViewState extends State { children: [ DidvanText( item.reference, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), DidvanText( ' - ${DateTimeUtils.momentGenerator(item.createdAt)}', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ], ); diff --git a/lib/views/widgets/didvan/radial_button.dart b/lib/views/widgets/didvan/radial_button.dart index 6a927b9..381e3ce 100644 --- a/lib/views/widgets/didvan/radial_button.dart +++ b/lib/views/widgets/didvan/radial_button.dart @@ -51,7 +51,7 @@ class DidvanRadialButton extends StatelessWidget { const SizedBox(width: 8), DidvanText( title, - style: Theme.of(context).textTheme.bodyText2!.copyWith( + style: Theme.of(context).textTheme.bodyMedium!.copyWith( fontFamily: fontFamily, ), fontSize: fontSize, diff --git a/lib/views/widgets/didvan/text.dart b/lib/views/widgets/didvan/text.dart index b2e840b..4a8dd2a 100644 --- a/lib/views/widgets/didvan/text.dart +++ b/lib/views/widgets/didvan/text.dart @@ -29,7 +29,7 @@ class DidvanText extends StatelessWidget { Widget build(BuildContext context) { return Text( text, - style: ((style ?? Theme.of(context).textTheme.bodyText2)!.copyWith( + style: ((style ?? Theme.of(context).textTheme.bodyMedium)!.copyWith( color: color, fontWeight: fontWeight, fontSize: fontSize, diff --git a/lib/views/widgets/didvan/text_field.dart b/lib/views/widgets/didvan/text_field.dart index 5508be8..89d53c2 100644 --- a/lib/views/widgets/didvan/text_field.dart +++ b/lib/views/widgets/didvan/text_field.dart @@ -98,7 +98,7 @@ class _DidvanTextFieldState extends State { obscuringCharacter: '*', style: Theme.of(context) .textTheme - .bodyText2! + .bodyMedium! .copyWith(fontFamily: DesignConfig.fontFamily.padRight(3)), decoration: InputDecoration( suffixIcon: _suffixBuilder(), @@ -108,7 +108,7 @@ class _DidvanTextFieldState extends State { errorStyle: const TextStyle(height: 0.01), hintStyle: Theme.of(context) .textTheme - .bodyText2! + .bodyMedium! .copyWith(color: Theme.of(context).colorScheme.hint), ), ), @@ -126,7 +126,7 @@ class _DidvanTextFieldState extends State { ), DidvanText( _error ?? '', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, color: Theme.of(context).colorScheme.error, ), ], diff --git a/lib/views/widgets/item_title.dart b/lib/views/widgets/item_title.dart index 0477d87..be2fc13 100644 --- a/lib/views/widgets/item_title.dart +++ b/lib/views/widgets/item_title.dart @@ -28,7 +28,7 @@ class ItemTitle extends StatelessWidget { if (icon != null) const SizedBox(width: 4), DidvanText( title, - style: style ?? Theme.of(context).textTheme.subtitle1, + style: style ?? Theme.of(context).textTheme.titleMedium, color: color ?? Theme.of(context).colorScheme.title, ) ], diff --git a/lib/views/widgets/skeleton_image.dart b/lib/views/widgets/skeleton_image.dart index 0c16a7b..a38d110 100644 --- a/lib/views/widgets/skeleton_image.dart +++ b/lib/views/widgets/skeleton_image.dart @@ -4,6 +4,7 @@ import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request_helper.dart'; import 'package:didvan/views/widgets/shimmer_placeholder.dart'; import 'package:flutter/material.dart'; +// ignore: depend_on_referenced_packages import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart'; class SkeletonImage extends StatelessWidget { diff --git a/lib/views/widgets/state_handlers/empty_state.dart b/lib/views/widgets/state_handlers/empty_state.dart index abfe420..c1e99bb 100644 --- a/lib/views/widgets/state_handlers/empty_state.dart +++ b/lib/views/widgets/state_handlers/empty_state.dart @@ -31,7 +31,7 @@ class EmptyState extends StatelessWidget { const SizedBox(height: 16), DidvanText( title, - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, color: titleColor ?? Theme.of(context).colorScheme.caption, ), if (subtitle != null) const SizedBox(height: 8),