Initial commit
This commit is contained in:
162
lib/views/profile/profile_view.dart
Normal file
162
lib/views/profile/profile_view.dart
Normal file
@@ -0,0 +1,162 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hum/core/constants/app_text.dart';
|
||||
import 'package:hum/core/constants/app_theme.dart';
|
||||
import 'package:hum/core/utils/dialogs.dart';
|
||||
import 'package:hum/services/firebase_auth.dart';
|
||||
import 'package:hum/views/profile/widget_profile_stat.dart';
|
||||
|
||||
class ProfileView extends StatefulWidget {
|
||||
const ProfileView({super.key});
|
||||
|
||||
@override
|
||||
State<ProfileView> createState() => _ProfileViewState();
|
||||
}
|
||||
|
||||
class _ProfileViewState extends State<ProfileView> {
|
||||
String displayName = 'Yas Opisso';
|
||||
String memberSince = 'July 14th, 2014';
|
||||
|
||||
String rentals = '34';
|
||||
String listings = '5';
|
||||
String earnings = "1.12K";
|
||||
String favorites = '2';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
trailing: CupertinoButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Text('Edit'),
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.person_alt_circle_fill,
|
||||
size: 140,
|
||||
color: CupertinoColors.inactiveGray,
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 6),
|
||||
child: Text(
|
||||
displayName,
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
|
||||
Opacity(
|
||||
opacity: .7,
|
||||
child: Text(
|
||||
memberSince,
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 26.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
WDGProfileStat(
|
||||
amount: rentals,
|
||||
label: profileStatRental,
|
||||
color: Colors.blue,
|
||||
icon: CupertinoIcons.house_fill,
|
||||
),
|
||||
|
||||
Opacity(
|
||||
opacity: .5,
|
||||
child: Container(width: .5, height: 60, color: Colors.grey),
|
||||
),
|
||||
|
||||
WDGProfileStat(
|
||||
amount: listings,
|
||||
label: profileStatListings,
|
||||
color: Colors.orange,
|
||||
icon: CupertinoIcons.square_list_fill,
|
||||
),
|
||||
|
||||
Opacity(
|
||||
opacity: .5,
|
||||
child: Container(width: .5, height: 60, color: Colors.grey),
|
||||
),
|
||||
|
||||
WDGProfileStat(
|
||||
amount: earnings,
|
||||
label: profileStatEarnings,
|
||||
color: Colors.green,
|
||||
icon: CupertinoIcons.money_dollar_circle_fill,
|
||||
),
|
||||
|
||||
Opacity(
|
||||
opacity: .5,
|
||||
child: Container(width: .5, height: 60, color: Colors.grey),
|
||||
),
|
||||
|
||||
WDGProfileStat(
|
||||
amount: favorites,
|
||||
label: profileStatFavorites,
|
||||
color: Colors.red,
|
||||
icon: CupertinoIcons.heart_fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 30.0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
// height: 40,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: CupertinoColors.systemRed.withAlpha(140), // 🔴 red border
|
||||
width: 1.5,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(roundLarge),
|
||||
),
|
||||
child: CupertinoButton.filled(
|
||||
sizeStyle: CupertinoButtonSize.medium,
|
||||
color: CupertinoColors.systemRed.withAlpha(20),
|
||||
borderRadius: BorderRadius.circular(roundLarge),
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(
|
||||
context,
|
||||
title: 'Sign Out',
|
||||
message: 'Do you want to sign out',
|
||||
);
|
||||
if (confirm) {
|
||||
signOut();
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(CupertinoIcons.power, color: CupertinoColors.systemRed),
|
||||
const Text(profileBtnSignOut, style: TextStyle(color: Colors.red)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
70
lib/views/profile/widget_profile_stat.dart
Normal file
70
lib/views/profile/widget_profile_stat.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class WDGProfileStat
|
||||
extends
|
||||
StatelessWidget {
|
||||
const WDGProfileStat({
|
||||
super.key,
|
||||
this.amount = '',
|
||||
this.label = '',
|
||||
this.color = Colors.blue,
|
||||
this.icon = CupertinoIcons.house_fill,
|
||||
});
|
||||
|
||||
final String amount;
|
||||
final String label;
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context,
|
||||
) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
100,
|
||||
),
|
||||
color: color,
|
||||
),
|
||||
|
||||
padding: EdgeInsets.all(
|
||||
10,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12.0,
|
||||
bottom: 2.0,
|
||||
),
|
||||
child: Text(
|
||||
amount,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Opacity(
|
||||
opacity: .7,
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user