Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 75 additions & 60 deletions lib/widgets/custom_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CustomTextField extends StatelessWidget {
final String? Function(String?)? validator;
final Function(String)? onChanged;
final bool enabled;

final String? label;
final IconData? icon;
final bool? isPassword;
Expand All @@ -37,7 +37,7 @@ class CustomTextField extends StatelessWidget {
final String effectiveHintText = label ?? hintText;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused variable effectiveHintText.

This variable is computed but no longer used after the change on line 50 switched from effectiveHintText to hintText. This is now dead code.

Suggested fix
 `@override`
 Widget build(BuildContext context) {
-  final String effectiveHintText = label ?? hintText;
   final IconData? effectivePrefixIcon = icon ?? prefixIcon;
   final bool effectiveObscureText = isPassword ?? obscureText;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
final String effectiveHintText = label ?? hintText;
`@override`
Widget build(BuildContext context) {
final IconData? effectivePrefixIcon = icon ?? prefixIcon;
final bool effectiveObscureText = isPassword ?? obscureText;
🤖 Prompt for AI Agents
In `@lib/widgets/custom_widgets.dart` at line 37, Remove the dead local variable
effectiveHintText which is computed as "label ?? hintText" but never used;
update the containing function (where effectiveHintText is declared alongside
label and hintText) by deleting the line "final String effectiveHintText = label
?? hintText" and leaving usages to reference hintText (as already changed on
line 50), ensuring no other references to effectiveHintText remain.

final IconData? effectivePrefixIcon = icon ?? prefixIcon;
final bool effectiveObscureText = isPassword ?? obscureText;

return TextFormField(
controller: controller,
obscureText: effectiveObscureText,
Expand All @@ -47,8 +47,9 @@ class CustomTextField extends StatelessWidget {
enabled: enabled,
style: const TextStyle(color: Colors.white),
decoration: InputDecoration(
hintText: effectiveHintText,
hintText: hintText,
labelText: label,
floatingLabelBehavior: FloatingLabelBehavior.auto,
labelStyle: const TextStyle(color: Colors.grey),
hintStyle: const TextStyle(color: Colors.grey),
prefixIcon: effectivePrefixIcon != null
Expand Down Expand Up @@ -104,29 +105,27 @@ class CustomButton extends StatelessWidget {
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side:
isOutlined
? BorderSide(color: Colors.green.shade400)
: BorderSide.none,
side: isOutlined
? BorderSide(color: Colors.green.shade400)
: BorderSide.none,
),
),
child:
isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: Text(
text,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
child: isLoading
? const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
: Text(
text,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
);
}
Expand Down Expand Up @@ -255,7 +254,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
),
const SizedBox(height: 16),

// Main content
Expanded(
child: SingleChildScrollView(
Expand All @@ -265,8 +264,9 @@ class DashboardLoadingSkeleton extends StatelessWidget {
children: [
// Stats row
Row(
children: List.generate(3, (index) =>
Expanded(
children: List.generate(
3,
(index) => Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: _buildStatCard(),
Expand All @@ -275,7 +275,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
),
const SizedBox(height: 24),

// Tasks section
const Text(
'Recent Tasks',
Expand All @@ -287,9 +287,9 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
const SizedBox(height: 12),
...List.generate(3, (index) => _buildTaskItem()),

const SizedBox(height: 24),

// Calendar section
const Text(
'Upcoming Events',
Expand All @@ -301,9 +301,9 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
const SizedBox(height: 12),
_buildCalendarWidget(),

const SizedBox(height: 24),

// Activity section
const Text(
'Team Activity',
Expand All @@ -323,7 +323,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildStatCard() {
return Container(
height: 80,
Expand Down Expand Up @@ -357,7 +357,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildTaskItem() {
return Container(
margin: const EdgeInsets.only(bottom: 12),
Expand Down Expand Up @@ -418,7 +418,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildCalendarWidget() {
return Container(
height: 200,
Expand All @@ -442,9 +442,11 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
Row(
children: [
Icon(Icons.arrow_back_ios, size: 14, color: Colors.grey.shade400),
Icon(Icons.arrow_back_ios,
size: 14, color: Colors.grey.shade400),
const SizedBox(width: 16),
Icon(Icons.arrow_forward_ios, size: 14, color: Colors.grey.shade400),
Icon(Icons.arrow_forward_ios,
size: 14, color: Colors.grey.shade400),
],
),
],
Expand Down Expand Up @@ -511,7 +513,7 @@ class DashboardLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildActivityItem() {
return Container(
margin: const EdgeInsets.only(bottom: 12),
Expand Down Expand Up @@ -601,7 +603,8 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.green.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
Expand All @@ -625,7 +628,8 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
const SizedBox(height: 16),
// Search bar
Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: const Color(0xFF1A1A1A),
borderRadius: BorderRadius.circular(12),
Expand All @@ -647,7 +651,7 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
),
),
const SizedBox(height: 16),

// Tabs
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
Expand All @@ -660,7 +664,7 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
),
),
const SizedBox(height: 16),

// Content
Expanded(
child: ListView.builder(
Expand All @@ -675,14 +679,16 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildTab(String title, bool isSelected) {
return Expanded(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12),
margin: const EdgeInsets.symmetric(horizontal: 4),
decoration: BoxDecoration(
color: isSelected ? Colors.green.withOpacity(0.2) : const Color(0xFF2D2D2D),
color: isSelected
? Colors.green.withOpacity(0.2)
: const Color(0xFF2D2D2D),
borderRadius: BorderRadius.circular(12),
),
alignment: Alignment.center,
Expand All @@ -696,7 +702,7 @@ class WorkspaceLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildWorkspaceItem() {
return Container(
margin: const EdgeInsets.only(bottom: 12),
Expand Down Expand Up @@ -830,7 +836,8 @@ class CalendarLoadingSkeleton extends StatelessWidget {
color: const Color(0xFF1A1A1A),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(Icons.arrow_back, size: 16, color: Colors.white),
child: const Icon(Icons.arrow_back,
size: 16, color: Colors.white),
),
const SizedBox(width: 8),
Container(
Expand All @@ -839,14 +846,15 @@ class CalendarLoadingSkeleton extends StatelessWidget {
color: const Color(0xFF1A1A1A),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(Icons.arrow_forward, size: 16, color: Colors.white),
child: const Icon(Icons.arrow_forward,
size: 16, color: Colors.white),
),
],
),
],
),
const SizedBox(height: 16),

// Weekday headers
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
Expand All @@ -861,7 +869,7 @@ class CalendarLoadingSkeleton extends StatelessWidget {
],
),
const SizedBox(height: 8),

// Calendar grid (4 weeks)
for (int week = 0; week < 4; week++)
Padding(
Expand All @@ -872,22 +880,27 @@ class CalendarLoadingSkeleton extends StatelessWidget {
// Highlight a random day to simulate selected day
final isSelected = week == 1 && day == 3;
final hasEvents = (week + day) % 3 == 0;

return Column(
children: [
Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: isSelected ? Colors.green.withOpacity(0.2) : Colors.transparent,
color: isSelected
? Colors.green.withOpacity(0.2)
: Colors.transparent,
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: Text(
'${week * 7 + day + 1}',
style: TextStyle(
color: isSelected ? Colors.green : Colors.white,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
color:
isSelected ? Colors.green : Colors.white,
fontWeight: isSelected
? FontWeight.bold
: FontWeight.normal,
),
),
),
Expand All @@ -909,7 +922,7 @@ class CalendarLoadingSkeleton extends StatelessWidget {
],
),
),

// Time scale and events
Expanded(
child: ListView.builder(
Expand All @@ -918,7 +931,7 @@ class CalendarLoadingSkeleton extends StatelessWidget {
itemBuilder: (context, index) {
final hour = 9 + index;
final hasEvent = index % 2 == 0;

return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -930,12 +943,14 @@ class CalendarLoadingSkeleton extends StatelessWidget {
style: const TextStyle(color: Colors.white70),
),
),

// Event container
Expanded(
child: Container(
margin: const EdgeInsets.only(bottom: 16, left: 8),
child: hasEvent ? _buildEventItem() : const SizedBox(height: 40),
child: hasEvent
? _buildEventItem()
: const SizedBox(height: 40),
),
),
],
Expand All @@ -947,14 +962,14 @@ class CalendarLoadingSkeleton extends StatelessWidget {
),
);
}

Widget _buildEventItem() {
final eventTypes = ['Meeting', 'Task', 'Ticket'];
final eventType = eventTypes[Random().nextInt(eventTypes.length)];

Color eventColor;
IconData eventIcon;

switch (eventType) {
case 'Meeting':
eventColor = Colors.blue;
Expand All @@ -968,7 +983,7 @@ class CalendarLoadingSkeleton extends StatelessWidget {
eventColor = Colors.orange;
eventIcon = Icons.confirmation_number;
}

return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
Expand Down