test base project

This commit is contained in:
Azmat-7860
2026-09-15 09:09:11 +05:30
commit 8094da30c4
471 changed files with 27174 additions and 0 deletions
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
class CustomizedFooter extends StatelessWidget {
final IconData homeIcon;
final IconData squareIcon;
final IconData addIcon;
final List<String> labels;
final List<Function()> onTapActions;
CustomizedFooter({
required this.homeIcon,
required this.squareIcon,
required this.addIcon,
required this.labels,
required this.onTapActions,
});
@override
Widget build(BuildContext context) {
assert(labels.length == 3 && onTapActions.length == 3);
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(0, 3),
),
],
),
child: BottomNavigationBar(
onTap: (index) {
onTapActions[index]();
},
items: [
BottomNavigationBarItem(
icon: Icon(homeIcon),
label: labels[0],
),
BottomNavigationBarItem(
icon: Icon(squareIcon),
label: labels[1],
),
BottomNavigationBarItem(
icon: Icon(addIcon),
label: labels[2],
),
],
),
);
}
}
@@ -0,0 +1,339 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg_provider/flutter_svg_provider.dart' as fs;
import '../../Utils/color_constants.dart';
import '../../Utils/image_constant.dart';
import '../../Utils/size_utils.dart';
import '../../providers/token_manager.dart';
import '../../resources/api_constants.dart';
import '../../theme/app_style.dart';
import '../LogoutService/Logoutservice.dart';
import 'package:http/http.dart' as http;
class Listgroup524ItemWidget extends StatefulWidget {
final Map<String, dynamic> userData;
Listgroup524ItemWidget({required this.userData});
@override
State<Listgroup524ItemWidget> createState() => _Listgroup524ItemWidgetState();
}
class _Listgroup524ItemWidgetState extends State<Listgroup524ItemWidget> {
int myProjectcount = 0;
int sharedWithMeCount = 0;
int allprojectCount = 0;
@override
void initState() {
super.initState();
fetchData();
}
Future<void> fetchData() async {
print("working");
final token = await TokenManager.getToken();
print(token);
String baseUrl = ApiConstants.baseUrl;
var myProjectcountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_myproject'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
var sharedWithMeCountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_sharedwithme'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
var allProjectsCountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_allproject'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
if (myProjectcountres.statusCode == 401) {
LogoutService.logout();
}
print(myProjectcountres.statusCode);
if (myProjectcountres.statusCode <= 209 &&
sharedWithMeCountres.statusCode <= 209) {
final myProjectData = jsonDecode(myProjectcountres.body);
final sharedData = jsonDecode(sharedWithMeCountres.body);
final allData = jsonDecode(allProjectsCountres.body);
setState(() {
myProjectcount = myProjectData;
sharedWithMeCount = sharedData;
allprojectCount = allData;
});
} else {
// Handle errors
print('Failed to fetch data');
}
}
@override
Widget build(BuildContext context) {
return Center(
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "myproject"), // Get all projects
// ),
// );
},
child: Card(
color: Colors.white,
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column(
children: [
Container(
height: getSize(
55,
),
width: getSize(
55,
),
margin: getMargin(
top: 2,
),
child: Stack(
alignment: Alignment.center,
children: [
Align(
alignment: Alignment.center,
child: Container(
height: getSize(
55,
),
width: getSize(
55,
),
child: CircularProgressIndicator(
value: 0.5,
backgroundColor: ColorConstant.gray30099,
color: ColorConstant.blueA700,
),
),
),
Align(
alignment: Alignment.center,
child: Text(
myProjectcount.toString(),
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyBold18,
),
),
],
),
),
// Text(
// myProjectcount.toString(),
// style: const TextStyle(
// color: Colors.black,
// fontSize: 12,
// ),
// ),
const SizedBox(
height: 3,
),
const Text(
'My Projects',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
),
],
),
),
),
),
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "sharedproject"), // Get all projects
// ),
// );
},
child: Card(
color: Colors.white,
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column(
children: [
Container(
height: getSize(
55,
),
width: getSize(
55,
),
margin: getMargin(
top: 2,
),
child: Stack(
alignment: Alignment.center,
children: [
Align(
alignment: Alignment.center,
child: Container(
height: getSize(
55,
),
width: getSize(
55,
),
child: CircularProgressIndicator(
value: 0.5,
backgroundColor: ColorConstant.gray30099,
color: ColorConstant.blueA700,
),
),
),
Align(
alignment: Alignment.center,
child: Text(
sharedWithMeCount.toString(),
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyBold18,
),
),
],
),
),
// Text(
// myProjectcount.toString(),
// style: const TextStyle(
// color: Colors.black,
// fontSize: 12,
// ),
// ),
const SizedBox(
height: 3,
),
const Text(
'Shared with me',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
),
],
),
),
),
),
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "allproject"), // Get all projects
// ),
// );
},
child: Card(
color: Colors.white,
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column(
children: [
Container(
height: getSize(
55,
),
width: getSize(
55,
),
margin: getMargin(
top: 2,
),
child: Stack(
alignment: Alignment.center,
children: [
Align(
alignment: Alignment.center,
child: Container(
height: getSize(
55,
),
width: getSize(
55,
),
child: CircularProgressIndicator(
value: 0.5,
backgroundColor: ColorConstant.gray30099,
color: ColorConstant.blueA700,
),
),
),
Align(
alignment: Alignment.center,
child: Text(
allprojectCount.toString(),
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyBold18,
),
),
],
),
),
// Text(
// myProjectcount.toString(),
// style: const TextStyle(
// color: Colors.black,
// fontSize: 12,
// ),
// ),
const SizedBox(
height: 3,
),
const Text(
'All Projects',
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
),
],
),
),
),
),
],
),
),
);
}
}
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import '../../Utils/size_utils.dart';
import '../../theme/app_style.dart';
// ignore: must_be_immutable
class ListtextItemWidget extends StatelessWidget {
ListtextItemWidget();
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Lorem ipsum",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold16,
),
Padding(
padding: getPadding(
top: 10,
),
child: Text(
"Lorem ipsum",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyRegular14,
),
),
],
),
Padding(
padding: getPadding(
top: 11,
bottom: 13,
),
child: Text(
"7.5",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold18,
),
),
],
);
}
}
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
class LocalSplashScreenComponent extends StatelessWidget {
const LocalSplashScreenComponent({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Color(0xff2f73b9),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/hadwin_system/hadwin-splash-screen-logo.png',
height: 128.0,
),
],
),
);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,88 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../Utils/size_utils.dart';
import '../../theme/app_style.dart';
class NotificationItem extends StatelessWidget {
final Map<String, dynamic> notification;
const NotificationItem({required this.notification});
@override
Widget build(BuildContext context) {
final notificationText = notification['notification'] as String;
final time = notification['time'] as String;
final timeDifference = calculateTimeDifference(time);
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Text(
// notificationText,
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle.txtGilroySemiBold16,
// ),
Padding(
padding: getPadding(
top: 10,
),
child: Text(
notificationText,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyRegular14,
),
),
],
),
Padding(
padding: getPadding(
top: 11,
bottom: 13,
),
child: Text(
timeDifference,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold18,
),
),
],
);
ListTile(
title: Text(notificationText),
subtitle: Text(timeDifference),
);
}
String calculateTimeDifference(String time) {
final currentTime = DateTime.now();
final notificationTime = DateTime.parse(time);
final difference = currentTime.difference(notificationTime);
if (difference.inDays >= 365) {
final years = (difference.inDays / 365).floor();
return '${years} ${years == 1 ? 'year' : 'years'} ago';
} else if (difference.inDays >= 30) {
final months = (difference.inDays / 30).floor();
return '${months} ${months == 1 ? 'month' : 'months'} ago';
} else if (difference.inDays > 0) {
return '${difference.inDays} ${difference.inDays == 1 ? 'day' : 'days'} ago';
} else if (difference.inHours > 0) {
return '${difference.inHours} ${difference.inHours == 1 ? 'hour' : 'hours'} ago';
} else {
return 'Just now';
}
}
}
@@ -0,0 +1,957 @@
import 'package:intl/intl.dart';
import 'dart:async';
import 'dart:convert';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
import 'package:provider/provider.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import '../../Utils/color_constants.dart';
import '../../Utils/size_utils.dart';
import '../../providers/tab_navigation_provider.dart';
import '../../providers/token_manager.dart';
import '../../resources/api_constants.dart';
import '../../theme/app_decoration.dart';
import '../../theme/app_style.dart';
import '../Bookmarks/Bookmarks_entity_list_screen.dart';
import '../Incident_Ticket/ticket_create.dart';
import '../LayoutReportBuilder/LayoutReportBuilder.dart';
import '../Login Screen/login_screen.dart';
import '../LogoutService/Logoutservice.dart';
import '../QrBarCode/Qr_BarCode/Qr_BarCode_create_entity_screen.dart';
import '../Setup/setup.dart';
import '../SysParameters/SystemParameterScreen.dart';
import '../dynamic_form/list_dynamic_form_screen.dart';
import '../profileManagement/Profilesettings.dart';
import '../profileManagement/about.dart';
import '../profileManagement/changepassword.dart';
class TabbedLayoutComponent extends StatefulWidget {
@override
_TabbedLayoutComponentState createState() => _TabbedLayoutComponentState();
}
class _TabbedLayoutComponentState extends State<TabbedLayoutComponent> {
int _currentTab = 0;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
Map<String, dynamic> userData = {};
@override
void initState() {
super.initState();
getUserData();
fetchData();
}
getUserData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
var userdatastr = prefs.getString('userData');
if (userdatastr != null) {
try {
setState(() {
userData = json.decode(userdatastr);
});
print(userData['token']);
} catch (e) {
print("error is ..................$e");
}
}
}
void setTab(int index) {
setState(() {
_currentTab = index;
});
}
List<Map<String, dynamic>> notifications = [];
Future<void> fetchData() async {
String baseUrl = ApiConstants.baseUrl;
final apiUrl = '$baseUrl/notification/get_notification';
final token = await TokenManager.getToken();
final response = await http.get(
Uri.parse(apiUrl),
headers: {
'Authorization': 'Bearer $token',
'Content-Type': 'application/json',
},
);
if (response.statusCode == 401) {
LogoutService.logout();
}
if (response.statusCode <= 209) {
final List<dynamic> data = jsonDecode(response.body);
setState(() {
notifications = data.cast<Map<String, dynamic>>();
});
} else {
// Handle errors
print('Failed to fetch data');
}
}
@override
Widget build(BuildContext context) {
final userAuthKey = TokenManager.getToken().toString();
print('user auth key is .....' + userAuthKey);
List<Widget> screens = [
Padding(
padding: const EdgeInsets.all(10.0),
child: StaticChartsScreen(
userData: userData,
),
),
HomeDashboardScreen(
userData: userData,
),
// const SizedBox(height: 15),
Container(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Activity',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 16.0), // Adjust the spacing as needed
//ActivityList(), // This widget should contain the list of notifications
for (final notification in notifications)
NotificationItem(notification: notification),
],
),
),
)
];
return WillPopScope(
onWillPop: _onBackPress,
child: Scaffold(
key: _scaffoldKey,
appBar: AppBar(
backgroundColor: Colors.white,
toolbarHeight: 50,
leading: IconButton(
icon: const Icon(
Icons.circle_outlined,
color: Colors.black,
),
onPressed: () {}),
title: const Text(
"Authsec",
style: TextStyle(color: Colors.black),
),
actions: [
PopupMenuButton<String>(
icon: const Icon(
Icons.more_vert,
color: Colors.black,
),
onSelected: (String result) {
// Handle the selected option
print("Selected: $result");
},
itemBuilder: (BuildContext context) => [
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'Raise A Ticket',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RaisedTicketScreen(
userData: userData,
),
),
);
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'Profile Settings',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
// Closes the drawer
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ProfileSettingsScreen(userData: userData),
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'Change Password',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
// Closes the drawer
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ResetPasswordScreen(
userEmail: userData['email'],
userData: userData), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'DynamicForm',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
// Closes the drawer
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DynamicForm(), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'Setup Screen',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const SetupScreen(), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'BookMark',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
// Closes the drawer
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
bookmarks_entity_list_screen(), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'System Parameter',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SysParameter(), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'Addition Menu',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const QrBarCodeScreen(),
),
);
},
),
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'About',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutScreen(), //go to get all entity
),
);
// Add your logic for menu 2 here
},
),
// NEW MENU
PopupMenuItem<String>(
//value: 'Option 1',
child: Text(
'LogOut',
style: AppStyle.txtGilroySemiBold16,
),
onTap: () {
_logoutUser();
},
),
],
),
],
),
backgroundColor: const Color(0xfffefefe),
extendBodyBehindAppBar: true,
//bottomNavigationBar: AppFooter(),
body: screens.isEmpty
? const Text("Loading...")
: ListView.builder(
itemCount: screens.length,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) => screens[index],
),
),
);
}
Future<void> _logoutUser() async {
try {
SharedPreferences prefs = await SharedPreferences.getInstance();
// Remove 'userData' and 'isLoggedIn' from SharedPreferences
await prefs.remove('userData');
await prefs.remove('isLoggedIn');
String logouturl = "${ApiConstants.baseUrl}/token/logout";
var response = await http.get(Uri.parse(logouturl));
if (response.statusCode == 401) {
LogoutService.logout();
}
if (response.statusCode <= 209) {
// ignore: use_build_context_synchronously
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => const LoginScreen()),
(route) => false, // Remove all routes from the stack
);
} else {
const Text('failed to logout');
}
} catch (error) {
print('Error occurred during logout: $error');
}
}
Widget googleNavBar() {
return Container(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6.18, vertical: 1),
child: GNav(
haptic: false,
gap: 6,
activeColor: const Color(0xFF0070BA),
iconSize: 24,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 11),
duration: const Duration(milliseconds: 300),
color: const Color(0xFF243656),
tabs: [
GButton(
icon: FluentIcons.home_32_regular,
iconSize: 36,
text: 'Home',
onPressed: () {
print('home');
},
),
GButton(
icon: FluentIcons.people_32_regular,
iconSize: 36,
text: 'Contacts',
onPressed: () {
print('contacts');
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => AllContactsScreen(
// setTab: setTab,
// ),
// ),
// );
},
),
GButton(
icon: Icons.wallet,
text: 'Wallet',
iconSize: 34,
onPressed: () {
print('wallet');
},
),
],
selectedIndex: _currentTab,
onTabChange: _onTabChange,
),
),
);
}
void _onTabChange(int index) {
if (_currentTab == 1 || _currentTab == 2) {
FocusManager.instance.primaryFocus?.unfocus();
}
Provider.of<TabNavigationProvider>(context, listen: false)
.updateTabs(_currentTab);
setState(() {
_currentTab = index;
});
}
Future<bool> _onBackPress() {
if (_currentTab == 0) {
return Future.value(true);
} else {
int lastTab =
Provider.of<TabNavigationProvider>(context, listen: false).lastTab;
Provider.of<TabNavigationProvider>(context, listen: false)
.removeLastTab();
setTab(lastTab);
}
return Future.value(false);
}
}
class StaticChartsScreen extends StatefulWidget {
final Map<String, dynamic> userData;
const StaticChartsScreen({required this.userData, Key? key})
: super(key: key);
@override
_StaticChartsScreenState createState() => _StaticChartsScreenState();
}
class _StaticChartsScreenState extends State<StaticChartsScreen> {
int myProjectcount = 0;
int sharedWithMeCount = 0;
int allprojectCount = 0;
@override
void initState() {
super.initState();
fetchData();
}
Future<void> fetchData() async {
print("working");
final token = await TokenManager.getToken();
print(token);
String baseUrl = ApiConstants.baseUrl;
var myProjectcountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_myproject'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
var sharedWithMeCountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_sharedwithme'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
var allProjectsCountres = await http.get(
Uri.parse('$baseUrl/workspace/secworkspaceuser/count_allproject'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type':
'application/json', // You may need to adjust the content type as needed
},
);
if (myProjectcountres.statusCode == 401) {
LogoutService.logout();
}
print(myProjectcountres.statusCode);
if (myProjectcountres.statusCode <= 209 &&
sharedWithMeCountres.statusCode <= 209) {
final myProjectData = jsonDecode(myProjectcountres.body);
final sharedData = jsonDecode(sharedWithMeCountres.body);
final allData = jsonDecode(allProjectsCountres.body);
setState(() {
myProjectcount = myProjectData;
sharedWithMeCount = sharedData;
allprojectCount = allData;
});
} else {
// Handle errors
print('Failed to fetch data');
}
}
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "myproject"), // Get all projects
// ),
// );
print('test1');
},
child: Card(
color: Colors.white,
elevation: 5.0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Text(
myProjectcount.toString(),
style: const TextStyle(
color: Colors.black,
fontSize: 12,
),
),
const Text(
'Test1',
style: TextStyle(
color: Colors.black,
fontSize: 12,
),
),
],
),
),
),
),
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "sharedproject"), // Get all projects
// ),
// );
print('test2');
},
child: Card(
color: Colors.white,
elevation: 5.0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Text(
sharedWithMeCount.toString(),
style: const TextStyle(
fontSize: 12,
),
),
const Text(
'Test2',
style: TextStyle(
fontSize: 12,
),
),
],
),
),
),
),
GestureDetector(
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProjectListScreen(
// userData: widget.userData,
// type: "allproject"), // Get all projects
// ),
// );
print('test3');
},
child: Card(
color: Colors.white,
elevation: 5.0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Text(
allprojectCount.toString(),
style: const TextStyle(
fontSize: 12,
),
),
const Text(
'Test3',
style: TextStyle(
fontSize: 12,
),
),
],
),
),
),
),
],
);
}
}
class HomeDashboardScreen extends StatelessWidget {
final Map<String, dynamic> userData;
const HomeDashboardScreen({super.key, required this.userData});
@override
Widget build(BuildContext context) {
var firstName = userData['firstName'].toString();
return Container(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Card(
clipBehavior: Clip.antiAlias,
elevation: 0,
margin: getMargin(top: 5),
color: ColorConstant.whiteA70099,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusStyle.roundedBorder6),
child: Container(
height: getVerticalSize(224),
width:
MediaQuery.of(context).size.width, //getHorizontalSize(396),
// padding: getPadding(
// left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70026
.copyWith(borderRadius: BorderRadiusStyle.roundedBorder6),
child: Stack(alignment: Alignment.centerRight, children: [
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: getPadding(left: 1),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("08",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10),
Expanded(
child: Padding(
padding:
getPadding(top: 6, bottom: 5),
child: Divider(
height: getVerticalSize(1),
thickness: getVerticalSize(1),
color:
ColorConstant.blueGray400,
indent: getHorizontalSize(9))))
]),
Padding(
padding: getPadding(top: 28),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text("06",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10),
Expanded(
child: Padding(
padding: getPadding(
top: 6, bottom: 5),
child: Divider(
height: getVerticalSize(1),
thickness:
getVerticalSize(1),
color: ColorConstant
.blueGray400,
indent:
getHorizontalSize(9))))
])),
Padding(
padding: getPadding(top: 28),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text("04",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10),
Expanded(
child: Padding(
padding: getPadding(
top: 6, bottom: 5),
child: Divider(
height: getVerticalSize(1),
thickness:
getVerticalSize(1),
color: ColorConstant
.blueGray400,
indent:
getHorizontalSize(9))))
])),
Padding(
padding: getPadding(top: 28),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text("02",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10),
Expanded(
child: Padding(
padding: getPadding(
top: 6, bottom: 5),
child: Divider(
height: getVerticalSize(1),
thickness:
getVerticalSize(1),
color: ColorConstant
.blueGray400,
indent:
getHorizontalSize(10))))
])),
Padding(
padding: getPadding(top: 28),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text("00",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10),
Expanded(
child: Padding(
padding: getPadding(
top: 6, bottom: 5),
child: Divider(
height: getVerticalSize(1),
thickness:
getVerticalSize(1),
color: ColorConstant
.blueGray400,
indent:
getHorizontalSize(9))))
]))
]))),
Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
buildContainer(
height: 97,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(top: 45),
text: "08/21"),
buildContainer(
height: 138,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 23, top: 19),
text: "08/22"),
buildContainer(
height: 160,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 21, top: 5),
text: "08/23"),
buildContainer(
height: 83,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 21, top: 53),
text: "08/24"),
buildContainer(
height: 64,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 20, top: 65),
text: "08/25"),
buildContainer(
height: 126,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 21, top: 26),
text: "08/26"),
buildContainer(
height: 83,
width: MediaQuery.of(context).size.width * 0.016,
margin: const EdgeInsets.only(left: 22, top: 53),
text: "08/27"),
],
),
)
]))),
));
// );
}
Widget buildContainer(
{required double height,
required double width,
required EdgeInsets margin,
required String text}) {
return Container(
width: getHorizontalSize(width),
margin: margin,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: getVerticalSize(height),
decoration: BoxDecoration(
color: ColorConstant.blueA700,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(getHorizontalSize(4)),
topRight: Radius.circular(getHorizontalSize(4)),
),
),
),
Padding(
padding: getPadding(top: 9),
child: Text(
text,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium10,
),
),
],
),
);
}
}
class NotificationItem extends StatelessWidget {
final Map<String, dynamic> notification;
const NotificationItem({required this.notification});
@override
Widget build(BuildContext context) {
final notificationText = notification['notification'] as String;
final time = notification['time'] as String;
final timeDifference = calculateTimeDifference(time);
return ListTile(
title: Text(
notificationText,
style: TextStyle(fontSize: 12, color: Colors.grey[800]),
),
subtitle: Text(timeDifference),
);
}
String calculateTimeDifference(String time) {
final currentTime = DateTime.now();
final formatter = DateFormat('yyyy/MM/dd HH:mm:ss');
final notificationTime = formatter.parse(time);
final difference = currentTime.difference(notificationTime);
if (difference.inDays >= 365) {
final years = (difference.inDays / 365).floor();
return '${years} ${years == 1 ? 'year' : 'years'} ago';
} else if (difference.inDays >= 30) {
final months = (difference.inDays / 30).floor();
return '${months} ${months == 1 ? 'month' : 'months'} ago';
} else if (difference.inDays > 0) {
return '${difference.inDays} ${difference.inDays == 1 ? 'day' : 'days'} ago';
} else if (difference.inHours > 0) {
return '${difference.inHours} ${difference.inHours == 1 ? 'hour' : 'hours'} ago';
} else {
return 'Just now';
}
}
}