fix: product view

This commit is contained in:
Prajna Prayoga 2024-03-06 16:43:02 +07:00
parent e513df325c
commit e441c56bab
4 changed files with 172 additions and 102 deletions

View File

@ -190,6 +190,18 @@ class TextFormView extends StatelessWidget {
color: focusedBorderColor ?? ColorPalette.greyBorder,
),
),
errorBorder: OutlineInputBorder(
borderRadius: _borderRadius,
borderSide: BorderSide(
color: ColorPalette.red600
)
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: _borderRadius,
borderSide: BorderSide(
color: ColorPalette.red600
)
),
border: OutlineInputBorder(borderRadius: _borderRadius),
suffixIcon: suffixIcon,
prefixIcon: prefixIcon,

View File

@ -52,7 +52,7 @@ class PhoneNumberView extends StatelessWidget {
width: SizeConfig.width * .23,
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
margin: const EdgeInsets.only(right: 16, left: 2, top: 2, bottom: 2),
margin: const EdgeInsets.only(right: 16, left: 1, top: 1, bottom: 1),
decoration: const BoxDecoration(
color: ColorPalette.grey,
borderRadius: BorderRadius.only(

View File

@ -50,7 +50,7 @@ class _HomeViewState extends State<HomeView> {
];
StepVerification listStepVerification =
StepVerification(0, ['Registration', '', 'Verification', '', 'Complete']);
StepVerification(1, ['Registration', '', 'Verification', '', 'Complete']);
List<Article> listArticle = [
Article(
@ -78,7 +78,8 @@ class _HomeViewState extends State<HomeView> {
onStretchTrigger: () async {
},
expandedHeight: 325,
leading: SizedBox(),
collapsedHeight: 325,
leading: const SizedBox(),
surfaceTintColor: ColorPalette.slate50,
backgroundColor: ColorPalette.slate50,
flexibleSpace: FlexibleSpaceBar(
@ -291,6 +292,7 @@ class _HomeViewState extends State<HomeView> {
child: Column(
children: [
stepVerification(),
if(listStepVerification.currentStep < 3)
const SizedBox(
height: 24,
),
@ -303,6 +305,7 @@ class _HomeViewState extends State<HomeView> {
Icon(
Icons.verified,
size: 18,
color: ColorPalette.slate300,
),
SizedBox(
width: 12,
@ -336,6 +339,7 @@ class _HomeViewState extends State<HomeView> {
Icon(
Icons.verified,
size: 18,
color: ColorPalette.slate300,
),
SizedBox(
width: 12,
@ -400,11 +404,11 @@ class _HomeViewState extends State<HomeView> {
borderRadius: BorderRadius.circular(12)),
child: Column(
children: [
Text(
const Text(
"Let's start registering your data to start mutual fund investment at PT Gemilang Indonesia",
style: TextStyle(color: ColorPalette.slate500),
),
SizedBox(
const SizedBox(
height: 16,
),
ButtonView(
@ -412,9 +416,9 @@ class _HomeViewState extends State<HomeView> {
width: SizeConfig.width,
marginVertical: 0,
heightWrapContent: true,
contentPadding: EdgeInsets.all(12),
contentPadding: const EdgeInsets.all(12),
onPressed: () {
routePush(context, page: InitialRegistrationStep());
routePush(context, page: const InitialRegistrationStep());
},
)
],
@ -430,18 +434,12 @@ class _HomeViewState extends State<HomeView> {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: listStepVerification.nameStep.asMap().entries.map((e) {
if(e.key == 1 || e.key == 3){
return SizedBox(
width: 30,
height: 30,
child: Divider(
color: listStepVerification.currentStep >= e.key
? const Color(0xff2563EB)
: const Color(0xffCBD5E1),
),
);
}else{
children: List.generate(
listStepVerification.nameStep.length,
(index) {
print(index % 2);
if (index % 2 == 0) {
final currentStep = index ~/ 2;
return Column(
children: [
Container(
@ -449,35 +447,47 @@ class _HomeViewState extends State<HomeView> {
height: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: listStepVerification.currentStep <= e.key
color: listStepVerification.currentStep <= currentStep
? Colors.white
: const Color(0xff2563EB),
border: Border.all(
color: listStepVerification.currentStep < e.key
color: listStepVerification.currentStep < currentStep
? const Color(0xffCBD5E1)
: const Color(0xff2563EB),
width: 2)),
child: listStepVerification.currentStep <= e.key
width: 2,
),
),
child: listStepVerification.currentStep <= currentStep
? const SizedBox()
: const Icon(
Icons.done_rounded,
color: Colors.white,
),
),
const SizedBox(
height: 8,
),
const SizedBox(height: 8),
Text(
e.value,
listStepVerification.nameStep[index],
style: TextStyle(
color: listStepVerification.currentStep == e.key
color: listStepVerification.currentStep == currentStep
? const Color(0xff2563EB)
: Colors.black),
)
: Colors.black,
),
),
],
);
} else {
return SizedBox(
width: 30,
height: 30,
child: Divider(
color: listStepVerification.currentStep > index ~/ 2
? const Color(0xff2563EB)
: const Color(0xffCBD5E1),
),
);
}
}).toList(),
},
),
);
}
@ -601,7 +611,7 @@ class _HomeViewState extends State<HomeView> {
color: ColorPalette.green100),
child: Text(
article.type,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.w600,
color: ColorPalette.green500),
),

View File

@ -13,6 +13,7 @@ import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view/step_subscribe/select_goal_investing.dart';
import 'package:cims_apps/features/dashboard/dashboard_account/view/product/view_model/product_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:group_button/group_button.dart';
import 'package:provider/provider.dart';
@ -79,6 +80,8 @@ class _ProductViewState extends State<ProductView> {
});
}
double currentScroll = 0;
@override
void initState() {
machineController.text = NumberFormatter.numberCurrency(100000, 'Rp ', 'id_ID', decimalDigits: 0);
@ -104,21 +107,45 @@ class _ProductViewState extends State<ProductView> {
return ChangeNotifierProvider(
create: (context) => ProductViewModel(),
child: Scaffold(
body: SizedBox(
child: Stack(
children: [
const ImageView(image: PathAssets.imgDashboardAccount),
Column(
children: [
const SizedBox(
height: 50,
body: NotificationListener<ScrollNotification>(
onNotification: (notification) {
setState(() {
currentScroll = notification.metrics.pixels;
});
return false;
},
child: CustomScrollView(
slivers: [
SliverAppBar(
toolbarHeight: 70,
expandedHeight: 170,
leadingWidth: 0,
floating: false,
automaticallyImplyLeading: false,
title: AnimatedCrossFade(
firstChild: Text(
widget.selectedProduct.name ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 18
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BackButtonView(),
),
secondChild: Padding(
padding: const EdgeInsets.only(left: 8),
child: BackButtonView(),
),
crossFadeState: currentScroll >= 85 ? CrossFadeState.showFirst : CrossFadeState.showSecond,
duration: Duration(milliseconds: 200)
),
centerTitle: false,
snap: false,
pinned: true,
backgroundColor: Color(0xFF1745C8).withOpacity(currentScroll >= 95 ? 1 : currentScroll / 95),
surfaceTintColor: ColorPalette.primary,
actions: [
Wrap(
spacing: 12,
children: [
@ -126,25 +153,43 @@ class _ProductViewState extends State<ProductView> {
Icon(Icons.file_download_outlined, color: ColorPalette.blue200, size: 32),
Icon(Icons.star_outline_rounded, color: ColorPalette.blue200, size: 32)
],
)
),
SizedBox(width: 24,)
],
),
),
const SizedBox(
height: 24,
),
flexibleSpace: Opacity(
opacity: currentScroll > 0 ? ((95 - currentScroll) / 95) > 0.01 ? ((95 - currentScroll) / 95) : 0 : 1,
child: Stack(
children: [
ImageView(image: PathAssets.imgDashboardAccount, width: SizeConfig.width, height: 200),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
headContainer(),
const SizedBox(
height: 24,
),
Expanded(
child: contentContainer()
Container(
height: 12,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12)
)
),
)
],
)
],
),
),
),
SliverToBoxAdapter(
child: contentContainer(),
)
],
),
),
bottomNavigationBar: !widget.seeMore ?
Container(
height: SizeConfig.height * .1,
@ -220,8 +265,11 @@ class _ProductViewState extends State<ProductView> {
decoration: BoxDecoration(
color: Colors.white,
),
child: ListView(
child: Column(
children: [
const SizedBox(
height: 12,
),
ProductChartView(
tabType: listTab[selectedTab],
lastTime: selectedTime.completeName,