some little changes
This commit is contained in:
parent
4b5dfe5e38
commit
eadfa391fd
|
|
@ -24,11 +24,13 @@ class Content {
|
|||
final int id;
|
||||
final String label;
|
||||
final String title;
|
||||
final int category;
|
||||
final int type;
|
||||
final bool marked;
|
||||
final Data data;
|
||||
|
||||
Content({
|
||||
required this.category,
|
||||
required this.id,
|
||||
required this.label,
|
||||
required this.title,
|
||||
|
|
@ -45,6 +47,7 @@ class Content {
|
|||
type: json['type'],
|
||||
marked: json['marked'],
|
||||
data: Data.fromJson(json['data']),
|
||||
category: json['category'],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +56,7 @@ class Content {
|
|||
'id': id,
|
||||
'label': label,
|
||||
'title': title,
|
||||
'category': category,
|
||||
'type': type,
|
||||
'marked': marked,
|
||||
'data': data.toJson(),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class RequestHelper {
|
|||
String? search,
|
||||
List<int>? types,
|
||||
}) =>
|
||||
'$_baseHomeUrl/mark${_urlConcatGenerator([
|
||||
'$_baseHomeUrl/mark/v2${_urlConcatGenerator([
|
||||
MapEntry('page', page),
|
||||
MapEntry('q', search),
|
||||
MapEntry('type', _urlListConcatGenerator(types)),
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import 'package:didvan/views/widgets/didvan/checkbox.dart';
|
|||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
import 'package:didvan/views/widgets/item_title.dart';
|
||||
import 'package:didvan/views/widgets/search_field.dart';
|
||||
import 'package:didvan/views/widgets/state_handlers/empty_result.dart';
|
||||
import 'package:didvan/views/widgets/state_handlers/state_handler.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
|
@ -144,6 +145,10 @@ class _InfographyScreenState extends State<InfographyScreen> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StateHandler<InfographyScreenState>(
|
||||
emptyState: EmptyResult(
|
||||
onNewSearch: () => _focusNode.requestFocus(),
|
||||
),
|
||||
enableEmptyState: context.watch<InfographyScreenState>().contents.isEmpty,
|
||||
onRetry: context.read<InfographyScreenState>().init,
|
||||
state: context.watch<InfographyScreenState>(),
|
||||
builder: (context, state) {
|
||||
|
|
@ -170,6 +175,7 @@ class _InfographyScreenState extends State<InfographyScreen> {
|
|||
onChanged: _onChanged,
|
||||
focusNode: _focusNode,
|
||||
onFilterButtonPressed: _showFilterBottomSheet,
|
||||
value: state.lastSearch,
|
||||
isFiltered: state.filtering),
|
||||
),
|
||||
Expanded(
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class _NewStatisticState extends State<NewStatistic> {
|
|||
arguments: {
|
||||
"id": 2,
|
||||
"title": state.contents[2].header
|
||||
});
|
||||
}).then((value) => _reset());
|
||||
}),
|
||||
child: StatHeader(
|
||||
header: state.contents[2].header,
|
||||
|
|
@ -151,7 +151,7 @@ class _NewStatisticState extends State<NewStatistic> {
|
|||
onTap: () => Future.delayed(Duration.zero, () {
|
||||
Navigator.of(context).pushNamed(Routes.statGeneral,
|
||||
arguments: {"id": 3, "title": state.contents[3].header});
|
||||
}),
|
||||
}).then((value) => _reset()),
|
||||
child: StatHeader(
|
||||
header: state.contents[3].header,
|
||||
icon: DidvanIcons.commodity_solid,
|
||||
|
|
@ -176,7 +176,7 @@ class _NewStatisticState extends State<NewStatistic> {
|
|||
arguments: {
|
||||
"id": 4,
|
||||
"title": state.contents[4].header
|
||||
});
|
||||
}).then((value) => _reset());
|
||||
}),
|
||||
child: StatHeader(
|
||||
header: state.contents[4].header,
|
||||
|
|
@ -201,7 +201,7 @@ class _NewStatisticState extends State<NewStatistic> {
|
|||
.pushNamed(Routes.statGeneral, arguments: {
|
||||
"id": 5,
|
||||
"title": state.contents[5].header,
|
||||
});
|
||||
}).then((value) => _reset());
|
||||
}),
|
||||
child: StatHeader(
|
||||
header: state.contents[5].header,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:didvan/views/home/new_statistic/statistics_details/stat_cats_gen
|
|||
import 'package:didvan/views/home/new_statistic/widgets/general_stat_card.dart';
|
||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||
import 'package:didvan/views/widgets/search_field.dart';
|
||||
import 'package:didvan/views/widgets/state_handlers/empty_result.dart';
|
||||
import 'package:didvan/views/widgets/state_handlers/state_handler.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
|
@ -76,6 +77,11 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
|
|||
return StateHandler<StatGeneralScreenState>(
|
||||
onRetry: context.read<StatGeneralScreenState>().init,
|
||||
state: context.watch<StatGeneralScreenState>(),
|
||||
emptyState: EmptyResult(
|
||||
onNewSearch: () => _focusNode.requestFocus(),
|
||||
),
|
||||
enableEmptyState:
|
||||
context.watch<StatGeneralScreenState>().contents.isEmpty,
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
@ -99,6 +105,7 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
|
|||
title: widget.pageData['title'],
|
||||
onChanged: _onChanged,
|
||||
focusNode: _focusNode,
|
||||
value: state.lastSearch,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:didvan/models/enums.dart';
|
||||
import 'package:didvan/models/new_statistic/general_item_model.dart';
|
||||
import 'package:didvan/models/requests/newstats_general.dart';
|
||||
|
|
@ -51,8 +53,8 @@ class StatGeneralScreenState extends CoreProvier {
|
|||
}
|
||||
|
||||
void resetFilters(bool isInit) {
|
||||
search = '';
|
||||
lastSearch = '';
|
||||
// search = '';
|
||||
// lastSearch = '';
|
||||
if (!isInit) {
|
||||
getGeneralStatContent(page: 1, id: type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class TotalType3Card extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 45,
|
||||
width: 52,
|
||||
child: Center(
|
||||
child: DidvanText(
|
||||
overflow: TextOverflow.fade,
|
||||
|
|
@ -110,6 +110,7 @@ class TotalType3Card extends StatelessWidget {
|
|||
? Theme.of(context).colorScheme.success
|
||||
: Theme.of(context).colorScheme.error),
|
||||
DidvanText("${e.dp}%",
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
color: totalContent.id == 36
|
||||
? Theme.of(context).colorScheme.success
|
||||
: Theme.of(context).colorScheme.error),
|
||||
|
|
@ -121,57 +122,6 @@ class TotalType3Card extends StatelessWidget {
|
|||
)
|
||||
.toList(),
|
||||
)
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.width / 2,
|
||||
// child: ListView.builder(
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
// itemCount: totalContent.data.length,
|
||||
// itemBuilder: (context, index) => Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width * 0.25,
|
||||
// child: DidvanText(
|
||||
// totalContent.data[index].name.toString(),
|
||||
// overflow: TextOverflow.fade,
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 40,
|
||||
// child: Center(
|
||||
// child: DidvanText(
|
||||
// totalContent.data[index].p.toString(),
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width * 0.25,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// Icon(
|
||||
// totalContent.id == 36
|
||||
// ? DidvanIcons.angle_up_regular
|
||||
// : DidvanIcons.angle_down_regular,
|
||||
// size: 14,
|
||||
// color: totalContent.id == 36
|
||||
// ? Theme.of(context).colorScheme.success
|
||||
// : Theme.of(context).colorScheme.error),
|
||||
// DidvanText(
|
||||
// totalContent.data[index].dp.toString() + "%",
|
||||
// color: totalContent.id == 36
|
||||
// ? Theme.of(context).colorScheme.success
|
||||
// : Theme.of(context).colorScheme.error),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class TotalType4Card extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
children: totalContent.data
|
||||
.map((e) => Row(
|
||||
|
|
@ -83,6 +82,7 @@ class TotalType4Card extends StatelessWidget {
|
|||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: DidvanText(
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
e.p.toString(),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
|
|
@ -92,42 +92,6 @@ class TotalType4Card extends StatelessWidget {
|
|||
))
|
||||
.toList(),
|
||||
)
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.width / 2,
|
||||
// child: ListView.builder(
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
// itemCount: totalContent.data.length,
|
||||
// itemBuilder: (context, index) => Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width * 0.25,
|
||||
// child: DidvanText(
|
||||
// totalContent.data[index].name.toString(),
|
||||
// overflow: TextOverflow.fade,
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// ),
|
||||
// DidvanText(
|
||||
// totalContent.data[index].v.toString(),
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: MediaQuery.of(context).size.width * 0.25,
|
||||
// child: Directionality(
|
||||
// textDirection: TextDirection.ltr,
|
||||
// child: DidvanText(
|
||||
// totalContent.data[index].p.toString(),
|
||||
// textAlign: TextAlign.start,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:didvan/config/theme_data.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/models/new_statistic/general_item_model.dart';
|
||||
|
|
@ -49,8 +51,9 @@ class _NewStatisticOverviewCardState extends State<NewStatisticOverviewCard> {
|
|||
builder: (context, state) => Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: DidvanCard(
|
||||
onTap: () => widget.statistic.id != 5
|
||||
? Navigator.of(context)
|
||||
onTap: () {
|
||||
if (widget.statistic.category != 5) {
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.statisticDetails, arguments: {
|
||||
'onMarkChanged': (value) =>
|
||||
widget.onMarkChanged(widget.statistic.id, value),
|
||||
|
|
@ -58,9 +61,10 @@ class _NewStatisticOverviewCardState extends State<NewStatisticOverviewCard> {
|
|||
'title': widget.statistic.title,
|
||||
'marked': widget.statistic.marked,
|
||||
}).then(
|
||||
(value) => state.getGeneralStatContent(page: 1, id: 7),
|
||||
)
|
||||
: null,
|
||||
(value) => state.getGeneralStatContent(page: 1),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class MultitypeOverview extends StatelessWidget {
|
|||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
SkeletonImage(imageUrl: item.image, height: 80, width: 80),
|
||||
SkeletonImage(imageUrl: item.image, height: 80, width: 60),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
|
|
@ -162,10 +162,11 @@ class MultitypeOverview extends StatelessWidget {
|
|||
),
|
||||
Flexible(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
DidvanIcons.calendar_day_light,
|
||||
size: 12,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
DidvanText(
|
||||
|
|
@ -176,12 +177,12 @@ class MultitypeOverview extends StatelessWidget {
|
|||
if ((item.timeToRead ?? item.duration) != null) ...[
|
||||
const Icon(
|
||||
DidvanIcons.timer_light,
|
||||
size: 18,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
DidvanText(
|
||||
item.timeToRead != null
|
||||
? 'خواندن در ${item.timeToRead} دقیقه'
|
||||
? '${item.timeToRead} دقیقه'
|
||||
: DateTimeUtils.normalizeTimeDuration(
|
||||
Duration(seconds: item.duration!),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue