feat: profile page
This commit is contained in:
@@ -388,7 +388,7 @@ class _PortofolioViewState extends State<PortofolioView> {
|
||||
Widget cardPortfolio() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
routePush(context, page: const PortfolioDetailView());
|
||||
// routePush(context, page: const PortfolioDetailView());
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24),
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
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/text_title/text_title.dart';
|
||||
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||
import 'package:cims_apps/core/utils/size_config.dart';
|
||||
import 'package:cims_apps/features/dashboard/dashboard_account/view/profile/view_model/profile_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class RouteNavigation {
|
||||
String icon;
|
||||
String title;
|
||||
Widget destination;
|
||||
|
||||
RouteNavigation(this.icon, this.title, this.destination);
|
||||
}
|
||||
|
||||
class ProfileView extends StatelessWidget {
|
||||
const ProfileView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<RouteNavigation> listGeneral = [
|
||||
RouteNavigation(PathAssets.iconProfile, 'Personal Data', Container()),
|
||||
RouteNavigation(PathAssets.iconPadlock, 'Change Password', Container()),
|
||||
RouteNavigation(PathAssets.iconCard, 'Add Card', Container()),
|
||||
RouteNavigation(PathAssets.iconSetting, 'Settings', Container())
|
||||
];
|
||||
|
||||
List<RouteNavigation> listPreferences = [
|
||||
RouteNavigation(PathAssets.iconFaqs, 'FAQs', Container()),
|
||||
RouteNavigation(PathAssets.iconLogout, 'Log Out', Container())
|
||||
];
|
||||
|
||||
return Provider(
|
||||
create: (context) => ProfileViewModel(),
|
||||
child: Scaffold(
|
||||
body: SizedBox(
|
||||
width: SizeConfig.width,
|
||||
height: SizeConfig.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
const Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: ImageView(image: PathAssets.imgDashboardProfile)
|
||||
),
|
||||
Consumer<ProfileViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(0),
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
const Center(
|
||||
child: TextTitle(title: 'Profile', color: Colors.white, fontSize: 20,)
|
||||
),
|
||||
SizedBox(
|
||||
height: SizeConfig.height * 0.05,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
border: Border.all(color: ColorPalette.slate200, width: 1.5)
|
||||
),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ImageView(image: PathAssets.iconCat, width: SizeConfig.width * 0.14,),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: TextTitle(title: provider.getUser.name ?? '', color: Colors.white, fontSize: 24,)),
|
||||
Text('Investor ${provider.getUser.risk}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: ColorPalette.textRiskColor[provider.getUser.risk]
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
boxNavigation('General', listGeneral),
|
||||
const SizedBox(height: 24),
|
||||
boxNavigation('Preferences', listPreferences)
|
||||
],
|
||||
);
|
||||
}
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget boxNavigation(String title, List<RouteNavigation> list) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorPalette.slate400
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Wrap(
|
||||
runSpacing: 16,
|
||||
children: list.map((e) {
|
||||
return rowNavigation(
|
||||
e.icon,
|
||||
e.title,
|
||||
e.destination
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget rowNavigation(String icon, String text, Widget destination) {
|
||||
bool isLogout = text == 'Log Out';
|
||||
Color textColor = isLogout ? ColorPalette.red600 : ColorPalette.slate800;
|
||||
Color bgLeadingColor = isLogout ? ColorPalette.red50 : ColorPalette.blue50;
|
||||
Color iconColor = isLogout ? ColorPalette.red600 : ColorPalette.blue600;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: bgLeadingColor
|
||||
),
|
||||
child: Image.asset(icon, width: SizeConfig.width * 0.05, color: iconColor)
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: textColor
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Icon(Icons.chevron_right_outlined, size: 28, color: ColorPalette.slate400)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class User {
|
||||
String? name, risk;
|
||||
|
||||
User({this.name, this.risk});
|
||||
}
|
||||
|
||||
class ProfileViewModel {
|
||||
static final User _user = User(name: 'Muhammad Rosyidin', risk: 'Conservative');
|
||||
|
||||
User get getUser => _user;
|
||||
}
|
||||
Reference in New Issue
Block a user