fix: more detailing product view

This commit is contained in:
2024-02-07 18:34:46 +07:00
parent 59e6e82d13
commit 7a1cddee03
3 changed files with 24 additions and 31 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:math';
import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
@@ -5,11 +7,12 @@ import 'package:cims_apps/core/utils/size_config.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class CategoryPortofolio {
class InvestmentType {
String name;
int value;
int mutualFunds;
CategoryPortofolio(this.value, this.name);
InvestmentType(this.value, this.name, this.mutualFunds);
}
class PortofolioView extends StatefulWidget {
@@ -36,11 +39,11 @@ class _PortofolioViewState extends State<PortofolioView> {
bool seePortofolioValue = false;
int touchedIndex = -1;
List<CategoryPortofolio> listCategoryPortofolio = [
CategoryPortofolio(20, 'Money Market'),
CategoryPortofolio(15, 'Shares'),
CategoryPortofolio(8, 'Bonds'),
CategoryPortofolio(50, 'Sharia'),
List<InvestmentType> listInvestmentType = [
InvestmentType(20, 'Money Market', 2),
InvestmentType(15, 'Shares', 5),
InvestmentType(8, 'Bonds', 3),
InvestmentType(50, 'Sharia', 4),
];
List<String> assetsImage = [
@@ -91,7 +94,7 @@ class _PortofolioViewState extends State<PortofolioView> {
topRight: Radius.circular(24)),
),
child: ListView(
padding: const EdgeInsets.symmetric(vertical: 0),
padding: const EdgeInsets.symmetric(vertical: 16),
children: [
Stack(alignment: Alignment.center, children: [
AspectRatio(
@@ -117,20 +120,20 @@ class _PortofolioViewState extends State<PortofolioView> {
show: true,
),
sectionsSpace: 20,
centerSpaceRadius: 100,
centerSpaceRadius: 110,
sections: sectionsDataPortofolio())),
),
const Column(
Column(
children: [
Text('Total Mutual Fund',
const Text('Total Mutual Fund',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
color: ColorPalette.slate400
),
),
Text('10',
style: TextStyle(
Text(listInvestmentType.map((e) => e.mutualFunds).reduce((value, element) => value + element).toString(),
style: const TextStyle(
fontSize: 44,
fontWeight: FontWeight.w700
)
@@ -147,9 +150,6 @@ class _PortofolioViewState extends State<PortofolioView> {
height: 24,
),
...listColumnPortofolio(),
const SizedBox(
height: 24,
)
],
),
),
@@ -232,7 +232,7 @@ class _PortofolioViewState extends State<PortofolioView> {
}
List<PieChartSectionData> sectionsDataPortofolio() {
return listCategoryPortofolio.asMap().entries.map((e) {
return listInvestmentType.asMap().entries.map((e) {
final isTouched = e.key == touchedIndex;
final radius = isTouched ? 40.0 : 30.0;
return PieChartSectionData(
@@ -265,7 +265,7 @@ class _PortofolioViewState extends State<PortofolioView> {
child: Wrap(
alignment: WrapAlignment.center,
spacing: 12,
children: listCategoryPortofolio.asMap().entries.map((e) {
children: listInvestmentType.asMap().entries.map((e) {
return Container(
color: Colors.white,
width: SizeConfig.width * 0.18,
@@ -303,7 +303,7 @@ class _PortofolioViewState extends State<PortofolioView> {
}
List<Widget> listColumnPortofolio() {
return listCategoryPortofolio.asMap().entries.map((e) {
return listInvestmentType.asMap().entries.map((e) {
return Column(
children: [
if (e.key > 0) ...[
@@ -325,7 +325,7 @@ class _PortofolioViewState extends State<PortofolioView> {
style: const TextStyle(fontWeight: FontWeight.w600),
),
subtitle: Text(
e.value.name,
'${e.value.mutualFunds} Mutual Funds',
style: const TextStyle(
fontWeight: FontWeight.w600, color: Color(0xff94A3B8)),
),