Update dependencies and code changes for version 3.1.4

This commit is contained in:
Amir Hossein Mousavi 2024-05-07 08:24:30 +03:30
parent 19126bab9b
commit 562c006eb6
16 changed files with 782 additions and 162 deletions

View File

@ -26,7 +26,7 @@ class ExChangeContent {
final String title; final String title;
final int type; final int type;
final bool marked; final bool marked;
final Data data; final dynamic data;
ExChangeContent({ ExChangeContent({
required this.id, required this.id,
@ -44,7 +44,9 @@ class ExChangeContent {
title: json['title'], title: json['title'],
type: json['type'], type: json['type'],
marked: json['marked'], marked: json['marked'],
data: Data.fromJson(json['data']), data: json['data'] is List
? List<Data>.from(json['data'].map((data) => Data.fromJson(data)))
: Data.fromJson(json['data']),
); );
} }
@ -55,56 +57,78 @@ class ExChangeContent {
'title': title, 'title': title,
'type': type, 'type': type,
'marked': marked, 'marked': marked,
'data': data.toJson(), 'data': data is List
? data.map((dataItem) => dataItem.toJson()).toList()
: data.toJson(),
}; };
} }
} }
class Data { class Data {
final String p; final String? name;
final String y; final dynamic q;
final String h; final dynamic v;
final String l; final dynamic p;
final String d; final dynamic l;
final double dp; final dynamic y;
final String dt; final String? h;
final String t; final String? d;
final String tEn; final dynamic dp;
final String tG; final String? dt;
final String ts; final String? t;
final String? tEn;
final String? tG;
final String? ts;
final dynamic dl;
final String? dtp;
final String? dtl;
Data({ Data(
required this.p, {this.name,
required this.h, this.q,
required this.l, this.v,
required this.y, this.p,
required this.d, this.h,
required this.dp, this.l,
required this.dt, this.y,
required this.t, this.d,
required this.tEn, this.dp,
required this.tG, this.dt,
required this.ts, this.t,
}); this.tEn,
this.tG,
this.ts,
this.dl,
this.dtp,
this.dtl});
factory Data.fromJson(Map<String, dynamic> json) { factory Data.fromJson(Map<String, dynamic> json) {
return Data( return Data(
name: json['name'],
q: json['q'],
v: json['v'],
p: json['p'], p: json['p'],
y: json['y'], y: json['y'],
h: json['h'], h: json['h'],
l: json['l'], l: json['l'],
d: json['d'], d: json['d'],
dp: json['dp'].toDouble(), // Ensuring correct type dp: json['dp'],
dt: json['dt'], dt: json['dt'],
t: json['t'], t: json['t'],
tEn: json['t_en'], tEn: json['t_en'],
tG: json['t-g'], tG: json['t-g'],
ts: json['ts'], ts: json['ts'],
dl: json['dl'],
dtp: json['dtp'],
dtl: json['dtl'],
); );
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
'name': name,
'q': q,
'v': v,
'p': p, 'p': p,
'h': h, 'h': h,
'l': l, 'l': l,
@ -116,6 +140,9 @@ class Data {
't_en': tEn, 't_en': tEn,
't-g': tG, 't-g': tG,
'ts': ts, 'ts': ts,
'dl': dl,
'dtp': dtp,
'dtl': dtl,
}; };
} }
} }

View File

@ -1,14 +1,22 @@
class StatisticGeneralContent { class StatisticGeneralContent {
List<Content> contents; List<Content> contents;
int lastPage; final int lastPage;
final String source;
final String time;
StatisticGeneralContent({required this.contents, required this.lastPage}); StatisticGeneralContent(
{required this.contents,
required this.lastPage,
required this.source,
required this.time});
factory StatisticGeneralContent.fromJson(Map<String, dynamic> json) { factory StatisticGeneralContent.fromJson(Map<String, dynamic> json) {
return StatisticGeneralContent( return StatisticGeneralContent(
contents: contents:
List<Content>.from(json['contents'].map((x) => Content.fromJson(x))), List<Content>.from(json['contents'].map((x) => Content.fromJson(x))),
lastPage: json['lastPage'], lastPage: json['lastPage'],
source: json['source'],
time: json['time'],
); );
} }
@ -16,6 +24,8 @@ class StatisticGeneralContent {
return { return {
'contents': List<dynamic>.from(contents.map((x) => x.toJson())), 'contents': List<dynamic>.from(contents.map((x) => x.toJson())),
'lastPage': lastPage, 'lastPage': lastPage,
'source': source,
'time': time,
}; };
} }
} }

View File

@ -65,9 +65,12 @@ class Data {
final String b2; final String b2;
final String s1; final String s1;
final String s2; final String s2;
final String bc1;
final String bc2;
final String sc1;
final String sc2;
final String y; final String y;
final String p; final String p;
final String h; final String h;
final String l; final String l;
final String d; final String d;
@ -80,10 +83,14 @@ class Data {
Data({ Data({
required this.b1, required this.b1,
required this.y,
required this.b2, required this.b2,
required this.s1, required this.s1,
required this.s2, required this.s2,
required this.bc1,
required this.bc2,
required this.sc1,
required this.sc2,
required this.y,
required this.p, required this.p,
required this.h, required this.h,
required this.l, required this.l,
@ -113,6 +120,10 @@ class Data {
b2: json['b2'].toString(), b2: json['b2'].toString(),
s1: json['s1'].toString(), s1: json['s1'].toString(),
s2: json['s2'].toString(), s2: json['s2'].toString(),
bc1: json['bc1'].toString(),
bc2: json['bc2'].toString(),
sc1: json['sc1'].toString(),
sc2: json['sc2'].toString(),
); );
} }
@ -126,6 +137,10 @@ class Data {
"b2": b2, "b2": b2,
"s1": s1, "s1": s1,
"s2": s2, "s2": s2,
"bc1": bc1,
"bc2": bc2,
"sc1": sc1,
"sc2": sc2,
'd': d, 'd': d,
'dp': dp, 'dp': dp,
'dt': dt, 'dt': dt,

View File

@ -0,0 +1,122 @@
class TotalContentModel {
List<TotalContent> contents;
int lastPage;
TotalContentModel({required this.contents, required this.lastPage});
factory TotalContentModel.fromJson(Map<String, dynamic> json) {
return TotalContentModel(
contents: List<TotalContent>.from(
json['contents'].map((content) => TotalContent.fromJson(content))),
lastPage: json['lastPage'],
);
}
Map<String, dynamic> toJson() {
return {
'contents': List<dynamic>.from(contents.map((x) => x.toJson())),
'lastPage': lastPage,
};
}
}
class TotalContent {
final int id;
final String label;
final String title;
final int type;
final bool marked;
final List<DataItem> data;
TotalContent({
required this.id,
required this.label,
required this.title,
required this.type,
required this.marked,
required this.data,
});
factory TotalContent.fromJson(Map<String, dynamic> json) {
return TotalContent(
id: json['id'],
label: json['label'],
title: json['title'],
type: json['type'],
marked: json['marked'],
data: List<DataItem>.from(
json['data'].map((data) => DataItem.fromJson(data))),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'label': label,
'title': title,
'type': type,
'marked': marked,
'data': data.map((dataItem) => dataItem.toJson()).toList(),
};
}
}
class DataItem {
final String name;
final dynamic q;
final dynamic v;
final dynamic p;
final dynamic y;
final dynamic d;
final dynamic f;
final dynamic l;
final dynamic dl;
final dynamic dp;
final String? dt;
DataItem({
required this.name,
this.q,
this.v,
this.p,
this.y,
this.d,
this.f,
this.l,
this.dl,
this.dp,
this.dt,
});
factory DataItem.fromJson(Map<String, dynamic> json) {
return DataItem(
name: json['name'],
q: json['q'],
v: json['v'],
p: json['p'],
y: json['y'],
d: json['d'],
f: json['f'],
l: json['l'],
dl: json['dl'],
dp: json['dp'],
dt: json['dt'],
);
}
Map<String, dynamic> toJson() {
return {
'name': name,
'q': q,
'v': v,
'p': p,
'y': y,
'd': d,
'f': f,
'l': l,
'dl': dl,
'dp': dp,
'dt': dt,
};
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async'; 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/card.dart';
@ -9,7 +8,6 @@ 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';
import 'package:intl/intl.dart';
import 'package:persian_number_utility/persian_number_utility.dart'; import 'package:persian_number_utility/persian_number_utility.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -27,13 +25,9 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
int pageNumber = 1; int pageNumber = 1;
Timer? _timer; Timer? _timer;
final _focusNode = FocusNode(); final _focusNode = FocusNode();
var now = DateTime.now();
var formatter = DateFormat('yyyy-MM-dd');
String formattedDate = "";
@override @override
void initState() { void initState() {
formattedDate = formatter.format(now);
Future.delayed(Duration.zero, () { Future.delayed(Duration.zero, () {
final state = context.read<StatGeneralScreenState>(); final state = context.read<StatGeneralScreenState>();
state.getGeneralStatContent(page: 1, id: widget.pageData['id']); state.getGeneralStatContent(page: 1, id: widget.pageData['id']);
@ -76,6 +70,9 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var time = context.read<StatGeneralScreenState>().time;
var source = context.read<StatGeneralScreenState>().source;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0.0, elevation: 0.0,
@ -102,10 +99,19 @@ class _StatGeneralScreenState extends State<StatGeneralScreen> {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0, top: 12, bottom: 8), padding: const EdgeInsets.only(
child: Align( left: 8.0, top: 12.0, bottom: 8.0, right: 8.0),
alignment: Alignment.centerLeft, child: Row(
child: DidvanText(formattedDate.toPersianDate())), mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DidvanText(widget.pageData["id"] == 1 ? "منبع: $source" : ""),
if (time != null)
DidvanText(
DateTime.parse(time).toPersianDate(
showTime: true, changeDirectionShowTimw: false),
),
],
),
), ),
StateHandler<StatGeneralScreenState>( StateHandler<StatGeneralScreenState>(
onRetry: context.read<StatGeneralScreenState>().init, onRetry: context.read<StatGeneralScreenState>().init,

View File

@ -12,12 +12,11 @@ class StatGeneralScreenState extends CoreProvier {
List contents = []; List contents = [];
int page = 1; int page = 1;
int cat = 1; int cat = 1;
String search = "";
String lastSearch = "";
int lastPage = 1; int lastPage = 1;
String search = "";
String lastSearch = "";
String source = "";
String? time;
Future<void> changeMark(int id, bool value) async { Future<void> changeMark(int id, bool value) async {
UserProvider.changeStatisticMark(id, value); UserProvider.changeStatisticMark(id, value);
@ -41,8 +40,9 @@ class StatGeneralScreenState extends CoreProvier {
final content = StatisticGeneralContent.fromJson(service.result); final content = StatisticGeneralContent.fromJson(service.result);
contents.clear(); contents.clear();
contents.addAll(content.contents); contents.addAll(content.contents);
source = content.source;
time = content.time;
appState = AppState.idle; appState = AppState.idle;
return; return;
@ -51,8 +51,6 @@ class StatGeneralScreenState extends CoreProvier {
} }
void resetFilters(bool isInit) { void resetFilters(bool isInit) {
// search = '';
// lastSearch = '';
if (!isInit) { if (!isInit) {
getGeneralStatContent(page: 1, id: type); getGeneralStatContent(page: 1, id: type);
} }

View File

@ -97,47 +97,141 @@ class MetalCard extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
DidvanText("خرید حقیقی" " (میلیون سهم) ", SizedBox(
color: Theme.of(context).colorScheme.success), width: MediaQuery.of(context).size.width * 0.25,
DidvanText( child: Row(
metalContent.data.b1, children: [
color: Theme.of(context).colorScheme.success, DidvanText(
) "خرید",
], style: Theme.of(context).textTheme.bodyLarge,
), color: Theme.of(context).colorScheme.success,
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceBetween, DidvanText(
children: [ " / ",
DidvanText( style: Theme.of(context).textTheme.bodyLarge,
"فروش حقیقی" " (میلیون سهم) ", ),
color: Theme.of(context).colorScheme.error, DidvanText(
"فروش",
style: Theme.of(context).textTheme.bodyLarge,
color: Theme.of(context).colorScheme.error,
)
],
),
), ),
const Expanded(child: VerticalDivider()),
DidvanText( DidvanText(
metalContent.data.s1, "تعداد",
color: Theme.of(context).colorScheme.error, style: Theme.of(context).textTheme.bodyLarge,
) ),
], const Expanded(child: VerticalDivider()),
), SizedBox(
Row( width: MediaQuery.of(context).size.width * 0.25,
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: DidvanText(
children: [ "حجم",
DidvanText( style: Theme.of(context).textTheme.bodyLarge,
"خرید حقوقی" " (میلیون سهم) ", textAlign: TextAlign.end,
color: Theme.of(context).colorScheme.success, ),
), ),
DidvanText(
metalContent.data.b2,
color: Theme.of(context).colorScheme.success,
)
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
DidvanText("خرید حقیقی" " (میلیون سهم) ", SizedBox(
color: Theme.of(context).colorScheme.error), width: MediaQuery.of(context).size.width * 0.25,
DidvanText(metalContent.data.s2, child: DidvanText("حقیقی",
color: Theme.of(context).colorScheme.error) color: Theme.of(context).colorScheme.success),
),
const Expanded(child: VerticalDivider()),
DidvanText(
metalContent.data.bc1,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
metalContent.data.b1,
textAlign: TextAlign.start,
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText("حقیقی",
color: Theme.of(context).colorScheme.error),
),
const Expanded(child: VerticalDivider()),
DidvanText(
metalContent.data.sc1,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
metalContent.data.s1,
textAlign: TextAlign.start,
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText("حقوقی",
color: Theme.of(context).colorScheme.success),
),
const Expanded(child: VerticalDivider()),
DidvanText(
metalContent.data.bc2,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
metalContent.data.b2,
textAlign: TextAlign.start,
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText("حقوقی",
color: Theme.of(context).colorScheme.error),
),
const Expanded(child: VerticalDivider()),
DidvanText(
metalContent.data.sc2,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
metalContent.data.s2,
textAlign: TextAlign.start,
),
),
),
], ],
), ),
], ],

View File

@ -1,9 +1,7 @@
import 'package:didvan/models/enums.dart'; import 'package:didvan/models/enums.dart';
import 'package:didvan/models/new_statistic/exchange_model.dart'; import 'package:didvan/models/new_statistic/exchange_model.dart';
import 'package:didvan/models/new_statistic/metal_model.dart'; import 'package:didvan/models/new_statistic/metal_model.dart';
import 'package:didvan/models/new_statistic/total_type3_model.dart'; import 'package:didvan/models/new_statistic/total_model.dart';
import 'package:didvan/models/new_statistic/total_type4_model.dart';
import 'package:didvan/models/requests/newstats_general.dart'; import 'package:didvan/models/requests/newstats_general.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';
@ -18,8 +16,6 @@ class NewStockState extends CoreProvier {
String lastSearch = ""; String lastSearch = "";
int lastPage = 1; int lastPage = 1;
List contents = []; List contents = [];
List<TotalContent> totalContent_type4 = [];
List<TotalType3Content> totalContent_type3 = [];
int? length; int? length;
int? length_type3; int? length_type3;
int? length_type4; int? length_type4;
@ -30,8 +26,6 @@ class NewStockState extends CoreProvier {
lastSearch = search; lastSearch = search;
if (page == 1) { if (page == 1) {
contents.clear(); contents.clear();
totalContent_type4.clear();
totalContent_type3.clear();
appState = AppState.busy; appState = AppState.busy;
} }
@ -50,30 +44,21 @@ class NewStockState extends CoreProvier {
contents.addAll(content.contents); contents.addAll(content.contents);
length = contents.length; length = contents.length;
} }
if (type == 2) { if (type == 2) {
contents.clear(); contents.clear();
final content = ExchangeContentModel.fromJson(service.result); final content = ExchangeContentModel.fromJson(service.result);
contents.addAll(content.contents); contents.addAll(content.contents);
length = contents.length; length = contents.length;
} }
if (type == 3) { if (type == 3) {
contents.clear(); contents.clear();
totalContent_type4.clear(); final content = TotalContentModel.fromJson(service.result);
totalContent_type3.clear(); contents.addAll(content.contents);
length = contents.length;
final List list = service.result["contents"];
length = list.length;
for (var i = 0; i < list.length; i++) {
if (list[i]['type'] == 4) {
totalContent_type4.add(TotalContent.fromJson(list[i]));
}
if (list[i]['type'] == 3) {
totalContent_type3.add(TotalType3Content.fromJson(list[i]));
}
}
length_type3 = totalContent_type3.length;
length_type4 = totalContent_type4.length;
} }
if (type == 4) { if (type == 4) {
contents.clear(); contents.clear();
final content = MetalContentModel.fromJson(service.result); final content = MetalContentModel.fromJson(service.result);

View File

@ -6,6 +6,8 @@ import 'package:didvan/views/home/new_statistic/stock/metal.dart';
import 'package:didvan/views/home/new_statistic/stock/newStock_state.dart'; 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/home/new_statistic/stock/total_type6.dart';
import 'package:didvan/views/home/new_statistic/stock/trade.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';
@ -134,9 +136,7 @@ class _NewStockState extends State<NewStock> {
emptyState: EmptyResult( emptyState: EmptyResult(
onNewSearch: () => _focusNode.requestFocus(), onNewSearch: () => _focusNode.requestFocus(),
), ),
enableEmptyState: context.read<NewStockState>().contents.isEmpty && enableEmptyState: context.read<NewStockState>().contents.isEmpty,
context.read<NewStockState>().totalContent_type3.isEmpty &&
context.read<NewStockState>().totalContent_type4.isEmpty,
topPadding: 16, topPadding: 16,
placeholder: Column( placeholder: Column(
children: [ children: [
@ -153,35 +153,45 @@ class _NewStockState extends State<NewStock> {
itemCount: state.length, itemCount: state.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (state.type == 1) { if (state.type == 1) {
return ExchangeCard( return Column(
exchangeContent: state.contents[index], children: [
if (state.contents[index].type == 2)
ExchangeCard(
exchangeContent: state.contents[index],
),
if (state.contents[index].type == 4)
Trade(totalContent: state.contents[index])
],
); );
} }
if (state.type == 2) { if (state.type == 2) {
return ExchangeCard( return Column(
exchangeContent: state.contents[index], children: [
if (state.contents[index].type == 2)
ExchangeCard(
exchangeContent: state.contents[index],
),
if (state.contents[index].type == 4)
Trade(totalContent: state.contents[index])
],
); );
} }
if (state.type == 3) { if (state.type == 3) {
return Column( return Column(
children: [ children: [
if (index <= (state.length_type3! - 1)) if (state.contents[index].type == 3)
TotalType3Card( TotalType3Card(totalContent: state.contents[index]),
totalContent: state.totalContent_type3[index]), if (state.contents[index].type == 4)
if (index <= (state.length_type4! - 1)) TotalType4Card(totalContent: state.contents[index]),
TotalType4Card( if (state.contents[index].type == 6)
totalContent: state.totalContent_type4[index]) TotalType6Card(totalContent: state.contents[index])
], ],
); );
} }
if (state.type == 4) { return MetalCard(metalContent: state.contents[index]);
return MetalCard(metalContent: state.contents[index]);
}
return TotalType3Card(
totalContent: state.totalContent_type3[index]);
}), }),
), ),
), ),

View File

@ -1,13 +1,13 @@
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/total_type3_model.dart'; import 'package:didvan/models/new_statistic/total_model.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:flutter/material.dart'; import 'package:flutter/material.dart';
class TotalType3Card extends StatelessWidget { class TotalType3Card extends StatelessWidget {
final TotalType3Content totalContent; final TotalContent totalContent;
const TotalType3Card({super.key, required this.totalContent}); const TotalType3Card({super.key, required this.totalContent});
@override @override
@ -65,7 +65,7 @@ class TotalType3Card extends StatelessWidget {
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.25, width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText( child: DidvanText(
"تاثیر", "%",
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
@ -109,7 +109,7 @@ class TotalType3Card extends StatelessWidget {
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),
DidvanText("${e.dp}%", DidvanText("${e.dp}",
style: Theme.of(context).textTheme.bodySmall, style: Theme.of(context).textTheme.bodySmall,
color: totalContent.id == 36 color: totalContent.id == 36
? Theme.of(context).colorScheme.success ? Theme.of(context).colorScheme.success

View File

@ -1,4 +1,5 @@
import 'package:didvan/models/new_statistic/total_type4_model.dart'; import 'package:didvan/config/theme_data.dart';
import 'package:didvan/models/new_statistic/total_model.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';
@ -18,11 +19,11 @@ class TotalType4Card extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.4), color: Colors.grey.withOpacity(0.4),
borderRadius: const BorderRadius.all(Radius.circular(4))), borderRadius: const BorderRadius.all(Radius.circular(4))),
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
DidvanText( DidvanText(
@ -31,7 +32,9 @@ class TotalType4Card extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
))), ),
),
),
const DidvanDivider( const DidvanDivider(
verticalPadding: 8, verticalPadding: 8,
), ),
@ -39,20 +42,24 @@ class TotalType4Card extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.25, width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText( child: DidvanText(
"نماد", "نماد",
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
), ),
), ),
DidvanText( DidvanText(
"حجم ", [34, 35].contains(totalContent.id)
? "قدرت خریداران"
: totalContent.id == 50
? "ضریب حجم"
: "پایانی (%)",
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.25, width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText( child: DidvanText(
"ارزش", "آخرین (%)",
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
@ -66,26 +73,80 @@ class TotalType4Card extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.25, width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText( child: DidvanText(
e.name.toString(), e.name.toString(),
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
style: Theme.of(context).textTheme.bodySmall, style: Theme.of(context).textTheme.bodySmall,
), ),
), ),
DidvanText( Directionality(
e.v.toString(), textDirection: TextDirection.ltr,
style: Theme.of(context).textTheme.bodySmall, child: Row(
children: [34, 35, 50].contains(totalContent.id)
? [
DidvanText(
e.f,
style: Theme.of(context)
.textTheme
.bodySmall,
)
]
: [
DidvanText(
"(${(double.parse(e.dp)).abs()})",
style: Theme.of(context)
.textTheme
.bodySmall,
color: double.parse(e.dp) > 0
? Theme.of(context)
.colorScheme
.success
: Theme.of(context)
.colorScheme
.error),
const DidvanText(" "),
DidvanText(
e.p.toString(),
style: Theme.of(context)
.textTheme
.bodySmall,
),
],
),
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.25, width: MediaQuery.of(context).size.width * 0.3,
child: Directionality( child: Row(
textDirection: TextDirection.ltr, mainAxisAlignment: MainAxisAlignment.end,
child: DidvanText( children: [
style: Theme.of(context).textTheme.bodySmall, Directionality(
e.p.toString(), textDirection: TextDirection.ltr,
textAlign: TextAlign.start, child: Row(
), children: [
DidvanText(
"(${double.parse(e.dl).abs()})",
style: Theme.of(context)
.textTheme
.bodySmall,
color: double.parse(e.dl) > 0
? Theme.of(context)
.colorScheme
.success
: Theme.of(context)
.colorScheme
.error),
const DidvanText(" "),
DidvanText(
e.l,
style: Theme.of(context)
.textTheme
.bodySmall,
),
],
),
),
],
), ),
) )
], ],

View File

@ -0,0 +1,123 @@
import 'package:didvan/config/theme_data.dart';
import 'package:didvan/constants/app_icons.dart';
import 'package:didvan/models/new_statistic/total_model.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:flutter/material.dart';
class TotalType6Card extends StatelessWidget {
final TotalContent totalContent;
const TotalType6Card({super.key, required this.totalContent});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: DidvanCard(
padding: const EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.4),
borderRadius: const BorderRadius.all(Radius.circular(4))),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DidvanText(
totalContent.title,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
],
),
),
),
const DidvanDivider(
verticalPadding: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText(
"نماد",
style: Theme.of(context).textTheme.bodyLarge,
),
),
const Expanded(child: VerticalDivider()),
DidvanText(
"قیمت پایانی",
style: Theme.of(context).textTheme.bodyLarge,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText(
"تاثیر",
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end,
),
),
],
),
Column(
children: totalContent.data
.map(
(item) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText(
item.name.toString(),
overflow: TextOverflow.fade,
style: Theme.of(context).textTheme.bodySmall,
),
),
SizedBox(
width: 52,
child: Center(
child: DidvanText(
overflow: TextOverflow.fade,
item.p.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
),
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
item.dt == "high"
? DidvanIcons.angle_up_regular
: DidvanIcons.angle_down_regular,
size: 14,
color: item.dt == "high"
? Theme.of(context).colorScheme.success
: Theme.of(context).colorScheme.error),
DidvanText("${item.d}",
style: Theme.of(context).textTheme.bodySmall,
color: item.dt == "high"
? Theme.of(context).colorScheme.success
: Theme.of(context).colorScheme.error),
],
),
)
],
),
)
.toList(),
)
],
),
),
);
}
}

View File

@ -0,0 +1,137 @@
import 'package:didvan/config/theme_data.dart';
import 'package:didvan/models/new_statistic/exchange_model.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:flutter/material.dart';
class Trade extends StatelessWidget {
final ExChangeContent totalContent;
const Trade({super.key, required this.totalContent});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: DidvanCard(
padding: const EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.4),
borderRadius: const BorderRadius.all(Radius.circular(4))),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DidvanText(
totalContent.title,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
],
))),
const DidvanDivider(
verticalPadding: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText(
"نماد",
style: Theme.of(context).textTheme.bodyLarge,
),
),
DidvanText(
"پایانی (%)",
style: Theme.of(context).textTheme.bodyLarge,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText(
"آخرین (%)",
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end,
),
),
],
),
Column(
children: totalContent.data
.map<Widget>((e) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText(
e.name.toString(),
overflow: TextOverflow.fade,
style: Theme.of(context).textTheme.bodySmall,
),
),
Directionality(
textDirection: TextDirection.ltr,
child: Row(
children: [
DidvanText(e.dp,
style:
Theme.of(context).textTheme.bodySmall,
color: e.dtp == "high"
? Theme.of(context).colorScheme.success
: Theme.of(context).colorScheme.error),
const DidvanText(" "),
DidvanText(
e.p.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
],
),
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: Row(
children: [
DidvanText(e.dl,
style: Theme.of(context)
.textTheme
.bodySmall,
color: e.dtl == "high"
? Theme.of(context)
.colorScheme
.success
: Theme.of(context)
.colorScheme
.error),
const DidvanText(" "),
DidvanText(
e.l.toString(),
style: Theme.of(context)
.textTheme
.bodySmall,
),
],
),
)
],
),
)
],
))
.toList(),
)
],
),
),
);
}
}

View File

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

View File

@ -582,6 +582,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.7" version: "0.6.7"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
url: "https://pub.dev"
source: hosted
version: "2.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@ -602,26 +626,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.16" version: "0.12.16+1"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.0" version: "0.8.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.0" version: "1.11.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -650,10 +674,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.3" version: "1.9.0"
path_parsing: path_parsing:
dependency: transitive dependency: transitive
description: description:
@ -1115,6 +1139,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.3" version: "0.3.3"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "13.0.0"
wakelock: wakelock:
dependency: transitive dependency: transitive
description: description:
@ -1159,10 +1191,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.0" version: "0.4.2"
webview_flutter: webview_flutter:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.1.0+3100 version: 3.1.4+3140
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: ">=2.17.0 <3.0.0"