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