some changes
This commit is contained in:
parent
d3252e931f
commit
dfe506bb01
|
|
@ -7,10 +7,14 @@ import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
import 'package:didvan/utils/action_sheet.dart';
|
import 'package:didvan/utils/action_sheet.dart';
|
||||||
import 'package:didvan/views/home/infography/infography_screen_state.dart';
|
import 'package:didvan/views/home/infography/infography_screen_state.dart';
|
||||||
import 'package:didvan/views/home/main/widgets/infography_item.dart';
|
import 'package:didvan/views/home/main/widgets/infography_item.dart';
|
||||||
|
import 'package:didvan/views/widgets/didvan/card.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/checkbox.dart';
|
import 'package:didvan/views/widgets/didvan/checkbox.dart';
|
||||||
|
import 'package:didvan/views/widgets/didvan/divider.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/overview/news.dart';
|
||||||
import 'package:didvan/views/widgets/search_field.dart';
|
import 'package:didvan/views/widgets/search_field.dart';
|
||||||
|
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/empty_result.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';
|
||||||
|
|
@ -144,61 +148,109 @@ class _InfographyScreenState extends State<InfographyScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return StateHandler<InfographyScreenState>(
|
return Scaffold(
|
||||||
emptyState: EmptyResult(
|
appBar: AppBar(
|
||||||
onNewSearch: () => _focusNode.requestFocus(),
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
elevation: 0.0,
|
||||||
|
scrolledUnderElevation: 0.0,
|
||||||
|
title: DidvanText(
|
||||||
|
"اینفوگرافی",
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
enableEmptyState: context.watch<InfographyScreenState>().contents.isEmpty,
|
body: Column(
|
||||||
onRetry: context.read<InfographyScreenState>().init,
|
children: [
|
||||||
state: context.watch<InfographyScreenState>(),
|
Container(
|
||||||
builder: (context, state) {
|
height: 80,
|
||||||
return Scaffold(
|
color: Theme.of(context).colorScheme.surface,
|
||||||
appBar: AppBar(
|
padding:
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
|
||||||
elevation: 0.0,
|
child: SearchField(
|
||||||
scrolledUnderElevation: 0.0,
|
title: "اینفوگرافی",
|
||||||
title: DidvanText(
|
onChanged: _onChanged,
|
||||||
"اینفوگرافی",
|
focusNode: _focusNode,
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
onFilterButtonPressed: _showFilterBottomSheet,
|
||||||
fontSize: 20,
|
value: context.watch<InfographyScreenState>().lastSearch,
|
||||||
),
|
isFiltered: context.watch<InfographyScreenState>().filtering),
|
||||||
),
|
),
|
||||||
body: Column(
|
StateHandler<InfographyScreenState>(
|
||||||
children: [
|
placeholder: SingleChildScrollView(
|
||||||
Container(
|
child: Column(
|
||||||
height: 80,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
color: Theme.of(context).colorScheme.surface,
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
placeholder,
|
||||||
horizontal: 16.0, vertical: 16.0),
|
const SizedBox(
|
||||||
child: SearchField(
|
height: 4,
|
||||||
title: "اینفوگرافی",
|
|
||||||
onChanged: _onChanged,
|
|
||||||
focusNode: _focusNode,
|
|
||||||
onFilterButtonPressed: _showFilterBottomSheet,
|
|
||||||
value: state.lastSearch,
|
|
||||||
isFiltered: state.filtering),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ListView.builder(
|
|
||||||
controller: _scrollController,
|
|
||||||
itemCount: state.contents.length,
|
|
||||||
itemBuilder: (context, index) => InfographyItem(
|
|
||||||
id: state.contents[index].id,
|
|
||||||
onMarkChanged: (id, value, _) =>
|
|
||||||
state.changeMark(id, value),
|
|
||||||
image: state.contents[index].image,
|
|
||||||
category: state.contents[index].category,
|
|
||||||
createdAt: state.contents[index].createdAt,
|
|
||||||
title: state.contents[index].title,
|
|
||||||
tag: state.contents[index].tags,
|
|
||||||
marked: state.contents[index].marked,
|
|
||||||
),
|
),
|
||||||
|
placeholder
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
emptyState: EmptyResult(
|
||||||
|
onNewSearch: () => _focusNode.requestFocus(),
|
||||||
|
),
|
||||||
|
enableEmptyState:
|
||||||
|
context.watch<InfographyScreenState>().contents.isEmpty,
|
||||||
|
onRetry: context.read<InfographyScreenState>().init,
|
||||||
|
state: context.watch<InfographyScreenState>(),
|
||||||
|
builder: (context, state) => Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: state.contents.length,
|
||||||
|
itemBuilder: (context, index) => InfographyItem(
|
||||||
|
id: state.contents[index].id,
|
||||||
|
onMarkChanged: (id, value, _) => state.changeMark(id, value),
|
||||||
|
image: state.contents[index].image,
|
||||||
|
category: state.contents[index].category,
|
||||||
|
createdAt: state.contents[index].createdAt,
|
||||||
|
title: state.contents[index].title,
|
||||||
|
tag: state.contents[index].tags,
|
||||||
|
marked: state.contents[index].marked,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
},
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Widget get placeholder => const DidvanCard(
|
||||||
|
margin: EdgeInsets.all(8),
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
height: 16,
|
||||||
|
width: 240,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 12),
|
||||||
|
ShimmerPlaceholder(height: 200, width: 400),
|
||||||
|
SizedBox(height: 12),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
height: 32,
|
||||||
|
width: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
DidvanDivider(
|
||||||
|
verticalPadding: 12,
|
||||||
|
),
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
height: 16,
|
||||||
|
width: double.infinity,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import 'package:didvan/views/home/new_statistic/widgets/statistic_cat.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/card.dart';
|
import 'package:didvan/views/widgets/didvan/card.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/divider.dart';
|
import 'package:didvan/views/widgets/didvan/divider.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
|
import 'package:didvan/views/widgets/shimmer_placeholder.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';
|
||||||
|
|
@ -37,193 +38,272 @@ class _NewStatisticState extends State<NewStatistic> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return StateHandler<NewStatisticState>(
|
return Padding(
|
||||||
onRetry: context.read<NewStatisticState>().init,
|
padding: const EdgeInsets.all(8.0),
|
||||||
state: context.watch<NewStatisticState>(),
|
child: SingleChildScrollView(
|
||||||
builder: (context, state) => Padding(
|
child: Column(
|
||||||
padding: const EdgeInsets.all(8.0),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: SingleChildScrollView(
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
child: Column(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Center(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
child: Container(
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
Center(
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Container(
|
child: DidvanText(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
'دستهبندیهای کلان',
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.title,
|
||||||
child: DidvanText(
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
'دستهبندیهای کلان',
|
|
||||||
color: Theme.of(context).colorScheme.title,
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Padding(
|
),
|
||||||
padding: EdgeInsets.only(
|
const Padding(
|
||||||
left: 20,
|
padding: EdgeInsets.only(
|
||||||
right: 20,
|
left: 20,
|
||||||
top: 16,
|
right: 20,
|
||||||
),
|
top: 16,
|
||||||
child: NewStatisticCategories(),
|
|
||||||
),
|
),
|
||||||
const DidvanDivider(
|
child: NewStatisticCategories(),
|
||||||
verticalPadding: 4,
|
),
|
||||||
),
|
const DidvanDivider(
|
||||||
GestureDetector(
|
verticalPadding: 4,
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
),
|
||||||
Navigator.of(context)
|
StateHandler<NewStatisticState>(
|
||||||
.pushNamed(Routes.statGeneral, arguments: {
|
enableEmptyState: false,
|
||||||
"id": 7,
|
onRetry: context.read<NewStatisticState>().init,
|
||||||
"title": state.contents[0].header,
|
state: context.watch<NewStatisticState>(),
|
||||||
}).then((value) => state.getStatistic());
|
placeholder: Padding(
|
||||||
}),
|
padding: const EdgeInsets.only(top: 48.0),
|
||||||
child: StatHeader(
|
child: Column(
|
||||||
header: state.contents[0].header,
|
children: [
|
||||||
icon: DidvanIcons.star_circle_solid,
|
placeholder,
|
||||||
)),
|
SizedBox(
|
||||||
SizedBox(
|
height: 8,
|
||||||
height: 100,
|
),
|
||||||
width: 80,
|
placeholder,
|
||||||
child: ListView.builder(
|
SizedBox(
|
||||||
scrollDirection: Axis.horizontal,
|
height: 8,
|
||||||
shrinkWrap: true,
|
),
|
||||||
physics: const ScrollPhysics(),
|
placeholder,
|
||||||
itemCount: state.contents[0].contents.length,
|
SizedBox(
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
height: 8,
|
||||||
statistic: state.contents[0].contents[index],
|
),
|
||||||
),
|
placeholder,
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const DidvanDivider(
|
builder: (context, state) => Column(
|
||||||
verticalPadding: 4,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
),
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
onTap: () => Future.delayed(Duration.zero, () {
|
||||||
Navigator.of(context).pushNamed(Routes.statGeneral,
|
Navigator.of(context)
|
||||||
arguments: {
|
.pushNamed(Routes.statGeneral, arguments: {
|
||||||
"id": 1,
|
"id": 7,
|
||||||
"title": state.contents[1].header
|
"title": state.contents[0].header,
|
||||||
});
|
|
||||||
}).then((value) => _reset()),
|
|
||||||
child: StatHeader(
|
|
||||||
header: state.contents[1].header,
|
|
||||||
icon: DidvanIcons.currency_solid,
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
height: 100,
|
|
||||||
width: 80,
|
|
||||||
child: ListView.builder(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const ScrollPhysics(),
|
|
||||||
itemCount: state.contents[1].contents.length,
|
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
|
||||||
statistic: state.contents[1].contents[index]))),
|
|
||||||
const DidvanDivider(
|
|
||||||
verticalPadding: 4,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
|
||||||
Navigator.of(context).pushNamed(Routes.statGeneral,
|
|
||||||
arguments: {
|
|
||||||
"id": 2,
|
|
||||||
"title": state.contents[2].header
|
|
||||||
}).then((value) => _reset());
|
}).then((value) => _reset());
|
||||||
}),
|
}),
|
||||||
child: StatHeader(
|
child: StatHeader(
|
||||||
header: state.contents[2].header,
|
header: state.contents[0].header,
|
||||||
icon: DidvanIcons.bitcoin_solid,
|
icon: DidvanIcons.star_circle_solid,
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
width: 80,
|
width: 80,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const ScrollPhysics(),
|
physics: const ScrollPhysics(),
|
||||||
itemCount: state.contents[2].contents.length,
|
itemCount: state.contents[0].contents.length,
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
statistic: state.contents[2].contents[index]))),
|
statistic: state.contents[0].contents[index],
|
||||||
const DidvanDivider(
|
),
|
||||||
verticalPadding: 4,
|
),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
const DidvanDivider(
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
verticalPadding: 4,
|
||||||
Navigator.of(context).pushNamed(Routes.statGeneral,
|
),
|
||||||
arguments: {"id": 3, "title": state.contents[3].header});
|
GestureDetector(
|
||||||
}).then((value) => _reset()),
|
onTap: () => Future.delayed(Duration.zero, () {
|
||||||
child: StatHeader(
|
Navigator.of(context).pushNamed(Routes.statGeneral,
|
||||||
header: state.contents[3].header,
|
arguments: {
|
||||||
icon: DidvanIcons.commodity_solid,
|
"id": 1,
|
||||||
),
|
"title": state.contents[1].header
|
||||||
),
|
});
|
||||||
SizedBox(
|
}).then((value) => _reset()),
|
||||||
height: 100,
|
child: StatHeader(
|
||||||
width: 80,
|
header: state.contents[1].header,
|
||||||
child: ListView.builder(
|
icon: DidvanIcons.currency_solid,
|
||||||
scrollDirection: Axis.horizontal,
|
)),
|
||||||
shrinkWrap: true,
|
SizedBox(
|
||||||
physics: const ScrollPhysics(),
|
height: 100,
|
||||||
itemCount: state.contents[3].contents.length,
|
width: 80,
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
child: ListView.builder(
|
||||||
statistic: state.contents[3].contents[index]))),
|
scrollDirection: Axis.horizontal,
|
||||||
const DidvanDivider(
|
shrinkWrap: true,
|
||||||
verticalPadding: 4,
|
physics: const ScrollPhysics(),
|
||||||
),
|
itemCount: state.contents[1].contents.length,
|
||||||
GestureDetector(
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
statistic: state.contents[1].contents[index]))),
|
||||||
Navigator.of(context).pushNamed(Routes.statGeneral,
|
const DidvanDivider(
|
||||||
arguments: {
|
verticalPadding: 4,
|
||||||
"id": 4,
|
),
|
||||||
"title": state.contents[4].header
|
GestureDetector(
|
||||||
|
onTap: () => Future.delayed(Duration.zero, () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.statGeneral,
|
||||||
|
arguments: {
|
||||||
|
"id": 2,
|
||||||
|
"title": state.contents[2].header
|
||||||
|
}).then((value) => _reset());
|
||||||
|
}),
|
||||||
|
child: StatHeader(
|
||||||
|
header: state.contents[2].header,
|
||||||
|
icon: DidvanIcons.bitcoin_solid,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
width: 80,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const ScrollPhysics(),
|
||||||
|
itemCount: state.contents[2].contents.length,
|
||||||
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
|
statistic: state.contents[2].contents[index]))),
|
||||||
|
const DidvanDivider(
|
||||||
|
verticalPadding: 4,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
width: 80,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const ScrollPhysics(),
|
||||||
|
itemCount: state.contents[3].contents.length,
|
||||||
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
|
statistic: state.contents[3].contents[index]))),
|
||||||
|
const DidvanDivider(
|
||||||
|
verticalPadding: 4,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => Future.delayed(Duration.zero, () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.statGeneral,
|
||||||
|
arguments: {
|
||||||
|
"id": 4,
|
||||||
|
"title": state.contents[4].header
|
||||||
|
}).then((value) => _reset());
|
||||||
|
}),
|
||||||
|
child: StatHeader(
|
||||||
|
header: state.contents[4].header,
|
||||||
|
icon: DidvanIcons.industry_solid,
|
||||||
|
)),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
width: 80,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const ScrollPhysics(),
|
||||||
|
itemCount: state.contents[4].contents.length,
|
||||||
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
|
statistic: state.contents[4].contents[index]))),
|
||||||
|
const DidvanDivider(
|
||||||
|
verticalPadding: 4,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => Future.delayed(Duration.zero, () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushNamed(Routes.statGeneral, arguments: {
|
||||||
|
"id": 5,
|
||||||
|
"title": state.contents[5].header,
|
||||||
}).then((value) => _reset());
|
}).then((value) => _reset());
|
||||||
}),
|
}),
|
||||||
child: StatHeader(
|
child: StatHeader(
|
||||||
header: state.contents[4].header,
|
header: state.contents[5].header,
|
||||||
icon: DidvanIcons.industry_solid,
|
icon: DidvanIcons.metal_solid,
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
width: 80,
|
width: 80,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const ScrollPhysics(),
|
physics: const ScrollPhysics(),
|
||||||
itemCount: state.contents[4].contents.length,
|
itemCount: state.contents[5].contents.length,
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
itemBuilder: (context, index) => StatMainCard(
|
||||||
statistic: state.contents[4].contents[index]))),
|
id: 5,
|
||||||
const DidvanDivider(
|
statistic: state.contents[5].contents[index]))),
|
||||||
verticalPadding: 4,
|
],
|
||||||
),
|
),
|
||||||
GestureDetector(
|
),
|
||||||
onTap: () => Future.delayed(Duration.zero, () {
|
],
|
||||||
Navigator.of(context)
|
|
||||||
.pushNamed(Routes.statGeneral, arguments: {
|
|
||||||
"id": 5,
|
|
||||||
"title": state.contents[5].header,
|
|
||||||
}).then((value) => _reset());
|
|
||||||
}),
|
|
||||||
child: StatHeader(
|
|
||||||
header: state.contents[5].header,
|
|
||||||
icon: DidvanIcons.metal_solid,
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
height: 100,
|
|
||||||
width: 80,
|
|
||||||
child: ListView.builder(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const ScrollPhysics(),
|
|
||||||
itemCount: state.contents[5].contents.length,
|
|
||||||
itemBuilder: (context, index) => StatMainCard(
|
|
||||||
id: 5,
|
|
||||||
statistic: state.contents[5].contents[index]))),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Widget get placeholder => const Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
height: 16,
|
||||||
|
width: 100,
|
||||||
|
),
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
height: 16,
|
||||||
|
width: 50,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
DidvanCard(
|
||||||
|
child: ShimmerPlaceholder(
|
||||||
|
height: 80,
|
||||||
|
width: 60,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DidvanCard(
|
||||||
|
child: ShimmerPlaceholder(
|
||||||
|
height: 80,
|
||||||
|
width: 60,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DidvanCard(
|
||||||
|
child: ShimmerPlaceholder(
|
||||||
|
height: 80,
|
||||||
|
width: 60,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DidvanCard(
|
||||||
|
child: ShimmerPlaceholder(
|
||||||
|
height: 80,
|
||||||
|
width: 60,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class StatMainCard extends StatelessWidget {
|
class StatMainCard extends StatelessWidget {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:didvan/views/home/new_statistic/statistics_details/stat_cats_general_state.dart';
|
import 'package:didvan/views/home/new_statistic/statistics_details/stat_cats_general_state.dart';
|
||||||
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/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/shimmer_placeholder.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/empty_result.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';
|
||||||
|
|
@ -74,62 +76,127 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return StateHandler<StatGeneralScreenState>(
|
return Scaffold(
|
||||||
onRetry: context.read<StatGeneralScreenState>().init,
|
appBar: AppBar(
|
||||||
state: context.watch<StatGeneralScreenState>(),
|
elevation: 0.0,
|
||||||
emptyState: EmptyResult(
|
scrolledUnderElevation: 0.0,
|
||||||
onNewSearch: () => _focusNode.requestFocus(),
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
title: DidvanText(
|
||||||
|
widget.pageData['title'],
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
enableEmptyState:
|
body: Column(
|
||||||
context.watch<StatGeneralScreenState>().contents.isEmpty,
|
children: [
|
||||||
builder: (context, state) {
|
Container(
|
||||||
return Scaffold(
|
height: 80,
|
||||||
appBar: AppBar(
|
color: Theme.of(context).colorScheme.surface,
|
||||||
elevation: 0.0,
|
padding:
|
||||||
scrolledUnderElevation: 0.0,
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
child: SearchField(
|
||||||
title: DidvanText(
|
title: widget.pageData['title'],
|
||||||
widget.pageData['title'],
|
onChanged: _onChanged,
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
focusNode: _focusNode,
|
||||||
fontSize: 20,
|
value: context.watch<StatGeneralScreenState>().lastSearch,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Column(
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.only(left: 8.0, top: 12, bottom: 8),
|
||||||
Container(
|
child: Align(
|
||||||
height: 80,
|
alignment: Alignment.centerLeft,
|
||||||
color: Theme.of(context).colorScheme.surface,
|
child: DidvanText(formattedDate.toPersianDate())),
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16.0, vertical: 16.0),
|
|
||||||
child: SearchField(
|
|
||||||
title: widget.pageData['title'],
|
|
||||||
onChanged: _onChanged,
|
|
||||||
focusNode: _focusNode,
|
|
||||||
value: state.lastSearch,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0, top: 12, bottom: 8),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: DidvanText(formattedDate.toPersianDate())),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ListView.builder(
|
|
||||||
controller: _scrollController,
|
|
||||||
physics: const ClampingScrollPhysics(),
|
|
||||||
itemCount: state.contents.length,
|
|
||||||
itemBuilder: (context, index) => NewStatisticOverviewCard(
|
|
||||||
statistic: state.contents[index],
|
|
||||||
onMarkChanged: state.changeMark,
|
|
||||||
isMarked: state.contents[index].marked,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
StateHandler<StatGeneralScreenState>(
|
||||||
},
|
onRetry: context.read<StatGeneralScreenState>().init,
|
||||||
|
state: context.watch<StatGeneralScreenState>(),
|
||||||
|
emptyState: EmptyResult(
|
||||||
|
onNewSearch: () => _focusNode.requestFocus(),
|
||||||
|
),
|
||||||
|
enableEmptyState:
|
||||||
|
context.watch<StatGeneralScreenState>().contents.isEmpty,
|
||||||
|
placeholder: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
placeHolder,
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
placeHolder,
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
builder: (context, state) => Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
physics: const ClampingScrollPhysics(),
|
||||||
|
itemCount: state.contents.length,
|
||||||
|
itemBuilder: (context, index) => NewStatisticOverviewCard(
|
||||||
|
statistic: state.contents[index],
|
||||||
|
onMarkChanged: state.changeMark,
|
||||||
|
isMarked: state.contents[index].marked,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Widget get placeHolder => const Column(
|
||||||
|
children: [
|
||||||
|
DidvanCard(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(width: 80, height: 16),
|
||||||
|
Spacer(),
|
||||||
|
ShimmerPlaceholder(width: 50, height: 14),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
ShimmerPlaceholder(width: 50, height: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(width: 150, height: 12),
|
||||||
|
Spacer(),
|
||||||
|
ShimmerPlaceholder(width: 80, height: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
DidvanCard(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(width: 80, height: 16),
|
||||||
|
Spacer(),
|
||||||
|
ShimmerPlaceholder(width: 50, height: 14),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
ShimmerPlaceholder(width: 50, height: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(width: 150, height: 12),
|
||||||
|
Spacer(),
|
||||||
|
ShimmerPlaceholder(width: 80, height: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,11 @@ import 'package:didvan/views/home/new_statistic/stock/newStock_state.dart';
|
||||||
import 'package:didvan/views/home/new_statistic/stock/total_type3.dart';
|
import 'package:didvan/views/home/new_statistic/stock/total_type3.dart';
|
||||||
import 'package:didvan/views/home/new_statistic/stock/total_type4.dart';
|
import 'package:didvan/views/home/new_statistic/stock/total_type4.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/card.dart';
|
import 'package:didvan/views/widgets/didvan/card.dart';
|
||||||
|
import 'package:didvan/views/widgets/didvan/divider.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/shimmer_placeholder.dart';
|
import 'package:didvan/views/widgets/shimmer_placeholder.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';
|
||||||
|
|
@ -71,69 +73,78 @@ class _NewStockState extends State<NewStock> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return StateHandler<NewStockState>(
|
return Scaffold(
|
||||||
onRetry: context.read<NewStockState>().init,
|
appBar: AppBar(
|
||||||
state: context.watch<NewStockState>(),
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
builder: (context, state) => Scaffold(
|
elevation: 0.0,
|
||||||
appBar: AppBar(
|
scrolledUnderElevation: 0.0,
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
title: DidvanText(
|
||||||
elevation: 0.0,
|
"بازار سرمایه",
|
||||||
scrolledUnderElevation: 0.0,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
title: DidvanText(
|
fontSize: 20,
|
||||||
"بازار سرمایه",
|
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: Column(
|
),
|
||||||
children: [
|
body: Column(
|
||||||
Container(
|
children: [
|
||||||
height: 80,
|
Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
height: 80,
|
||||||
padding:
|
color: Theme.of(context).colorScheme.surface,
|
||||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
|
padding:
|
||||||
child: SearchField(
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
|
||||||
title: "بازار سرمایه",
|
child: SearchField(
|
||||||
value: state.lastSearch,
|
title: "بازار سرمایه",
|
||||||
onChanged: _onChanged,
|
value: context.watch<NewStockState>().lastSearch,
|
||||||
focusNode: _focusNode,
|
onChanged: _onChanged,
|
||||||
),
|
focusNode: _focusNode,
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: MediaQuery.of(context).size.height / 24,
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height / 24,
|
||||||
|
),
|
||||||
|
|
||||||
// Here, default theme colors are used for activeBgColor, activeFgColor, inactiveBgColor and inactiveFgColor
|
// Here, default theme colors are used for activeBgColor, activeFgColor, inactiveBgColor and inactiveFgColor
|
||||||
ToggleSwitch(
|
ToggleSwitch(
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
activeBgColor: [Theme.of(context).colorScheme.surface],
|
activeBgColor: [Theme.of(context).colorScheme.surface],
|
||||||
radiusStyle: true,
|
radiusStyle: true,
|
||||||
borderColor: [Colors.grey.shade600],
|
borderColor: [Colors.grey.shade600],
|
||||||
centerText: true,
|
centerText: true,
|
||||||
activeFgColor: Theme.of(context).colorScheme.title,
|
activeFgColor: Theme.of(context).colorScheme.title,
|
||||||
inactiveBgColor: Theme.of(context).colorScheme.secondCTA,
|
inactiveBgColor: Theme.of(context).colorScheme.secondCTA,
|
||||||
inactiveFgColor: Theme.of(context).colorScheme.disabledText,
|
inactiveFgColor: Theme.of(context).colorScheme.disabledText,
|
||||||
dividerColor: Colors.grey.shade500,
|
dividerColor: Colors.grey.shade500,
|
||||||
initialLabelIndex: value,
|
initialLabelIndex: value,
|
||||||
customTextStyles: const [TextStyle(fontWeight: FontWeight.w500)],
|
customTextStyles: const [TextStyle(fontWeight: FontWeight.w500)],
|
||||||
minWidth: 90,
|
minWidth: 90,
|
||||||
totalSwitches: 4,
|
totalSwitches: 4,
|
||||||
labels: const ['بورس', 'فرابورس', 'شاخص کل', 'گروه فولاد'],
|
labels: const ['بورس', 'فرابورس', 'شاخص کل', 'گروه فولاد'],
|
||||||
onToggle: (index) {
|
onToggle: (index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
value = index!;
|
value = index!;
|
||||||
state.type = index + 1;
|
context.read<NewStockState>().type = index + 1;
|
||||||
state.getStock(page: 1);
|
context.read<NewStockState>().getStock(page: 1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height / 48,
|
||||||
|
),
|
||||||
|
StateHandler<NewStockState>(
|
||||||
|
onRetry: context.read<NewStockState>().init,
|
||||||
|
state: context.watch<NewStockState>(),
|
||||||
|
emptyState: EmptyResult(
|
||||||
|
onNewSearch: () => _focusNode.requestFocus(),
|
||||||
),
|
),
|
||||||
SizedBox(
|
enableEmptyState: context.watch<NewStockState>().contents.isEmpty,
|
||||||
height: MediaQuery.of(context).size.height / 48,
|
placeholder: Column(
|
||||||
|
children: [
|
||||||
|
placeholder2,
|
||||||
|
placeholder2,
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
builder: (context, state) => Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
//physics: const ClampingScrollPhysics(),
|
|
||||||
itemCount: state.length,
|
itemCount: state.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (state.type == 1) {
|
if (state.type == 1) {
|
||||||
|
|
@ -172,73 +183,94 @@ class _NewStockState extends State<NewStock> {
|
||||||
totalContent: state.totalContent_type3[index]);
|
totalContent: state.totalContent_type3[index]);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget get placeholder => const DidvanCard(
|
static Widget get placeholder2 => const DidvanCard(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
ShimmerPlaceholder(height: 18, width: 400),
|
||||||
children: [
|
DidvanDivider(
|
||||||
ShimmerPlaceholder(
|
verticalPadding: 8,
|
||||||
height: 40,
|
),
|
||||||
width: 40,
|
SizedBox(
|
||||||
),
|
height: 12,
|
||||||
Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
ShimmerPlaceholder(
|
children: [
|
||||||
height: 40,
|
ShimmerPlaceholder(
|
||||||
width: 40,
|
width: 100,
|
||||||
),
|
height: 18,
|
||||||
ShimmerPlaceholder(
|
),
|
||||||
height: 40,
|
SizedBox(
|
||||||
width: 40,
|
height: 12,
|
||||||
),
|
),
|
||||||
],
|
ShimmerPlaceholder(
|
||||||
),
|
width: 100,
|
||||||
Row(
|
height: 18,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
)
|
||||||
children: [
|
],
|
||||||
ShimmerPlaceholder(
|
),
|
||||||
height: 40,
|
SizedBox(
|
||||||
width: 40,
|
height: 12,
|
||||||
),
|
),
|
||||||
ShimmerPlaceholder(
|
Row(
|
||||||
height: 40,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
width: 40,
|
children: [
|
||||||
),
|
ShimmerPlaceholder(
|
||||||
],
|
width: 100,
|
||||||
),
|
height: 18,
|
||||||
Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
SizedBox(
|
||||||
children: [
|
height: 12,
|
||||||
ShimmerPlaceholder(
|
),
|
||||||
height: 40,
|
ShimmerPlaceholder(
|
||||||
width: 40,
|
width: 100,
|
||||||
),
|
height: 18,
|
||||||
ShimmerPlaceholder(
|
)
|
||||||
height: 40,
|
],
|
||||||
width: 40,
|
),
|
||||||
),
|
SizedBox(height: 12),
|
||||||
],
|
Row(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Row(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
ShimmerPlaceholder(
|
||||||
children: [
|
width: 100,
|
||||||
ShimmerPlaceholder(
|
height: 18,
|
||||||
height: 40,
|
),
|
||||||
width: 40,
|
SizedBox(
|
||||||
),
|
height: 12,
|
||||||
ShimmerPlaceholder(
|
),
|
||||||
height: 40,
|
ShimmerPlaceholder(
|
||||||
width: 40,
|
width: 100,
|
||||||
),
|
height: 18,
|
||||||
],
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
));
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
width: 100,
|
||||||
|
height: 18,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
ShimmerPlaceholder(
|
||||||
|
width: 100,
|
||||||
|
height: 18,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ class _NewStatisticOverviewCardState extends State<NewStatisticOverviewCard> {
|
||||||
'title': widget.statistic.title,
|
'title': widget.statistic.title,
|
||||||
'marked': widget.statistic.marked,
|
'marked': widget.statistic.marked,
|
||||||
}).then(
|
}).then(
|
||||||
(value) => state.getGeneralStatContent(page: 1),
|
(value) =>
|
||||||
|
state.getGeneralStatContent(page: 1, id: state.cat),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -91,6 +92,11 @@ class _NewStatisticOverviewCardState extends State<NewStatisticOverviewCard> {
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
if (_hasDiff)
|
if (_hasDiff)
|
||||||
DidvanText(
|
DidvanText(
|
||||||
'(${widget.statistic.data.d})',
|
'(${widget.statistic.data.d})',
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,14 @@ class StatMenuItemType {
|
||||||
{required this.label, required this.asset, required this.id});
|
{required this.label, required this.asset, required this.id});
|
||||||
}
|
}
|
||||||
|
|
||||||
class NewStatisticCategories extends StatelessWidget {
|
class NewStatisticCategories extends StatefulWidget {
|
||||||
const NewStatisticCategories({super.key});
|
const NewStatisticCategories({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<NewStatisticCategories> createState() => _NewStatisticCategoriesState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NewStatisticCategoriesState extends State<NewStatisticCategories> {
|
||||||
void _onTap(int id, String title, BuildContext context, BuildContext ctx) {
|
void _onTap(int id, String title, BuildContext context, BuildContext ctx) {
|
||||||
if (id != 6) {
|
if (id != 6) {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
|
|
@ -31,45 +36,42 @@ class NewStatisticCategories extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return StateHandler<NewStatisticState>(
|
final state = context.read<NewStatisticState>();
|
||||||
onRetry: () {},
|
return Wrap(
|
||||||
state: context.watch<NewStatisticState>(),
|
alignment: WrapAlignment.center,
|
||||||
builder: (context, state) => Wrap(
|
children: state.statCat
|
||||||
alignment: WrapAlignment.center,
|
.map(
|
||||||
children: state.statCat
|
(e) => GestureDetector(
|
||||||
.map(
|
onTap: () => _onTap(e.id, e.label, context, context),
|
||||||
(e) => GestureDetector(
|
child: SizedBox(
|
||||||
onTap: () => _onTap(e.id, e.label, context, context),
|
width: (MediaQuery.of(context).size.width - 56) / 3,
|
||||||
child: SizedBox(
|
child: Column(
|
||||||
width: (MediaQuery.of(context).size.width - 56) / 3,
|
children: [
|
||||||
child: Column(
|
Container(
|
||||||
children: [
|
width: 56,
|
||||||
Container(
|
height: 56,
|
||||||
width: 56,
|
padding: const EdgeInsets.all(8),
|
||||||
height: 56,
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.all(8),
|
color: Theme.of(context).colorScheme.surface,
|
||||||
decoration: BoxDecoration(
|
borderRadius: DesignConfig.lowBorderRadius,
|
||||||
color: Theme.of(context).colorScheme.surface,
|
boxShadow: DesignConfig.defaultShadow,
|
||||||
borderRadius: DesignConfig.lowBorderRadius,
|
|
||||||
boxShadow: DesignConfig.defaultShadow,
|
|
||||||
),
|
|
||||||
child: SvgPicture.asset(e.asset),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
child: SvgPicture.asset(e.asset),
|
||||||
DidvanText(
|
),
|
||||||
e.label,
|
const SizedBox(height: 4),
|
||||||
color: Theme.of(context).colorScheme.title,
|
DidvanText(
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
e.label,
|
||||||
fontWeight: FontWeight.w600,
|
color: Theme.of(context).colorScheme.title,
|
||||||
),
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
const SizedBox(height: 12),
|
fontWeight: FontWeight.w600,
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(height: 12),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.toList(),
|
)
|
||||||
),
|
.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue