fix: widget overflow

This commit is contained in:
2024-02-20 15:14:25 +07:00
parent 9761dc369c
commit dfb947dce5
3 changed files with 323 additions and 268 deletions

View File

@@ -20,11 +20,25 @@ class InvestTypeView extends StatefulWidget {
}
class _InvestTypeViewState extends State<InvestTypeView> {
List<Product> listProduct = [
Product(name: 'Gemilang Dana Kas Maxima', type: '', yield: 8.17, priceUnit: 2600.79, funds: 6300000),
Product(name: 'Gemilang Dana Likuid', type: '', yield: 6.42, priceUnit: 1600.79, funds: 2340000),
Product(name: 'Gemilang Income Fund', type: '', yield: 8.17, priceUnit: 2600.79, funds: 6300000)
Product(
name: 'Gemilang Dana Kas Maxima',
type: '',
yield: 8.17,
priceUnit: 2600.79,
funds: 6300000),
Product(
name: 'Gemilang Dana Likuid',
type: '',
yield: 6.42,
priceUnit: 1600.79,
funds: 2340000),
Product(
name: 'Gemilang Income Fund',
type: '',
yield: 8.17,
priceUnit: 2600.79,
funds: 6300000)
];
@override
@@ -36,76 +50,80 @@ class _InvestTypeViewState extends State<InvestTypeView> {
return e;
}).toList();
}
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<ProductViewModel>(
create: (context) => ProductViewModel(),
child: Consumer<ProductViewModel>(
builder: (context, provider, child) {
return Scaffold(
body: SizedBox(
width: SizeConfig.width,
height: SizeConfig.height,
child: Stack(
children: [
const ImageView(image: PathAssets.imgDashboardAccount),
Column(
children: [
const SizedBox(
height: 50,
child: Consumer<ProductViewModel>(builder: (context, provider, child) {
return Scaffold(
body: SizedBox(
width: SizeConfig.width,
height: SizeConfig.height,
child: Stack(
children: [
const ImageView(image: PathAssets.imgDashboardAccount),
Column(
children: [
SizedBox(
height: SizeConfig.height * .1,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const BackButtonView(),
TextTitle(title: widget.title, color: Colors.white),
SizedBox(
width: SizeConfig.width * 0.1,
)
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const BackButtonView(),
TextTitle(title: widget.title, color: Colors.white),
SizedBox(
width: SizeConfig.width * 0.1,
)
],
),
),
const SizedBox(
height: 24,
),
Container(
),
const SizedBox(
height: 24,
),
Expanded(
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white
),
child: Column(
children: [
filters(),
ListView(
shrinkWrap: true,
children: listProduct.asMap().entries.map((e) {
return GestureDetector(
onTap: () {
provider.setSelectedProduct(e.value);
routePush(context, page: ProductView(widget.title));
},
child: Padding(
padding: EdgeInsets.only(top: e.key != 0 ? 24 : 0),
child: cardProduct(e.value),
),
);
}).toList(),
)
],
borderRadius: BorderRadius.circular(16),
color: Colors.white),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
filters(),
ListView(
shrinkWrap: true,
children: listProduct.asMap().entries.map((e) {
return GestureDetector(
onTap: () {
provider.setSelectedProduct(e.value);
routePush(context,
page: ProductView(widget.title));
},
child: Padding(
padding: EdgeInsets.only(
top: e.key != 0 ? 24 : 0),
child: cardProduct(e.value),
),
);
}).toList(),
)
],
),
),
),
],
)
],
),
),
],
)
],
),
);
}
),
),
);
}),
);
}
@@ -115,9 +133,25 @@ class _InvestTypeViewState extends State<InvestTypeView> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
segmentFilter(const Icon(Icons.filter_alt_outlined, color: ColorPalette.slate400,), 'Filter', () { }),
segmentFilter(const RotatedBox(quarterTurns: 1, child: Icon(Icons.compare_arrows, color: ColorPalette.slate400)), 'Sort', () { }),
segmentFilter(const Icon(Icons.dashboard_outlined, color: ColorPalette.slate400), 'Compare', () { }),
segmentFilter(
const Icon(
Icons.filter_alt_outlined,
color: ColorPalette.slate400,
),
'Filter',
() {}),
segmentFilter(
const RotatedBox(
quarterTurns: 1,
child:
Icon(Icons.compare_arrows, color: ColorPalette.slate400)),
'Sort',
() {}),
segmentFilter(
const Icon(Icons.dashboard_outlined,
color: ColorPalette.slate400),
'Compare',
() {}),
],
),
);
@@ -126,12 +160,11 @@ class _InvestTypeViewState extends State<InvestTypeView> {
Widget segmentFilter(Widget leading, String text, void Function()? onTap) {
return GestureDetector(
onTap: onTap,
child: Container(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
decoration: BoxDecoration(
border: Border.all(color: ColorPalette.slate200),
borderRadius: BorderRadius.circular(56)
),
borderRadius: BorderRadius.circular(56)),
child: Row(
children: [
leading,
@@ -142,9 +175,7 @@ class _InvestTypeViewState extends State<InvestTypeView> {
text,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: ColorPalette.slate500,
fontWeight: FontWeight.w700
),
color: ColorPalette.slate500, fontWeight: FontWeight.w700),
)
],
),
@@ -163,7 +194,10 @@ class _InvestTypeViewState extends State<InvestTypeView> {
children: [
Row(
children: [
ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,),
ImageView(
image: PathAssets.imgProduct,
width: SizeConfig.width * .12,
),
const SizedBox(
width: 8,
),
@@ -171,9 +205,7 @@ class _InvestTypeViewState extends State<InvestTypeView> {
child: Text(
product.name ?? '',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18
),
fontWeight: FontWeight.bold, fontSize: 18),
),
)
],
@@ -187,36 +219,53 @@ class _InvestTypeViewState extends State<InvestTypeView> {
children: [
Column(
children: [
const Text('Yield', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
const Text(
'Yield',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600),
),
Row(
children: [
Text(
'${product.yield.toString()}%',
style: const TextStyle(
color: ColorPalette.green400,
fontWeight: FontWeight.w600
),
color: ColorPalette.green400,
fontWeight: FontWeight.w600),
),
const Text('/'),
const Text('3year', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),)
const Text(
'3year',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600),
)
],
)
],
),
Column(
children: [
const Text('Price/unit', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
const Text(
'Price/unit',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600),
),
Row(
children: [
const Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,),
const Icon(
Icons.trending_up_outlined,
size: 18,
color: ColorPalette.green400,
),
const SizedBox(
width: 2,
),
Text(
NumberFormatter.numberCurrency(product.priceUnit, 'Rp', 'id_ID'),
style: const TextStyle(
fontWeight: FontWeight.w600
),
NumberFormatter.numberCurrency(
product.priceUnit, 'Rp', 'id_ID'),
style: const TextStyle(fontWeight: FontWeight.w600),
),
],
)
@@ -224,14 +273,18 @@ class _InvestTypeViewState extends State<InvestTypeView> {
),
Column(
children: [
const Text('Managed funds', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
const Text(
'Managed funds',
style: TextStyle(
color: ColorPalette.slate400,
fontWeight: FontWeight.w600),
),
Row(
children: [
Text(
NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'),
style: const TextStyle(
fontWeight: FontWeight.w600
),
NumberFormatter.compactCurrency(
product.funds, 'Rp ', 'id_ID'),
style: const TextStyle(fontWeight: FontWeight.w600),
),
],
)
@@ -243,5 +296,4 @@ class _InvestTypeViewState extends State<InvestTypeView> {
),
);
}
}

View File

@@ -6,6 +6,7 @@ import 'package:cims_apps/core/route/route.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:cims_apps/features/auth/login/view/login_view.dart';
import 'package:cims_apps/features/auth/registration/view/registration_view.dart';
import 'package:cims_apps/features/bottom_navigation_view.dart';
import 'package:cims_apps/features/dashboard/dashboard_public/viewmodel/dashboard_public_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -102,7 +103,8 @@ class DashboardPublicView extends StatelessWidget {
width: 26,
),
onPressed: () {
provider.loginGoogle(context);
// provider.loginGoogle(context);
routePush(context, page: const BottomNavigationView());
},
),
Row(