cims_apps/lib/features/profile/view/profile_view.dart

119 lines
4.2 KiB
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/theme/color_palette.dart';
import 'package:cims_apps/core/route/route.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:cims_apps/features/profile/model/list_menu_model.dart';
import 'package:flutter/material.dart';
class ProfileView extends StatelessWidget {
const ProfileView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
List<ListMenuModel> listMenuGeneral = [
ListMenuModel(
title: 'Personal Data',
pathAsset: PathAssets.iconProfile,
page: Container()),
ListMenuModel(
title: 'Change Password',
pathAsset: PathAssets.iconLock,
page: Container()),
ListMenuModel(
title: 'Add Card', pathAsset: PathAssets.iconCard, page: Container()),
ListMenuModel(
title: 'Settings',
pathAsset: PathAssets.iconSetting,
page: Container()),
];
List<ListMenuModel> listMenuPreferences = [
ListMenuModel(
title: 'FAQs', pathAsset: PathAssets.iconChat, page: Container()),
ListMenuModel(
title: 'Log Out',
pathAsset: PathAssets.iconLogout,
page: Container()),
];
TextStyle textStyle = const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
);
Widget cardContent(
{required String title, required List<ListMenuModel> listMenu}) {
return Container(
width: SizeConfig.width,
padding: const EdgeInsets.all(16.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(12))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title),
...listMenu.map((e) {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: ListTile(
title: Text(e.title),
contentPadding: EdgeInsets.zero,
leading: ImageView(
image: e.pathAsset, width: SizeConfig.width * .08),
trailing: const Icon(Icons.arrow_forward_ios,
color: ColorPalette.slate400),
onTap: () => routePush(context, page: e.page),
),
);
}),
],
),
);
}
return Scaffold(
appBar: null,
body: Stack(
children: [
ImageView(image: PathAssets.bgProfile, width: SizeConfig.width),
Container(
width: SizeConfig.width,
padding: const EdgeInsets.only(top: 40.0, left: 16.0, right: 16.0),
child: SingleChildScrollView(
padding: const EdgeInsets.only(bottom: 60.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Profile', style: textStyle),
Padding(
padding: const EdgeInsets.only(top: 40.0, bottom: 8.0),
child: ImageView(
image: PathAssets.imgCatOutlined,
width: SizeConfig.width * .28,
),
),
Text('Muhamad Rosyidin',
style: textStyle.copyWith(fontSize: 24)),
Text('Investor Conservative',
style: textStyle.copyWith(
fontSize: 16,
fontWeight: FontWeight.normal,
color: ColorPalette.green400,
)),
SizedBox(height: SizeConfig.height * .02),
cardContent(title: 'General', listMenu: listMenuGeneral),
SizedBox(height: SizeConfig.height * .03),
cardContent(
title: 'Preference', listMenu: listMenuPreferences),
],
),
),
),
],
),
);
}
}