fix: more detailing product view
This commit is contained in:
parent
59e6e82d13
commit
7a1cddee03
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cims_apps/application/assets/path_assets.dart';
|
import 'package:cims_apps/application/assets/path_assets.dart';
|
||||||
import 'package:cims_apps/application/component/image/image_view.dart';
|
import 'package:cims_apps/application/component/image/image_view.dart';
|
||||||
import 'package:cims_apps/application/theme/color_palette.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:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class CategoryPortofolio {
|
class InvestmentType {
|
||||||
String name;
|
String name;
|
||||||
int value;
|
int value;
|
||||||
|
int mutualFunds;
|
||||||
|
|
||||||
CategoryPortofolio(this.value, this.name);
|
InvestmentType(this.value, this.name, this.mutualFunds);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PortofolioView extends StatefulWidget {
|
class PortofolioView extends StatefulWidget {
|
||||||
|
@ -36,11 +39,11 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
bool seePortofolioValue = false;
|
bool seePortofolioValue = false;
|
||||||
int touchedIndex = -1;
|
int touchedIndex = -1;
|
||||||
|
|
||||||
List<CategoryPortofolio> listCategoryPortofolio = [
|
List<InvestmentType> listInvestmentType = [
|
||||||
CategoryPortofolio(20, 'Money Market'),
|
InvestmentType(20, 'Money Market', 2),
|
||||||
CategoryPortofolio(15, 'Shares'),
|
InvestmentType(15, 'Shares', 5),
|
||||||
CategoryPortofolio(8, 'Bonds'),
|
InvestmentType(8, 'Bonds', 3),
|
||||||
CategoryPortofolio(50, 'Sharia'),
|
InvestmentType(50, 'Sharia', 4),
|
||||||
];
|
];
|
||||||
|
|
||||||
List<String> assetsImage = [
|
List<String> assetsImage = [
|
||||||
|
@ -91,7 +94,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
topRight: Radius.circular(24)),
|
topRight: Radius.circular(24)),
|
||||||
),
|
),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 0),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
children: [
|
children: [
|
||||||
Stack(alignment: Alignment.center, children: [
|
Stack(alignment: Alignment.center, children: [
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
|
@ -117,20 +120,20 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
show: true,
|
show: true,
|
||||||
),
|
),
|
||||||
sectionsSpace: 20,
|
sectionsSpace: 20,
|
||||||
centerSpaceRadius: 100,
|
centerSpaceRadius: 110,
|
||||||
sections: sectionsDataPortofolio())),
|
sections: sectionsDataPortofolio())),
|
||||||
),
|
),
|
||||||
const Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Text('Total Mutual Fund',
|
const Text('Total Mutual Fund',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: ColorPalette.slate400
|
color: ColorPalette.slate400
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text('10',
|
Text(listInvestmentType.map((e) => e.mutualFunds).reduce((value, element) => value + element).toString(),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 44,
|
fontSize: 44,
|
||||||
fontWeight: FontWeight.w700
|
fontWeight: FontWeight.w700
|
||||||
)
|
)
|
||||||
|
@ -147,9 +150,6 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
...listColumnPortofolio(),
|
...listColumnPortofolio(),
|
||||||
const SizedBox(
|
|
||||||
height: 24,
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -232,7 +232,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PieChartSectionData> sectionsDataPortofolio() {
|
List<PieChartSectionData> sectionsDataPortofolio() {
|
||||||
return listCategoryPortofolio.asMap().entries.map((e) {
|
return listInvestmentType.asMap().entries.map((e) {
|
||||||
final isTouched = e.key == touchedIndex;
|
final isTouched = e.key == touchedIndex;
|
||||||
final radius = isTouched ? 40.0 : 30.0;
|
final radius = isTouched ? 40.0 : 30.0;
|
||||||
return PieChartSectionData(
|
return PieChartSectionData(
|
||||||
|
@ -265,7 +265,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
spacing: 12,
|
spacing: 12,
|
||||||
children: listCategoryPortofolio.asMap().entries.map((e) {
|
children: listInvestmentType.asMap().entries.map((e) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
width: SizeConfig.width * 0.18,
|
width: SizeConfig.width * 0.18,
|
||||||
|
@ -303,7 +303,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> listColumnPortofolio() {
|
List<Widget> listColumnPortofolio() {
|
||||||
return listCategoryPortofolio.asMap().entries.map((e) {
|
return listInvestmentType.asMap().entries.map((e) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
if (e.key > 0) ...[
|
if (e.key > 0) ...[
|
||||||
|
@ -325,7 +325,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
e.value.name,
|
'${e.value.mutualFunds} Mutual Funds',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w600, color: Color(0xff94A3B8)),
|
fontWeight: FontWeight.w600, color: Color(0xff94A3B8)),
|
||||||
),
|
),
|
||||||
|
|
|
@ -124,22 +124,13 @@ class _ProductChartViewState extends State<ProductChartView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 48),
|
padding: const EdgeInsets.only(top: 48, bottom: 24),
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 2.5,
|
aspectRatio: 2.5,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
return LineChart(
|
return LineChart(
|
||||||
LineChartData(
|
LineChartData(
|
||||||
// showingTooltipIndicators: showingTooltipOnSpots.map((index) {
|
|
||||||
// return ShowingTooltipIndicators([
|
|
||||||
// LineBarSpot(
|
|
||||||
// tooltipsOnBar,
|
|
||||||
// lineBarsData.indexOf(tooltipsOnBar),
|
|
||||||
// tooltipsOnBar.spots[index],
|
|
||||||
// ),
|
|
||||||
// ]);
|
|
||||||
// }).toList(),
|
|
||||||
extraLinesData: ExtraLinesData(
|
extraLinesData: ExtraLinesData(
|
||||||
verticalLines: [
|
verticalLines: [
|
||||||
VerticalLine(
|
VerticalLine(
|
||||||
|
|
|
@ -274,7 +274,7 @@ class _ProductViewState extends State<ProductView> {
|
||||||
),
|
),
|
||||||
cardInformation('Time Machine', timeMachine()),
|
cardInformation('Time Machine', timeMachine()),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 32,
|
||||||
),
|
),
|
||||||
topFiveHoldings(),
|
topFiveHoldings(),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -530,6 +530,7 @@ class _ProductViewState extends State<ProductView> {
|
||||||
sizeBorderRadius: 8,
|
sizeBorderRadius: 8,
|
||||||
isSecondaryColor: false,
|
isSecondaryColor: false,
|
||||||
width: SizeConfig.width * .5,
|
width: SizeConfig.width * .5,
|
||||||
|
marginVertical: 0,
|
||||||
heightWrapContent: true,
|
heightWrapContent: true,
|
||||||
isOutlined: true,
|
isOutlined: true,
|
||||||
widthPrefix: 10,
|
widthPrefix: 10,
|
||||||
|
@ -554,6 +555,7 @@ class _ProductViewState extends State<ProductView> {
|
||||||
heightWrapContent: true,
|
heightWrapContent: true,
|
||||||
backgroundColor: ColorPalette.orange50,
|
backgroundColor: ColorPalette.orange50,
|
||||||
sizeBorderRadius: 8,
|
sizeBorderRadius: 8,
|
||||||
|
marginVertical: 0,
|
||||||
isOutlined: true,
|
isOutlined: true,
|
||||||
borderColor: ColorPalette.orange500,
|
borderColor: ColorPalette.orange500,
|
||||||
textSize: 14,
|
textSize: 14,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user