-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCust_Dashboard.ps1
More file actions
153 lines (143 loc) · 4.38 KB
/
Cust_Dashboard.ps1
File metadata and controls
153 lines (143 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class CustDashboard extends StatefulWidget {
const CustDashboard({super.key});
@override
State<CustDashboard> createState() => _CustDashboardState();
}
class _CustDashboardState extends State<CustDashboard> {
@override
Widget build(BuildContext context){
return PopScope(
canPop: false,
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text(
'Customer Dashboard',
style: GoogleFonts.montserrat(
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
actions: [
IconButton(
tooltip: 'Logout',
icon: Icon(Icons.logout),
onPressed: (){},
),
],
),
body: Center(
child: LayoutBuilder(
builder: (context, constraints){
final w = constraints.maxWidth;
// SET RESPONSIVENESS
int cols;
double maxW;
if(w >= 1200){
// DESKTOP SIZE
cols = 3;
maxW = 1000;
} else if (w >= 800){
// LARGE TABLET
cols = 3;
maxW = 900;
} else if (w >= 600){
// TABLET SIZE
cols = 2;
maxW = 650;
} else {
// PHONE SIZE
cols = 1;
maxW = 420;
}
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 24,
),
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxW),
child: GridView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: cols,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
childAspectRatio: 1.2,
),
children: [
_DashBoardCard(
icon: Icons.receipt_long,
title: 'Order History',
subtitle: 'See your past orders',
),
_DashBoardCard(
icon: Icons.storefront,
title: 'Browse Products',
subtitle: 'Explore our product catalog',
),
_DashBoardCard(
icon: Icons.person,
title: 'Profile',
subtitle: 'View and edit your profile',
),
],
),
),
);
}
),
),
),
);
}
}
// CARD FOR CUSTOMER DASHBOARD
class _DashBoardCard extends StatelessWidget {
final IconData icon;
final String title;
final String subtitle;
// THIS IS HOW TO MAKE A CARD AND PASS THE DATA FROM MAIN TO THE CARD CLASS
const _DashBoardCard({
required this.icon,
required this.title,
required this.subtitle,
});
@override
Widget build(BuildContext context){
final isDark = Theme.of(context).brightness == Brightness.dark;
return Card(
elevation: 2,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)
),
child: InkWell(
onTap: (){},
hoverColor: isDark ? Colors.white10 : Colors.black12,
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 46),
const SizedBox(height: 14,),
Text(
subtitle,
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.bodySmall?.color,
),
),
],
),
),
),
);
}
}