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
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
),
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Reset to Default Button
Expanded(
child: TextButton(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
tColors.secondaryBackgroundColor!,
child: OutlinedButton.icon(
style: OutlinedButton.styleFrom(
side: BorderSide(color: tColors.purpleShade!),
shape: RoundedRectangleBorder(
Comment on lines +60 to +63
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid force-unwrapping purpleShade in button styling.

Line 62 uses tColors.purpleShade!; this can throw if the theme extension ever provides null. Use a fallback and apply it consistently to Line 173, Line 184, and Line 197.

Suggested fix
-                      side: BorderSide(color: tColors.purpleShade!),
+                      side: BorderSide(
+                        color: tColors.purpleShade ?? Theme.of(context).colorScheme.primary,
+                      ),
...
-                    icon: Icon(Icons.restore, color: tColors.purpleShade, size: 20),
+                    icon: Icon(
+                      Icons.restore,
+                      color: tColors.purpleShade ?? Theme.of(context).colorScheme.primary,
+                      size: 20,
+                    ),
...
-                        color: tColors.purpleShade,
+                        color: tColors.purpleShade ?? Theme.of(context).colorScheme.primary,
...
-                      backgroundColor: tColors.purpleShade,
+                      backgroundColor:
+                          tColors.purpleShade ?? Theme.of(context).colorScheme.primary,

Also applies to: 173-174, 184-184, 197-197

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/app/modules/settings/views/settings_page_select_directory_list_tile.dart`
around lines 60 - 63, Replace the force-unwrapped tColors.purpleShade! with a
safe fallback and apply it consistently where button styling uses it (the
OutlinedButton.styleFrom BorderSide and any other places that reference
tColors.purpleShade at the OutlinedButton.icon and the instances around the
other usages). Create a local variable (e.g., final buttonPurple =
tColors.purpleShade ?? fallbackColor) or use the null-coalescing expression
inline, and use that variable in the BorderSide color and in any text/icon color
or style references found in the widget class (the OutlinedButton.icon styling
and the other occurrences near the same widget) so no code path can throw if
purpleShade is null.

borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(vertical: 12),
),
onPressed: () async {
if (await controller.getBaseDirectory() == "Default") {
Expand Down Expand Up @@ -169,7 +170,8 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
);
}
},
child: Text(
icon: Icon(Icons.restore, color: tColors.purpleShade, size: 20),
label: Text(
SentenceManager(
currentLanguage:
controller.selectedLanguage.value)
Expand All @@ -178,24 +180,31 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
textAlign: TextAlign.center,
softWrap: true,
maxLines: 2,
style: TextStyle(
style: GoogleFonts.poppins(
color: tColors.purpleShade,
fontSize: TaskWarriorFonts.fontSizeSmall,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(width: 10),
const SizedBox(width: 12),

// Change Directory Button
Expanded(
child: TextButton(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
tColors.secondaryBackgroundColor!,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: tColors.purpleShade,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(vertical: 12),
elevation: 2,
),
onPressed: () => controller.pickDirectory(context),
child: Text(
icon: const Icon(Icons.folder_open, size: 20),
label: Text(
SentenceManager(
currentLanguage:
controller.selectedLanguage.value)
Expand All @@ -205,7 +214,11 @@ class SettingsPageSelectDirectoryListTile extends StatelessWidget {
softWrap: true,
maxLines: 2,
overflow: TextOverflow.visible,
style: TextStyle(color: tColors.purpleShade),
style: GoogleFonts.poppins(
color: Colors.white,
fontSize: TaskWarriorFonts.fontSizeSmall,
fontWeight: FontWeight.w600,
),
),
),
),
Expand Down