profile tabs added
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../data/services/model/profile_data/profile_data.dart';
|
||||
import '../strings/profile_strings.dart';
|
||||
import 'theme_toggle.dart';
|
||||
import 'title_description.dart';
|
||||
|
||||
class MainDataTab extends StatelessWidget {
|
||||
const MainDataTab({
|
||||
required this.profileData,
|
||||
required this.onLogout,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ProfileData profileData;
|
||||
final VoidCallback onLogout;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 36.0.h()),
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(
|
||||
'Last Notification',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 24.0.h()),
|
||||
TitleDescription(
|
||||
title: ProfileStrings.fullname,
|
||||
description: profileData.fullName ?? '',
|
||||
),
|
||||
TitleDescription(
|
||||
title: ProfileStrings.username,
|
||||
description: profileData.username ?? '',
|
||||
),
|
||||
TitleDescription(
|
||||
title: ProfileStrings.email,
|
||||
description: profileData.email ?? '',
|
||||
),
|
||||
TitleDescription(
|
||||
title: ProfileStrings.phone,
|
||||
description: profileData.phone ?? '',
|
||||
),
|
||||
TitleDescription(
|
||||
title: ProfileStrings.companyName,
|
||||
description: profileData.companies!.first.name ?? '',
|
||||
),
|
||||
SizedBox(height: 32.0.h()),
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(
|
||||
ProfileStrings.settings,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 36.0.h()),
|
||||
_themeChangeRow(),
|
||||
SizedBox(height: 24.0.h()),
|
||||
Divider(color: AppColors.dividerColor, thickness: 1),
|
||||
SizedBox(height: 24.0.h()),
|
||||
|
||||
InkWell(
|
||||
onTap: onLogout,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 56.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
ProfileStrings.logout,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _themeChangeRow() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
ProfileStrings.appTheme,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
SvgPicture.asset(AssetsManager.sun),
|
||||
SizedBox(width: 12.0.w()),
|
||||
SizedBox(
|
||||
width: 52.0.w(),
|
||||
height: 32.0.h(),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
SizedBox(width: 12.0.w()),
|
||||
SvgPicture.asset(AssetsManager.moon),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
|
||||
import '../../../core/theme/colors.dart';
|
||||
|
||||
class ProfileTabBar extends StatefulWidget {
|
||||
const ProfileTabBar({
|
||||
required this.controller,
|
||||
required this.titles,
|
||||
this.onTap,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final TabController controller;
|
||||
final List<String> titles;
|
||||
final ValueChanged<int>? onTap;
|
||||
|
||||
@override
|
||||
State<ProfileTabBar> createState() => _ProfileTabBarState();
|
||||
}
|
||||
|
||||
class _ProfileTabBarState extends State<ProfileTabBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 51.0.h(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w(), vertical: 8.0.h()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey10,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: TabBar(
|
||||
controller: widget.controller,
|
||||
onTap: widget.onTap,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
dividerColor: Colors.transparent,
|
||||
indicator: BoxDecoration(
|
||||
color: AppColors.primary0,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.12),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
labelColor: AppColors.mainBlue,
|
||||
unselectedLabelColor: AppColors.grey60,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
tabs: [
|
||||
Tab(text: widget.titles[0]),
|
||||
Tab(text: widget.titles[1]),
|
||||
Tab(text: widget.titles[2]),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user