feat: add view of profile page (uncompleted yet)
This commit is contained in:
parent
1785fbceb7
commit
5b94690d02
|
|
@ -3,7 +3,7 @@ export 'package:rijig_mobile/core/utils/navigation.dart';
|
|||
export 'package:rijig_mobile/features/activity/activity_screen.dart';
|
||||
export 'package:rijig_mobile/features/cart/cart_screen.dart';
|
||||
export 'package:rijig_mobile/features/home/presentation/screen/home_screen.dart';
|
||||
export 'package:rijig_mobile/features/profil/profil_screen.dart';
|
||||
export 'package:rijig_mobile/features/profil/presentation/screen/profil_screen.dart';
|
||||
export 'package:rijig_mobile/features/requestpick/presentation/screen/requestpickup_screen.dart';
|
||||
export 'package:rijig_mobile/features/auth/presentation/screen/inputpin_screen.dart';
|
||||
export 'package:rijig_mobile/features/auth/presentation/screen/login_screen.dart';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'package:rijig_mobile/core/router.dart';
|
|||
import 'package:rijig_mobile/features/activity/activity_screen.dart';
|
||||
import 'package:rijig_mobile/features/cart/cart_screen.dart';
|
||||
import 'package:rijig_mobile/features/home/presentation/screen/home_screen.dart';
|
||||
import 'package:rijig_mobile/features/profil/profil_screen.dart';
|
||||
import 'package:rijig_mobile/features/profil/presentation/screen/profil_screen.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class NavigationPage extends StatefulWidget {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ClipInfoClass extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
Path path = Path();
|
||||
path.lineTo(0, size.height);
|
||||
path.lineTo(size.width - 80, size.height);
|
||||
path.lineTo(size.width, size.height - 80);
|
||||
path.lineTo(size.width, 0);
|
||||
path.close();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(covariant CustomClipper<Path> oldClipper) => false;
|
||||
}
|
||||
|
||||
class ClipPathClass extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
Path path = Path();
|
||||
path.lineTo(0, size.height - 60);
|
||||
path.quadraticBezierTo(
|
||||
size.width / 2,
|
||||
size.height,
|
||||
size.width,
|
||||
size.height - 60,
|
||||
);
|
||||
path.lineTo(size.width, 0);
|
||||
path.close();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(covariant CustomClipper<Path> oldClipper) => false;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rijig_mobile/core/router.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
import 'package:rijig_mobile/features/auth/presentation/viewmodel/logout_vmod.dart';
|
||||
import 'package:rijig_mobile/widget/buttoncard.dart';
|
||||
|
||||
class ButtonLogout extends StatefulWidget {
|
||||
const ButtonLogout({super.key});
|
||||
|
||||
@override
|
||||
State<ButtonLogout> createState() => _ButtonLogoutState();
|
||||
}
|
||||
|
||||
class _ButtonLogoutState extends State<ButtonLogout> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<LogoutViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
return Column(
|
||||
children: [
|
||||
CardButtonOne(
|
||||
textButton: viewModel.isLoading ? 'Logging out...' : 'Logout',
|
||||
fontSized: 16,
|
||||
colorText: whiteColor,
|
||||
color: redColor,
|
||||
borderRadius: 10,
|
||||
horizontal: double.infinity,
|
||||
vertical: 50,
|
||||
onTap: () async {
|
||||
await viewModel.logout();
|
||||
|
||||
if (viewModel.errorMessage == null) {
|
||||
router.go("/login");
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(viewModel.errorMessage!)),
|
||||
);
|
||||
}
|
||||
},
|
||||
loadingTrue: viewModel.isLoading,
|
||||
usingRow: false,
|
||||
),
|
||||
if (viewModel.errorMessage != null)
|
||||
Text(
|
||||
viewModel.errorMessage!,
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:iconsax_flutter/iconsax_flutter.dart';
|
||||
|
||||
class ProfileListTile extends StatelessWidget {
|
||||
const ProfileListTile({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
required this.icon,
|
||||
required this.iconColor,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
final void Function() onTap;
|
||||
final IconData icon;
|
||||
final Color iconColor;
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: iconColor),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyLarge?.copyWith(color: Colors.black),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
Icon(Iconsax.arrow_right_3_copy),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:iconsax_flutter/iconsax_flutter.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
import 'package:rijig_mobile/features/profil/components/profile_list_tile.dart';
|
||||
|
||||
class ProfileMenuOptions extends StatelessWidget {
|
||||
const ProfileMenuOptions({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: PaddingCustom().paddingAll(7),
|
||||
decoration: BoxDecoration(
|
||||
color: whiteColor,
|
||||
border: Border.all(color: greyColor),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ProfileListTile(
|
||||
title: 'Ubah Pin',
|
||||
iconColor: primaryColor,
|
||||
icon: Iconsax.wallet,
|
||||
onTap: () {},
|
||||
),
|
||||
Divider(thickness: 0.7, color: greyColor),
|
||||
ProfileListTile(
|
||||
title: 'Alamat',
|
||||
iconColor: primaryColor,
|
||||
icon: Iconsax.wallet,
|
||||
onTap: () {},
|
||||
),
|
||||
Divider(thickness: 0.7, color: greyColor),
|
||||
ProfileListTile(
|
||||
title: 'Bantuan',
|
||||
icon: Iconsax.wallet,
|
||||
iconColor: primaryColor,
|
||||
onTap: () {},
|
||||
),
|
||||
Divider(thickness: 0.7, color: greyColor),
|
||||
ProfileListTile(
|
||||
title: 'Ulasan',
|
||||
icon: Iconsax.wallet,
|
||||
iconColor: primaryColor,
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
import 'package:rijig_mobile/features/profil/components/clip_path.dart';
|
||||
import 'package:rijig_mobile/features/profil/components/logout_button.dart';
|
||||
import 'package:rijig_mobile/features/profil/components/profile_menu_option.dart';
|
||||
|
||||
class ProfilScreen extends StatefulWidget {
|
||||
const ProfilScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ProfilScreen> createState() => _ProfilScreenState();
|
||||
}
|
||||
|
||||
class _ProfilScreenState extends State<ProfilScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
ClipPath(
|
||||
clipper: ClipPathClass(),
|
||||
child: Container(
|
||||
height: 180,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 60,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: whiteColor,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withValues(alpha: 0.3),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Fahmi Kurniawan'),
|
||||
SizedBox(height: 10),
|
||||
Text('+62878774527342'),
|
||||
SizedBox(height: 20),
|
||||
|
||||
// Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Tipe Kontributor: ',
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// Chip(
|
||||
// label: Text('Personal'),
|
||||
// backgroundColor: Colors.green,
|
||||
// labelStyle: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Tervalidasi',
|
||||
style: TextStyle(color: Colors.green),
|
||||
),
|
||||
Text('edit', style: TextStyle(color: Colors.blue)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 245),
|
||||
child: Padding(
|
||||
padding: PaddingCustom().paddingHorizontal(20),
|
||||
child: Column(
|
||||
children: [
|
||||
ProfileMenuOptions(),
|
||||
// SizedBox(height: 20),
|
||||
Gap(30),
|
||||
ButtonLogout(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rijig_mobile/core/router.dart';
|
||||
import 'package:rijig_mobile/features/auth/presentation/viewmodel/logout_vmod.dart';
|
||||
import 'package:rijig_mobile/widget/buttoncard.dart';
|
||||
|
||||
class ProfilScreen extends StatefulWidget {
|
||||
const ProfilScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ProfilScreen> createState() => _ProfilScreenState();
|
||||
}
|
||||
|
||||
class _ProfilScreenState extends State<ProfilScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Consumer<LogoutViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Are you sure you want to logout?"),
|
||||
SizedBox(height: 20),
|
||||
CardButtonOne(
|
||||
textButton: viewModel.isLoading ? 'Logging out...' : 'Logout',
|
||||
fontSized: 16,
|
||||
colorText: Colors.white,
|
||||
borderRadius: 10,
|
||||
horizontal: double.infinity,
|
||||
vertical: 50,
|
||||
onTap: () async {
|
||||
await viewModel.logout();
|
||||
|
||||
if (viewModel.errorMessage == null) {
|
||||
router.go("/login");
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(viewModel.errorMessage!)),
|
||||
);
|
||||
}
|
||||
},
|
||||
loadingTrue: viewModel.isLoading,
|
||||
usingRow: false,
|
||||
),
|
||||
if (viewModel.errorMessage != null)
|
||||
Text(
|
||||
viewModel.errorMessage!,
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue