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

View File

@ -1,14 +1,22 @@
class StatisticGeneralContent {
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) {
return StatisticGeneralContent(
contents:
List<Content>.from(json['contents'].map((x) => Content.fromJson(x))),
lastPage: json['lastPage'],
source: json['source'],
time: json['time'],
);
}
@ -16,6 +24,8 @@ class StatisticGeneralContent {
return {
'contents': List<dynamic>.from(contents.map((x) => x.toJson())),
'lastPage': lastPage,
'source': source,
'time': time,
};
}
}

View File

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

View File

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

View File

@ -97,47 +97,141 @@ class MetalCard extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DidvanText("خرید حقیقی" " (میلیون سهم) ",
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Row(
children: [
DidvanText(
"خرید",
style: Theme.of(context).textTheme.bodyLarge,
color: Theme.of(context).colorScheme.success,
),
DidvanText(
" / ",
style: Theme.of(context).textTheme.bodyLarge,
),
DidvanText(
"فروش",
style: Theme.of(context).textTheme.bodyLarge,
color: Theme.of(context).colorScheme.error,
)
],
),
),
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,
),
),
],
),
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.bc1,
),
const Expanded(child: VerticalDivider()),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
metalContent.data.b1,
color: Theme.of(context).colorScheme.success,
)
textAlign: TextAlign.start,
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DidvanText(
"فروش حقیقی" " (میلیون سهم) ",
color: Theme.of(context).colorScheme.error,
),
DidvanText(
metalContent.data.s1,
color: Theme.of(context).colorScheme.error,
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DidvanText(
"خرید حقوقی" " (میلیون سهم) ",
color: Theme.of(context).colorScheme.success,
),
DidvanText(
metalContent.data.b2,
color: Theme.of(context).colorScheme.success,
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DidvanText("خرید حقیقی" " (میلیون سهم) ",
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText("حقیقی",
color: Theme.of(context).colorScheme.error),
DidvanText(metalContent.data.s2,
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/new_statistic/exchange_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_type4_model.dart';
import 'package:didvan/models/new_statistic/total_model.dart';
import 'package:didvan/models/requests/newstats_general.dart';
import 'package:didvan/providers/core.dart';
import 'package:didvan/services/network/request.dart';
@ -18,8 +16,6 @@ class NewStockState extends CoreProvier {
String lastSearch = "";
int lastPage = 1;
List contents = [];
List<TotalContent> totalContent_type4 = [];
List<TotalType3Content> totalContent_type3 = [];
int? length;
int? length_type3;
int? length_type4;
@ -30,8 +26,6 @@ class NewStockState extends CoreProvier {
lastSearch = search;
if (page == 1) {
contents.clear();
totalContent_type4.clear();
totalContent_type3.clear();
appState = AppState.busy;
}
@ -50,30 +44,21 @@ class NewStockState extends CoreProvier {
contents.addAll(content.contents);
length = contents.length;
}
if (type == 2) {
contents.clear();
final content = ExchangeContentModel.fromJson(service.result);
contents.addAll(content.contents);
length = contents.length;
}
if (type == 3) {
contents.clear();
totalContent_type4.clear();
totalContent_type3.clear();
final content = TotalContentModel.fromJson(service.result);
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) {
contents.clear();
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/total_type3.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/divider.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
@ -134,9 +136,7 @@ class _NewStockState extends State<NewStock> {
emptyState: EmptyResult(
onNewSearch: () => _focusNode.requestFocus(),
),
enableEmptyState: context.read<NewStockState>().contents.isEmpty &&
context.read<NewStockState>().totalContent_type3.isEmpty &&
context.read<NewStockState>().totalContent_type4.isEmpty,
enableEmptyState: context.read<NewStockState>().contents.isEmpty,
topPadding: 16,
placeholder: Column(
children: [
@ -153,35 +153,45 @@ class _NewStockState extends State<NewStock> {
itemCount: state.length,
itemBuilder: (context, index) {
if (state.type == 1) {
return ExchangeCard(
return Column(
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) {
return ExchangeCard(
return Column(
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) {
return Column(
children: [
if (index <= (state.length_type3! - 1))
TotalType3Card(
totalContent: state.totalContent_type3[index]),
if (index <= (state.length_type4! - 1))
TotalType4Card(
totalContent: state.totalContent_type4[index])
if (state.contents[index].type == 3)
TotalType3Card(totalContent: state.contents[index]),
if (state.contents[index].type == 4)
TotalType4Card(totalContent: state.contents[index]),
if (state.contents[index].type == 6)
TotalType6Card(totalContent: state.contents[index])
],
);
}
if (state.type == 4) {
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/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/divider.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/material.dart';
class TotalType3Card extends StatelessWidget {
final TotalType3Content totalContent;
final TotalContent totalContent;
const TotalType3Card({super.key, required this.totalContent});
@override
@ -65,7 +65,7 @@ class TotalType3Card extends StatelessWidget {
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
child: DidvanText(
"تاثیر",
"%",
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end,
),
@ -109,7 +109,7 @@ class TotalType3Card extends StatelessWidget {
color: totalContent.id == 36
? Theme.of(context).colorScheme.success
: Theme.of(context).colorScheme.error),
DidvanText("${e.dp}%",
DidvanText("${e.dp}",
style: Theme.of(context).textTheme.bodySmall,
color: totalContent.id == 36
? 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/divider.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
@ -31,7 +32,9 @@ class TotalType4Card extends StatelessWidget {
textAlign: TextAlign.center,
),
],
))),
),
),
),
const DidvanDivider(
verticalPadding: 8,
),
@ -39,20 +42,24 @@ class TotalType4Card extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText(
"نماد",
style: Theme.of(context).textTheme.bodyLarge,
),
),
DidvanText(
"حجم ",
[34, 35].contains(totalContent.id)
? "قدرت خریداران"
: totalContent.id == 50
? "ضریب حجم"
: "پایانی (%)",
style: Theme.of(context).textTheme.bodyLarge,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
width: MediaQuery.of(context).size.width * 0.3,
child: DidvanText(
"ارزش",
"آخرین (%)",
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.end,
),
@ -66,26 +73,80 @@ class TotalType4Card extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.25,
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: [34, 35, 50].contains(totalContent.id)
? [
DidvanText(
e.v.toString(),
style: Theme.of(context).textTheme.bodySmall,
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(
width: MediaQuery.of(context).size.width * 0.25,
child: Directionality(
width: MediaQuery.of(context).size.width * 0.3,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: DidvanText(
style: Theme.of(context).textTheme.bodySmall,
e.p.toString(),
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),
DidvanText(
'نسخه نرم‌افزار: 3.0.0',
'نسخه نرم‌افزار: 3.1.1',
style: Theme.of(context).textTheme.bodySmall,
),
],

View File

@ -582,6 +582,30 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
@ -602,26 +626,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.11.0"
mime:
dependency: transitive
description:
@ -650,10 +674,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_parsing:
dependency: transitive
description:
@ -1115,6 +1139,14 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
@ -1159,10 +1191,10 @@ packages:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.4.2"
webview_flutter:
dependency: "direct main"
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.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.1.0+3100
version: 3.1.4+3140
environment:
sdk: ">=2.17.0 <3.0.0"