resiolve warnings

This commit is contained in:
MohammadTaha Basiri 2023-03-18 18:57:22 +03:30
parent 350c55aad6
commit 4dc5470fdb
65 changed files with 179 additions and 166 deletions

View File

@ -8,9 +8,7 @@ class LightThemeConfig {
static const Color _background = Color(0xFFF8F8FA); static const Color _background = Color(0xFFF8F8FA);
static ThemeData get themeData => ThemeData( static ThemeData get themeData => ThemeData(
backgroundColor: _background,
scaffoldBackgroundColor: _background, scaffoldBackgroundColor: _background,
colorScheme: _colorScheme,
textTheme: _TextThemeData.data, textTheme: _TextThemeData.data,
cardColor: _colorScheme.surface, cardColor: _colorScheme.surface,
checkboxTheme: CheckboxThemeData( checkboxTheme: CheckboxThemeData(
@ -21,7 +19,7 @@ class LightThemeConfig {
), ),
iconTheme: IconThemeData( iconTheme: IconThemeData(
color: _colorScheme.text, color: _colorScheme.text,
), ), colorScheme: _colorScheme.copyWith(background: _background),
); );
static const ColorScheme _colorScheme = ColorScheme( static const ColorScheme _colorScheme = ColorScheme(
@ -47,9 +45,7 @@ class DarkThemeConfig {
static const Color _background = Color(0xFF202224); static const Color _background = Color(0xFF202224);
static ThemeData get themeData => ThemeData( static ThemeData get themeData => ThemeData(
backgroundColor: _background,
scaffoldBackgroundColor: _background, scaffoldBackgroundColor: _background,
colorScheme: _colorScheme,
textTheme: _TextThemeData.data, textTheme: _TextThemeData.data,
iconTheme: IconThemeData( iconTheme: IconThemeData(
color: _colorScheme.text, color: _colorScheme.text,
@ -61,7 +57,7 @@ class DarkThemeConfig {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
), ),
cardColor: _colorScheme.surface, cardColor: _colorScheme.surface, colorScheme: _colorScheme.copyWith(background: _background),
); );
static const ColorScheme _colorScheme = ColorScheme( static const ColorScheme _colorScheme = ColorScheme(
@ -98,13 +94,13 @@ class _TextThemeData {
static TextTheme get data => DesignConfig.context == null static TextTheme get data => DesignConfig.context == null
? const TextTheme() ? const TextTheme()
: TextTheme( : TextTheme(
bodyText1: _body1Text, bodyLarge: _body1Text,
bodyText2: _body2Text, bodyMedium: _body2Text,
caption: _captionText, bodySmall: _captionText,
subtitle2: _subtitle2Text, titleSmall: _subtitle2Text,
subtitle1: _subtitle1Text, titleMedium: _subtitle1Text,
headline3: _headline3Text, displaySmall: _headline3Text,
overline: _overlineText, labelSmall: _overlineText,
); );
static TextStyle get _headline3Text => TextStyle( static TextStyle get _headline3Text => TextStyle(

View File

@ -1,4 +1,5 @@
import 'package:didvan/models/category.dart'; import 'package:didvan/models/category.dart';
// ignore: depend_on_referenced_packages
import 'package:html/parser.dart'; import 'package:html/parser.dart';
class OverviewData { class OverviewData {

View File

@ -1,5 +1,6 @@
import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request.dart';
import 'package:didvan/services/network/request_helper.dart'; import 'package:didvan/services/network/request_helper.dart';
// ignore: depend_on_referenced_packages
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
class ServerDataProvider { class ServerDataProvider {

View File

@ -1,3 +1,4 @@
// ignore: depend_on_referenced_packages
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:didvan/models/enums.dart'; import 'package:didvan/models/enums.dart';
import 'package:didvan/models/user.dart'; import 'package:didvan/models/user.dart';

View File

@ -25,6 +25,7 @@ class AppInitializer {
(await getApplicationDocumentsDirectory()).path; (await getApplicationDocumentsDirectory()).path;
StorageService.appTempsDir = (await getTemporaryDirectory()).path; StorageService.appTempsDir = (await getTemporaryDirectory()).path;
} }
// ignore: use_build_context_synchronously
final studioState = context.read<StudioDetailsState>(); final studioState = context.read<StudioDetailsState>();
MediaService.audioPlayer.isPlaying.listen((event) { MediaService.audioPlayer.isPlaying.listen((event) {
if (event && if (event &&

View File

@ -1,7 +1,9 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer'; import 'dart:developer';
import 'package:didvan/services/storage/storage.dart'; import 'package:didvan/services/storage/storage.dart';
// ignore: depend_on_referenced_packages
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
// ignore: depend_on_referenced_packages
import 'package:http_parser/http_parser.dart' as parser; import 'package:http_parser/http_parser.dart' as parser;
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -125,7 +127,7 @@ class RequestService {
fieldName, fieldName,
file.readAsBytes().asStream(), file.readAsBytes().asStream(),
length, length,
filename: fileName + '.' + mediaExtension, filename: '$fileName.$mediaExtension',
contentType: parser.MediaType(mediaFormat, mediaExtension), contentType: parser.MediaType(mediaFormat, mediaExtension),
), ),
); );

View File

@ -11,7 +11,6 @@ import 'package:didvan/views/widgets/didvan/button.dart';
import 'package:didvan/views/widgets/didvan/text.dart'; import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
class ActionSheetUtils { class ActionSheetUtils {
static late BuildContext context; static late BuildContext context;
@ -131,7 +130,7 @@ class ActionSheetUtils {
if (data.titleIcon != null) const SizedBox(width: 8), if (data.titleIcon != null) const SizedBox(width: 8),
DidvanText( DidvanText(
data.title!, data.title!,
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
color: data.titleColor ?? color: data.titleColor ??
Theme.of(context).colorScheme.title, Theme.of(context).colorScheme.title,
) )
@ -209,7 +208,7 @@ class ActionSheetUtils {
Expanded( Expanded(
child: DidvanText( child: DidvanText(
data.title!, data.title!,
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.displaySmall,
color: data.titleColor, color: data.titleColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),

View File

@ -51,7 +51,7 @@ class DateTimeUtils {
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
textTheme: Theme.of(context) textTheme: Theme.of(context)
.textTheme .textTheme
.copyWith(headline4: Theme.of(context).textTheme.headline3)), .copyWith(headlineMedium: Theme.of(context).textTheme.displaySmall)),
child: child!, child: child!,
), ),
); );

View File

@ -51,7 +51,7 @@ class _PasswordInputState extends State<PasswordInput> {
onTap: () => state.currentPageIndex++, onTap: () => state.currentPageIndex++,
child: DidvanText( child: DidvanText(
'فراموشی رمز عبور', 'فراموشی رمز عبور',
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
@ -79,7 +79,9 @@ class _PasswordInputState extends State<PasswordInput> {
ActionSheetUtils.showLogoLoadingIndicator(); ActionSheetUtils.showLogoLoadingIndicator();
await ServerDataProvider.getData(); await ServerDataProvider.getData();
ActionSheetUtils.pop(); ActionSheetUtils.pop();
if (mounted) {
Navigator.of(context).pushReplacementNamed(Routes.home); Navigator.of(context).pushReplacementNamed(Routes.home);
}
_showResetPasswordDialog(); _showResetPasswordDialog();
} }
} }

View File

@ -53,6 +53,7 @@ class _ResetPasswordState extends State<ResetPassword> {
final result = await context final result = await context
.read<AuthenticationState>() .read<AuthenticationState>()
.resetPassword(_password); .resetPassword(_password);
if (!mounted) return;
if (result && context.read<UserProvider>().isAuthenticated) { if (result && context.read<UserProvider>().isAuthenticated) {
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();

View File

@ -63,14 +63,14 @@ class _UsernameInputState extends State<UsernameInput> {
child: RichText( child: RichText(
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan( text: TextSpan(
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
children: [ children: [
const TextSpan(text: 'با ورود به دیدوان،'), const TextSpan(text: 'با ورود به دیدوان،'),
TextSpan( TextSpan(
text: ' شرایط ', text: ' شرایط ',
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.caption! .bodySmall!
.copyWith(color: Theme.of(context).colorScheme.primary), .copyWith(color: Theme.of(context).colorScheme.primary),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () => launchUrl( ..onTap = () => launchUrl(
@ -84,7 +84,7 @@ class _UsernameInputState extends State<UsernameInput> {
text: ' قوانین حریم خصوصی ', text: ' قوانین حریم خصوصی ',
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.caption! .bodySmall!
.copyWith(color: Theme.of(context).colorScheme.primary), .copyWith(color: Theme.of(context).colorScheme.primary),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () => launchUrl( ..onTap = () => launchUrl(

View File

@ -52,7 +52,7 @@ class _VerificationState extends State<Verification> {
children: [ children: [
DidvanText( DidvanText(
'کد 6 رقمی ارسال شده به موبایل', 'کد 6 رقمی ارسال شده به موبایل',
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
const SizedBox( const SizedBox(
@ -60,14 +60,14 @@ class _VerificationState extends State<Verification> {
), ),
DidvanText( DidvanText(
state.username, state.username,
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
DidvanText( DidvanText(
'را وارد کنید:', 'را وارد کنید:',
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
const SizedBox( const SizedBox(

View File

@ -30,7 +30,7 @@ class AuthenticationAppBar extends StatelessWidget {
if (title != null) if (title != null)
DidvanText( DidvanText(
title!, title!,
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
) )
], ],

View File

@ -1,5 +1,4 @@
import 'package:didvan/views/authentication/widgets/authentication_app_bar.dart'; 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:didvan/views/widgets/logos/didvan_vertical_logo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

View File

@ -144,7 +144,7 @@ class _MessageBoxState extends State<_MessageBox> {
DidvanText( DidvanText(
'پاسخ به ${state.replyingTo!.fullName}:', 'پاسخ به ${state.replyingTo!.fullName}:',
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
const Spacer(), const Spacer(),
DidvanIconButton( DidvanIconButton(
@ -185,13 +185,13 @@ class _MessageBoxState extends State<_MessageBox> {
controller: _controller, controller: _controller,
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.send, textInputAction: TextInputAction.send,
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
onEditingComplete: () {}, onEditingComplete: () {},
onSubmitted: (value) => _onSend(state), onSubmitted: (value) => _onSend(state),
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: 'پیام خود را ارسال کنید', hintText: 'پیام خود را ارسال کنید',
hintStyle: Theme.of(context).textTheme.caption!.copyWith( hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.disabledText), color: Theme.of(context).colorScheme.disabledText),
), ),
onChanged: (value) => state.text = value, onChanged: (value) => state.text = value,

View File

@ -92,12 +92,12 @@ class CommentState extends State<Comment> {
children: [ children: [
DidvanText( DidvanText(
comment.user.fullName, comment.user.fullName,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
const Spacer(), const Spacer(),
DidvanText( DidvanText(
DateTimeUtils.momentGenerator(comment.createdAt), DateTimeUtils.momentGenerator(comment.createdAt),
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
@ -113,7 +113,7 @@ class CommentState extends State<Comment> {
if (isReply) if (isReply)
DidvanText( DidvanText(
'پاسخ به ${comment.toUser.fullName}', 'پاسخ به ${comment.toUser.fullName}',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -153,7 +153,7 @@ class CommentState extends State<Comment> {
}, },
child: DidvanText( child: DidvanText(
'پاسخ', 'پاسخ',
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
@ -167,7 +167,7 @@ class CommentState extends State<Comment> {
children: [ children: [
DidvanText( DidvanText(
'پاسخ‌ها(${comment.replies.length})', 'پاسخ‌ها(${comment.replies.length})',
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
AnimatedRotation( AnimatedRotation(
@ -284,7 +284,7 @@ class _FeedbackButtonsState extends State<_FeedbackButtons> {
children: [ children: [
DidvanText( DidvanText(
_likeCount.toString(), _likeCount.toString(),
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
@ -312,7 +312,7 @@ class _FeedbackButtonsState extends State<_FeedbackButtons> {
const SizedBox(width: 16), const SizedBox(width: 16),
DidvanText( DidvanText(
_dislikeCount.toString(), _dislikeCount.toString(),
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),

View File

@ -131,7 +131,7 @@ class _DirectState extends State<Direct> {
), ),
DidvanText( DidvanText(
'${state.deletionQueue.length} مورد انتخاب شد', '${state.deletionQueue.length} مورد انتخاب شد',
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
), ),
const Spacer(), const Spacer(),

View File

@ -60,7 +60,7 @@ class Message extends StatelessWidget {
), ),
child: DidvanText( child: DidvanText(
DateTime.parse(message.createdAt).toPersianDateStr(), DateTime.parse(message.createdAt).toPersianDateStr(),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: DesignConfig.isDark color: DesignConfig.isDark
? Theme.of(context).colorScheme.white ? Theme.of(context).colorScheme.white
: Theme.of(context).colorScheme.black, : Theme.of(context).colorScheme.black,
@ -103,7 +103,7 @@ class Message extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
DateTimeUtils.timeWithAmPm(message.createdAt), DateTimeUtils.timeWithAmPm(message.createdAt),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
if (!message.writedByAdmin) if (!message.writedByAdmin)
@ -150,7 +150,7 @@ class _ReplyRadarOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
message.radar!.title, message.radar!.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
color: Theme.of(context).colorScheme.focusedBorder, color: Theme.of(context).colorScheme.focusedBorder,
@ -158,18 +158,15 @@ class _ReplyRadarOverview extends StatelessWidget {
Row( Row(
children: [ children: [
DidvanText( DidvanText(
'رادار ' + message.radar!.categories.first.label, 'رادار ${message.radar!.categories.first.label}',
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.focusedBorder, color: Theme.of(context).colorScheme.focusedBorder,
), ),
const Spacer(), const Spacer(),
DidvanText( DidvanText(
DateTimeUtils.momentGenerator(message.radar!.createdAt) + '${DateTimeUtils.momentGenerator(message.radar!.createdAt)} | خواندن در ${message.radar!.timeToRead} دقیقه',
' | خواندن در ' +
message.radar!.timeToRead.toString() +
' دقیقه',
color: Theme.of(context).colorScheme.focusedBorder, color: Theme.of(context).colorScheme.focusedBorder,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
), ),
// DidvanText('text'), // DidvanText('text'),
], ],

View File

@ -144,11 +144,11 @@ class _TypingState extends State<_Typing> {
key: _formKey, key: _formKey,
child: TextFormField( child: TextFormField(
textInputAction: TextInputAction.send, textInputAction: TextInputAction.send,
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: 'بنویسید یا پیام صوتی بگذارید...', hintText: 'بنویسید یا پیام صوتی بگذارید...',
hintStyle: Theme.of(context).textTheme.caption!.copyWith( hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.disabledText), color: Theme.of(context).colorScheme.disabledText),
), ),
onChanged: (value) { onChanged: (value) {
@ -181,7 +181,7 @@ class _Recording extends StatelessWidget {
Expanded( Expanded(
child: DidvanText( child: DidvanText(
'در حال ضبط صدا ...', 'در حال ضبط صدا ...',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
), ),
DidvanIconButton( DidvanIconButton(

View File

@ -18,7 +18,7 @@ class Hashtag extends StatefulWidget {
const Hashtag({Key? key, required this.pageData}) : super(key: key); const Hashtag({Key? key, required this.pageData}) : super(key: key);
@override @override
_HashtagState createState() => _HashtagState(); State<Hashtag> createState() => _HashtagState();
} }
class _HashtagState extends State<Hashtag> { class _HashtagState extends State<Hashtag> {
@ -35,7 +35,7 @@ class _HashtagState extends State<Hashtag> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DidvanScaffold( return DidvanScaffold(
appBarData: AppBarData(title: '#' + _tag.label, hasBack: true), appBarData: AppBarData(title: '#${_tag.label}', hasBack: true),
slivers: [ slivers: [
Consumer<HashtagState>( Consumer<HashtagState>(
builder: (context, state, child) => SliverStateHandler<HashtagState>( builder: (context, state, child) => SliverStateHandler<HashtagState>(

View File

@ -117,7 +117,7 @@ class _NewsState extends State<News> {
children: [ children: [
ItemTitle( ItemTitle(
title: 'تاریخ خبر', title: 'تاریخ خبر',
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
icon: DidvanIcons.calendar_range_regular, icon: DidvanIcons.calendar_range_regular,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),

View File

@ -104,7 +104,7 @@ class _RadarState extends State<Radar> {
duration: DesignConfig.lowAnimationDuration, duration: DesignConfig.lowAnimationDuration,
child: DidvanText( child: DidvanText(
'آخرین رصد', 'آخرین رصد',
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
), ),
), ),
@ -260,7 +260,7 @@ class _RadarState extends State<Radar> {
children: [ children: [
ItemTitle( ItemTitle(
title: 'تاریخ رادار', title: 'تاریخ رادار',
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
icon: DidvanIcons.calendar_range_regular, icon: DidvanIcons.calendar_range_regular,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -287,7 +287,7 @@ class _RadarState extends State<Radar> {
ItemTitle( ItemTitle(
title: 'دسته بندی', title: 'دسته بندی',
icon: DidvanIcons.radar_regular, icon: DidvanIcons.radar_regular,
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Wrap( Wrap(

View File

@ -46,6 +46,33 @@ class _BookmarksState extends State<Bookmarks> {
title: 'نشان شده‌ها', title: 'نشان شده‌ها',
hasBack: true, hasBack: true,
), ),
slivers: [
SliverStateHandler<BookmarksState>(
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: [ children: [
SearchField( SearchField(
title: 'نشان شده‌ها', title: 'نشان شده‌ها',
@ -99,33 +126,6 @@ class _BookmarksState extends State<Bookmarks> {
), ),
), ),
], ],
slivers: [
SliverStateHandler<BookmarksState>(
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),
),
],
); );
} }

View File

@ -16,7 +16,7 @@ class FilteredBookmarks extends StatefulWidget {
const FilteredBookmarks({Key? key, this.onDeleted}) : super(key: key); const FilteredBookmarks({Key? key, this.onDeleted}) : super(key: key);
@override @override
_FilteredBookmarksState createState() => _FilteredBookmarksState(); State<FilteredBookmarks> createState() => _FilteredBookmarksState();
} }
class _FilteredBookmarksState extends State<FilteredBookmarks> { class _FilteredBookmarksState extends State<FilteredBookmarks> {

View File

@ -20,7 +20,7 @@ class FilteredBookmarksState extends CoreProvier {
} else if (type == 'news') { } else if (type == 'news') {
typeString = type; typeString = type;
} else { } else {
typeString = type + 's'; typeString = '${type}s';
} }
final service = RequestService( final service = RequestService(
RequestHelper.bookmarks( RequestHelper.bookmarks(

View File

@ -19,9 +19,9 @@ class DirectListState extends CoreProvier {
await service.httpGet(); await service.httpGet();
if (service.isSuccess) { if (service.isSuccess) {
_unreadCount = service.result['unread'] ?? 0; _unreadCount = service.result['unread'] ?? 0;
final List _chatRooms = service.result['chatRooms'] ?? []; final List chatRooms = service.result['chatRooms'] ?? [];
for (var i = 0; i < _chatRooms.length; i++) { for (var i = 0; i < chatRooms.length; i++) {
chatRooms.add(ChatRoom.fromJson(_chatRooms[i])); chatRooms.add(ChatRoom.fromJson(chatRooms[i]));
} }
appState = AppState.idle; appState = AppState.idle;
return; return;

View File

@ -43,7 +43,7 @@ class ChatRoomItem extends StatelessWidget {
Expanded( Expanded(
child: DidvanText( child: DidvanText(
chatRoom.type, chatRoom.type,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
), ),
if (chatRoom.unread != 0) if (chatRoom.unread != 0)
@ -83,7 +83,7 @@ class ChatRoomItem extends StatelessWidget {
), ),
DidvanText( DidvanText(
DateTimeUtils.momentGenerator(chatRoom.updatedAt), DateTimeUtils.momentGenerator(chatRoom.updatedAt),
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
) )
], ],

View File

@ -54,14 +54,11 @@ class _GeneralSettingsState extends State<GeneralSettings> {
title: 'زمان دریافت اعلان', title: 'زمان دریافت اعلان',
onTap: () => _pickTimeRange(context), onTap: () => _pickTimeRange(context),
icon: DidvanIcons.notification_regular, icon: DidvanIcons.notification_regular,
suffix: 'از' + suffix: 'از${DateTimeUtils.normalizeTimeDuration(
DateTimeUtils.normalizeTimeDuration(
Duration(minutes: state.notificationTimeRange[0]), Duration(minutes: state.notificationTimeRange[0]),
) + )} تا ${DateTimeUtils.normalizeTimeDuration(
' تا ' +
DateTimeUtils.normalizeTimeDuration(
Duration(minutes: state.notificationTimeRange[1]), Duration(minutes: state.notificationTimeRange[1]),
), )}',
), ),
), ),
const ItemTitle( const ItemTitle(
@ -254,8 +251,8 @@ class _GeneralSettingsState extends State<GeneralSettings> {
okText: 'تایید', okText: 'تایید',
cancelText: 'بازگشت', cancelText: 'بازگشت',
accentColor: Theme.of(context).colorScheme.primary, accentColor: Theme.of(context).colorScheme.primary,
okStyle: Theme.of(context).textTheme.bodyText2!, okStyle: Theme.of(context).textTheme.bodyMedium!,
cancelStyle: Theme.of(context).textTheme.bodyText2!, cancelStyle: Theme.of(context).textTheme.bodyMedium!,
unselectedColor: Theme.of(context).colorScheme.text, unselectedColor: Theme.of(context).colorScheme.text,
blurredBackground: true, blurredBackground: true,
disableMinute: true, disableMinute: true,

View File

@ -87,7 +87,7 @@ class _ProfileState extends State<Profile> {
isVisible: !_usernameIsAvailible, isVisible: !_usernameIsAvailible,
child: DidvanText( child: DidvanText(
'نام کاربری در دسترس نمی‌باشد', 'نام کاربری در دسترس نمی‌باشد',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
), ),
), ),

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:didvan/config/theme_data.dart'; import 'package:didvan/config/theme_data.dart';
import 'package:didvan/constants/app_icons.dart'; import 'package:didvan/constants/app_icons.dart';

View File

@ -131,7 +131,7 @@ class Settings extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
DidvanText( DidvanText(
'نسخه نرم‌افزار: 2.2.5', 'نسخه نرم‌افزار: 2.2.5',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
], ],
), ),

View File

@ -74,7 +74,7 @@ class _StatisticState extends State<Statistic> {
duration: DesignConfig.lowAnimationDuration, duration: DesignConfig.lowAnimationDuration,
child: DidvanText( child: DidvanText(
'شاخص‌های منتخب', 'شاخص‌های منتخب',
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
), ),
), ),

View File

@ -16,6 +16,7 @@ import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// ignore: depend_on_referenced_packages
import 'package:intl/intl.dart' as intl; import 'package:intl/intl.dart' as intl;
class StatisticDetails extends StatefulWidget { class StatisticDetails extends StatefulWidget {
@ -95,7 +96,7 @@ class _StatisticDetailsState extends State<StatisticDetails> {
)}', )}',
Theme.of(context) Theme.of(context)
.textTheme .textTheme
.caption! .bodySmall!
.copyWith( .copyWith(
color: Colors.white, color: Colors.white,
), ),
@ -284,8 +285,8 @@ class _StatisticDetailsState extends State<StatisticDetails> {
DidvanText( DidvanText(
title, title,
style: isBold style: isBold
? Theme.of(context).textTheme.bodyText1 ? Theme.of(context).textTheme.bodyLarge
: Theme.of(context).textTheme.bodyText2, : Theme.of(context).textTheme.bodyMedium,
), ),
const Spacer(), const Spacer(),
if (icon != null) Icon(icon, color: color), if (icon != null) Icon(icon, color: color),

View File

@ -6,6 +6,7 @@ import 'package:didvan/models/tag.dart';
import 'package:didvan/providers/core.dart'; import 'package:didvan/providers/core.dart';
import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request.dart';
import 'package:didvan/services/network/request_helper.dart'; import 'package:didvan/services/network/request_helper.dart';
// ignore: depend_on_referenced_packages
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
class StatisticDetailsState extends CoreProvier { class StatisticDetailsState extends CoreProvier {

View File

@ -1,4 +1,5 @@
import 'package:didvan/constants/assets.dart'; import 'package:didvan/constants/assets.dart';
// ignore: depend_on_referenced_packages
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:didvan/models/category.dart'; import 'package:didvan/models/category.dart';
import 'package:didvan/models/enums.dart'; import 'package:didvan/models/enums.dart';

View File

@ -46,7 +46,7 @@ class StatisticOverview extends StatelessWidget {
), ),
DidvanText( DidvanText(
statistic.title, statistic.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
const Spacer(), const Spacer(),
if (_hasDiff) if (_hasDiff)
@ -57,7 +57,7 @@ class StatisticOverview extends StatelessWidget {
if (_hasDiff) const SizedBox(width: 8), if (_hasDiff) const SizedBox(width: 8),
DidvanText( DidvanText(
statistic.data.p, statistic.data.p,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
) )
], ],
), ),
@ -71,7 +71,7 @@ class StatisticOverview extends StatelessWidget {
), ),
DidvanText( DidvanText(
statistic.data.l, statistic.data.l,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.hint, color: Theme.of(context).colorScheme.hint,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
@ -82,7 +82,7 @@ class StatisticOverview extends StatelessWidget {
), ),
DidvanText( DidvanText(
statistic.data.h, statistic.data.h,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.hint, color: Theme.of(context).colorScheme.hint,
), ),
const Spacer(), const Spacer(),
@ -98,7 +98,7 @@ class StatisticOverview extends StatelessWidget {
if (_hasDiff) if (_hasDiff)
DidvanText( DidvanText(
'${statistic.data.dp}%', '${statistic.data.dp}%',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: _diffColor(context), color: _diffColor(context),
), ),
], ],

View File

@ -245,7 +245,7 @@ class _StudioState extends State<Studio> {
children: [ children: [
ItemTitle( ItemTitle(
title: 'تاریخ رادار', title: 'تاریخ رادار',
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
icon: DidvanIcons.calendar_range_regular, icon: DidvanIcons.calendar_range_regular,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),

View File

@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:better_player/better_player.dart'; import 'package:better_player/better_player.dart';
import 'package:didvan/models/view/app_bar_data.dart'; import 'package:didvan/models/view/app_bar_data.dart';
import 'package:didvan/services/media/media.dart'; import 'package:didvan/services/media/media.dart';

View File

@ -115,7 +115,7 @@ class _TabItem extends StatelessWidget {
DidvanText( DidvanText(
title, title,
color: _color(context), color: _color(context),
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
) )
], ],
), ),

View File

@ -243,7 +243,7 @@ class _StudioPreview extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
DidvanText( DidvanText(
_previewTitle, _previewTitle,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -252,7 +252,7 @@ class _StudioPreview extends StatelessWidget {
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
], ],

View File

@ -93,7 +93,7 @@ class _StudioSliderState extends State<StudioSlider> {
child: DidvanText( child: DidvanText(
state.sliders[i].title, state.sliders[i].title,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
), ),
), ),

View File

@ -97,7 +97,7 @@ class _StudioTypeButton extends StatelessWidget {
), ),
DidvanText( DidvanText(
title, title,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: _color(context), color: _color(context),
) )
], ],

View File

@ -54,7 +54,7 @@ class AudioPlayerWidget extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
DidvanText( DidvanText(
podcast.title, podcast.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Padding( Padding(
@ -89,7 +89,7 @@ class AudioPlayerWidget extends StatelessWidget {
? 'پایان پادکست' ? 'پایان پادکست'
: '\'${state.timerValue}', : '\'${state.timerValue}',
isEnglishFont: true, isEnglishFont: true,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
), ),
], ],
@ -223,7 +223,7 @@ class AudioPlayerWidget extends StatelessWidget {
const SizedBox(height: 24), const SizedBox(height: 24),
DidvanText( DidvanText(
'$timerValue دقیقه', '$timerValue دقیقه',
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.displaySmall,
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
const Icon(DidvanIcons.caret_down_solid), const Icon(DidvanIcons.caret_down_solid),

View File

@ -78,7 +78,7 @@ class CategoryItem extends StatelessWidget {
), ),
DidvanText( DidvanText(
category.label, category.label,
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
), ),
], ],

View File

@ -31,7 +31,7 @@ class DurationWidget extends StatelessWidget {
Duration(seconds: duration), Duration(seconds: duration),
), ),
isEnglishFont: true, isEnglishFont: true,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.focusedBorder, color: Theme.of(context).colorScheme.focusedBorder,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),

View File

@ -55,7 +55,7 @@ class MenuOption extends StatelessWidget {
suffix!, suffix!,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.subtitle2! .titleSmall!
.copyWith(fontWeight: FontWeight.w400), .copyWith(fontWeight: FontWeight.w400),
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),

View File

@ -113,7 +113,7 @@ class MultitypeOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
item.title, item.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@ -126,7 +126,7 @@ class MultitypeOverview extends StatelessWidget {
const SizedBox(width: 4), const SizedBox(width: 4),
DidvanText( DidvanText(
DateTime.parse(item.createdAt).toPersianDateStr(), DateTime.parse(item.createdAt).toPersianDateStr(),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
), ),
const Spacer(), const Spacer(),
if ((item.timeToRead ?? item.duration) != null) ...[ if ((item.timeToRead ?? item.duration) != null) ...[
@ -141,7 +141,7 @@ class MultitypeOverview extends StatelessWidget {
: DateTimeUtils.normalizeTimeDuration( : DateTimeUtils.normalizeTimeDuration(
Duration(seconds: item.duration!), Duration(seconds: item.duration!),
), ),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
), ),
] ]
], ],

View File

@ -51,7 +51,7 @@ class NewsOverview extends StatelessWidget {
height: 64, height: 64,
child: DidvanText( child: DidvanText(
news.title, news.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
), ),
), ),
@ -70,11 +70,11 @@ class NewsOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
news.reference!, news.reference!,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
DidvanText( DidvanText(
' - ${DateTimeUtils.momentGenerator(news.createdAt)}', ' - ${DateTimeUtils.momentGenerator(news.createdAt)}',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
], ],
), ),

View File

@ -56,12 +56,12 @@ class PodcastOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
podcast.title, podcast.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
DidvanText( DidvanText(
DateTimeUtils.momentGenerator(podcast.createdAt), DateTimeUtils.momentGenerator(podcast.createdAt),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
], ],

View File

@ -70,7 +70,7 @@ class RadarOverview extends StatelessWidget {
), ),
child: DidvanText( child: DidvanText(
'برای مدیران', 'برای مدیران',
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.white, color: Theme.of(context).colorScheme.white,
), ),
), ),
@ -82,13 +82,13 @@ class RadarOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
radar.categories!.first.label, radar.categories!.first.label,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
const Spacer(), const Spacer(),
DidvanText( DidvanText(
'${DateTimeUtils.momentGenerator(radar.createdAt)} | خواندن در ${radar.timeToRead} دقیقه', '${DateTimeUtils.momentGenerator(radar.createdAt)} | خواندن در ${radar.timeToRead} دقیقه',
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
], ],

View File

@ -71,7 +71,7 @@ class VideoOverview extends StatelessWidget {
children: [ children: [
DidvanText( DidvanText(
video.title, video.title,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Row(
@ -83,7 +83,7 @@ class VideoOverview extends StatelessWidget {
const SizedBox(width: 4), const SizedBox(width: 4),
DidvanText( DidvanText(
DateTimeUtils.momentGenerator(video.createdAt), DateTimeUtils.momentGenerator(video.createdAt),
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
], ],

View File

@ -45,7 +45,7 @@ class _SearchFieldState extends State<SearchField> {
), ),
child: TextFormField( child: TextFormField(
focusNode: widget.focusNode, focusNode: widget.focusNode,
style: Theme.of(context).textTheme.bodyText2, style: Theme.of(context).textTheme.bodyMedium,
textAlignVertical: TextAlignVertical.center, textAlignVertical: TextAlignVertical.center,
onChanged: widget.onChanged, onChanged: widget.onChanged,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,

View File

@ -50,7 +50,7 @@ class TagItem extends StatelessWidget {
DidvanText( DidvanText(
tag.label, tag.label,
color: Theme.of(context).colorScheme.focusedBorder, color: Theme.of(context).colorScheme.focusedBorder,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
), ),
], ],
), ),

View File

@ -99,6 +99,9 @@ class _SplashState extends State<Splash> {
}); });
} }
final settingsData = await AppInitializer.initilizeSettings(); final settingsData = await AppInitializer.initilizeSettings();
if (!mounted) {
return;
}
final themeProvider = context.read<ThemeProvider>(); final themeProvider = context.read<ThemeProvider>();
themeProvider.themeMode = settingsData.themeMode; themeProvider.themeMode = settingsData.themeMode;
themeProvider.fontFamily = settingsData.fontFamily; themeProvider.fontFamily = settingsData.fontFamily;
@ -109,18 +112,24 @@ class _SplashState extends State<Splash> {
_isGettingThemeData = false; _isGettingThemeData = false;
}), }),
); );
if (!mounted) {
return;
}
await AppInitializer.setupServices(context); await AppInitializer.setupServices(context);
if (!mounted) {
return;
}
final userProvider = context.read<UserProvider>(); final userProvider = context.read<UserProvider>();
final String? token = await userProvider.setAndGetToken(); final String? token = await userProvider.setAndGetToken();
if (token != null) { if (token != null) {
log(token); log(token);
if (!kIsWeb) { if (!kIsWeb && mounted) {
context.read<MediaProvider>().getDownloadsList(); context.read<MediaProvider>().getDownloadsList();
} }
RequestService.token = token; RequestService.token = token;
final result = await userProvider.getUserInfo(); final result = await userProvider.getUserInfo();
await userProvider.getUnreadMessageCount(); await userProvider.getUnreadMessageCount();
if (!result) { if (!result && mounted) {
StorageService.delete(key: 'token'); StorageService.delete(key: 'token');
Navigator.of(context).pushNamedAndRemoveUntil( Navigator.of(context).pushNamedAndRemoveUntil(
Routes.splash, Routes.splash,
@ -130,10 +139,12 @@ class _SplashState extends State<Splash> {
} }
await ServerDataProvider.getData(); await ServerDataProvider.getData();
} }
if (mounted) {
Navigator.of(context).pushReplacementNamed( Navigator.of(context).pushReplacementNamed(
token == null ? Routes.authenticaion : Routes.home, token == null ? Routes.authenticaion : Routes.home,
arguments: token == null ? false : null, arguments: token == null ? false : null,
); );
}
} catch (e) { } catch (e) {
setState(() { setState(() {
_errorOccured = true; _errorOccured = true;

View File

@ -51,7 +51,7 @@ class DidvanAppBar extends StatelessWidget {
if (appBarData.title != null) if (appBarData.title != null)
DidvanText( DidvanText(
appBarData.title!, appBarData.title!,
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.displaySmall,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@ -60,7 +60,7 @@ class DidvanAppBar extends StatelessWidget {
appBarData.subtitle!, appBarData.subtitle!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.caption, color: Theme.of(context).colorScheme.caption,
), ),
], ],

View File

@ -26,7 +26,7 @@ class DidvanBadge extends StatelessWidget {
text, text,
isEnglishFont: true, isEnglishFont: true,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.overline, style: Theme.of(context).textTheme.labelSmall,
color: Theme.of(context).colorScheme.white, color: Theme.of(context).colorScheme.white,
), ),
), ),

View File

@ -440,7 +440,7 @@ class _NavBarItem extends StatelessWidget {
), ),
DidvanText( DidvanText(
title, title,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.title, color: Theme.of(context).colorScheme.title,
), ),
const Spacer(), const Spacer(),

View File

@ -26,7 +26,7 @@ class DidvanChip extends StatelessWidget {
), ),
child: DidvanText( child: DidvanText(
label, label,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.white, color: Theme.of(context).colorScheme.white,
), ),
), ),

View File

@ -101,7 +101,7 @@ class _DidvanPageViewState extends State<DidvanPageView> {
const EdgeInsets.symmetric(horizontal: 16), const EdgeInsets.symmetric(horizontal: 16),
child: DidvanText( child: DidvanText(
item.title, item.title,
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.titleMedium,
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -120,7 +120,7 @@ class _DidvanPageViewState extends State<DidvanPageView> {
color: Theme.of(context).colorScheme.hint, color: Theme.of(context).colorScheme.hint,
), ),
borderRadius: DesignConfig.lowBorderRadius, borderRadius: DesignConfig.lowBorderRadius,
color: Theme.of(context).backgroundColor, color: Theme.of(context).colorScheme.background,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -287,7 +287,7 @@ class _DidvanPageViewState extends State<DidvanPageView> {
const SizedBox(width: 8), const SizedBox(width: 8),
DidvanText( DidvanText(
element!.text, element!.text,
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.titleSmall,
), ),
], ],
), ),
@ -361,7 +361,7 @@ class _DidvanPageViewState extends State<DidvanPageView> {
child: DidvanText( child: DidvanText(
content.caption, content.caption,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
), ),
], ],
@ -377,17 +377,17 @@ class _DidvanPageViewState extends State<DidvanPageView> {
children: [ children: [
DidvanText( DidvanText(
'رادار ', 'رادار ',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
for (var i = 0; i < item.categories.length; i++) for (var i = 0; i < item.categories.length; i++)
DidvanText( DidvanText(
item.categories[i].label + item.categories[i].label +
'${i != item.categories.length - 1 ? '،' : ''} ', '${i != item.categories.length - 1 ? '،' : ''} ',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
DidvanText( DidvanText(
' - ${DateTimeUtils.momentGenerator(item.createdAt)}', ' - ${DateTimeUtils.momentGenerator(item.createdAt)}',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
], ],
); );
@ -396,11 +396,11 @@ class _DidvanPageViewState extends State<DidvanPageView> {
children: [ children: [
DidvanText( DidvanText(
item.reference, item.reference,
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
DidvanText( DidvanText(
' - ${DateTimeUtils.momentGenerator(item.createdAt)}', ' - ${DateTimeUtils.momentGenerator(item.createdAt)}',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
), ),
], ],
); );

View File

@ -51,7 +51,7 @@ class DidvanRadialButton extends StatelessWidget {
const SizedBox(width: 8), const SizedBox(width: 8),
DidvanText( DidvanText(
title, title,
style: Theme.of(context).textTheme.bodyText2!.copyWith( style: Theme.of(context).textTheme.bodyMedium!.copyWith(
fontFamily: fontFamily, fontFamily: fontFamily,
), ),
fontSize: fontSize, fontSize: fontSize,

View File

@ -29,7 +29,7 @@ class DidvanText extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Text( return Text(
text, text,
style: ((style ?? Theme.of(context).textTheme.bodyText2)!.copyWith( style: ((style ?? Theme.of(context).textTheme.bodyMedium)!.copyWith(
color: color, color: color,
fontWeight: fontWeight, fontWeight: fontWeight,
fontSize: fontSize, fontSize: fontSize,

View File

@ -98,7 +98,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
obscuringCharacter: '*', obscuringCharacter: '*',
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.bodyText2! .bodyMedium!
.copyWith(fontFamily: DesignConfig.fontFamily.padRight(3)), .copyWith(fontFamily: DesignConfig.fontFamily.padRight(3)),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: _suffixBuilder(), suffixIcon: _suffixBuilder(),
@ -108,7 +108,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
errorStyle: const TextStyle(height: 0.01), errorStyle: const TextStyle(height: 0.01),
hintStyle: Theme.of(context) hintStyle: Theme.of(context)
.textTheme .textTheme
.bodyText2! .bodyMedium!
.copyWith(color: Theme.of(context).colorScheme.hint), .copyWith(color: Theme.of(context).colorScheme.hint),
), ),
), ),
@ -126,7 +126,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
), ),
DidvanText( DidvanText(
_error ?? '', _error ?? '',
style: Theme.of(context).textTheme.caption, style: Theme.of(context).textTheme.bodySmall,
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
), ),
], ],

View File

@ -28,7 +28,7 @@ class ItemTitle extends StatelessWidget {
if (icon != null) const SizedBox(width: 4), if (icon != null) const SizedBox(width: 4),
DidvanText( DidvanText(
title, title,
style: style ?? Theme.of(context).textTheme.subtitle1, style: style ?? Theme.of(context).textTheme.titleMedium,
color: color ?? Theme.of(context).colorScheme.title, color: color ?? Theme.of(context).colorScheme.title,
) )
], ],

View File

@ -4,6 +4,7 @@ import 'package:didvan/services/network/request.dart';
import 'package:didvan/services/network/request_helper.dart'; import 'package:didvan/services/network/request_helper.dart';
import 'package:didvan/views/widgets/shimmer_placeholder.dart'; import 'package:didvan/views/widgets/shimmer_placeholder.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// ignore: depend_on_referenced_packages
import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart'; import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart';
class SkeletonImage extends StatelessWidget { class SkeletonImage extends StatelessWidget {

View File

@ -31,7 +31,7 @@ class EmptyState extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
DidvanText( DidvanText(
title, title,
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.displaySmall,
color: titleColor ?? Theme.of(context).colorScheme.caption, color: titleColor ?? Theme.of(context).colorScheme.caption,
), ),
if (subtitle != null) const SizedBox(height: 8), if (subtitle != null) const SizedBox(height: 8),