Skip to content

Conversation

@josefinalliende
Copy link
Collaborator

@josefinalliende josefinalliende commented Jan 23, 2026

Description

Setup widget book with colors story

widgetbook.mov

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore
  • 🧪 Tests

Checklist

  • Run just precommit to ensure that formatting and linting are correct
  • Updated the CHANGELOG.md file with your changes (if they affect the user experience)

Summary by CodeRabbit

  • New Features

    • Added Widgetbook integration for interactive component documentation and testing across iOS, Android, macOS, Windows, and Linux.
    • Introduced design system documentation featuring a color palette viewer and design resources.
    • Added URL launcher functionality for opening external links.
  • Chores

    • Updated Dart SDK constraint and added development dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Walkthrough

This PR establishes Widgetbook integration by creating a new Flutter module with platform-specific build configurations for Android, iOS, and macOS. It adds Widgetbook dependencies to the root manifest, integrates the url_launcher plugin across all platforms, and provides sample UI components for design documentation.

Changes

Cohort / File(s) Summary
Root Configuration Updates
.gitignore, justfile, pubspec.yaml, CHANGELOG.md
Added Widgetbook ignore patterns; introduced five new Justfile recipes (deps-widgetbook, generate-widgetbook, widgetbook-ios/android/macos) for dependency and story generation; bumped Dart SDK from ^3.9.2 to ^3.10.3 and added widgetbook, widgetbook_annotation, widgetbook_generator as dev dependencies
Plugin Registration - Linux & Windows
linux/flutter/generated_plugin_registrant.cc, linux/flutter/generated_plugins.cmake, windows/flutter/generated_plugin_registrant.cc, windows/flutter/generated_plugins.cmake
Registered UrlLauncherPlugin in generated plugin registrants and plugin lists for Linux and Windows platforms
Plugin Registration - macOS
macos/Flutter/GeneratedPluginRegistrant.swift
Added imports and plugin registration for UrlLauncherPlugin alongside existing plugins (FileSelectorPlugin, FlutterSecureStorageDarwinPlugin, SqflitePlugin)
Widgetbook Module - Root Configuration
widgetbook/.gitignore, widgetbook/.metadata, widgetbook/analysis_options.yaml, widgetbook/pubspec.yaml
Established new Widgetbook Flutter app module with standard configuration, Flutter lints setup, and project metadata; pubspec declares flutter, sloth (local dependency), widgetbook packages, url_launcher, and flutter_screenutil
Widgetbook Module - Android Platform
widgetbook/android/ (including build.gradle.kts, AndroidManifest.xml files, MainActivity.kt, drawable resources, styles.xml, gradle configuration files)
Complete Android app setup with Kotlin DSL Gradle configuration, app manifest with INTERNET permissions, Flutter MainActivity implementation, drawable launch backgrounds, light/dark theme styles, and Gradle wrapper/properties configuration
Widgetbook Module - iOS Platform
widgetbook/ios/ (including Podfile, Runner.xcodeproj/project.pbxproj, AppDelegate.swift, storyboards, Info.plist, asset catalogs, xcconfig/xcworkspace files)
Full iOS app setup with CocoaPods Podfile, complete Xcode project structure (Runner and RunnerTests targets), launch/main storyboards, app icon assets, debug/release build configurations, and workspace organization
Widgetbook Module - macOS Platform
widgetbook/macos/ (including Podfile, Runner.xcodeproj/project.pbxproj, AppDelegate.swift, MainFlutterWindow.swift, MainMenu.xib, entitlements, xcconfig/xcworkspace files)
Complete macOS app setup with CocoaPods Podfile, Xcode project file (Flutter Assemble aggregate target, Runner and RunnerTests targets), app delegate lifecycle management, main menu interface builder file, debug/release entitlements, and build configurations
Widgetbook Module - Dart UI Components
widgetbook/lib/main.dart, widgetbook/lib/main.directories.g.dart, widgetbook/lib/foundations/colors.dart, widgetbook/lib/introduction.dart
Implemented Widgetbook app entry point with theme/viewport configuration, generated directories mapping, comprehensive semantic color palette viewer with light/dark swatches organized by category, and introduction page with resource links (Foundations, Components, Design, Docs)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Suggested reviewers

  • untreu2
  • erskingardner
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'Feat/widgetbook' is vague and generic, using a feature branch naming convention rather than a clear, descriptive summary of the main changes. Rewrite the title to be more specific and descriptive, such as 'Set up Widgetbook integration and add color palette story' to clearly communicate the main changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 12

🤖 Fix all issues with AI agents
In `@test/hooks/use_message_menu_test.dart`:
- Around line 1-3: Tests import use_message_menu.dart but the hook
implementation is missing; create lib/hooks/use_message_menu.dart and implement
the exported symbols toggleEmojiPicker(), closeEmojiPicker(), and the
showEmojiPicker property (e.g., as a boolean state exposed by the hook) so tests
can run; ensure the hook initializes showEmojiPicker to false, toggles its value
in toggleEmojiPicker(), and sets it false in closeEmojiPicker(), and export the
hook API with the exact names used in the tests (toggleEmojiPicker,
closeEmojiPicker, showEmojiPicker).

In `@widgetbook/analysis_options.yaml`:
- Around line 23-25: The lint rules block in analysis_options.yaml is missing
repository-standard rules; add explicit entries for prefer_const_constructors
and prefer_final_locals under the existing rules: set prefer_const_constructors:
true and prefer_final_locals: true so the analyzer enforces these Dart/Flutter
conventions consistently with the main project (modify the rules mapping shown
in the file where the commented rules live).

In `@widgetbook/android/app/src/main/AndroidManifest.xml`:
- Around line 2-5: Replace the hardcoded android:label in the <application> tag
with a string resource reference (use android:label="@string/app_name") and add
the corresponding app_name entry in res/values/strings.xml; update the
manifest's android:label attribute (android:label="@string/app_name") and create
or modify strings.xml to include <string name="app_name">YourAppName</string> so
the label is localizable and reusable.

In `@widgetbook/android/gradle.properties`:
- Around line 1-2: The repo-wide gradle JVM settings in org.gradle.jvmargs
currently force high memory (e.g., -Xmx8G and -XX:MaxMetaspaceSize=4G) which can
break CI or low-RAM dev machines; change widgetbook/android/gradle.properties to
use conservative defaults (for example -Xmx2G and remove or lower
MaxMetaspaceSize/ReservedCodeCacheSize) and add a comment advising developers to
set higher values in their local ~/.gradle/gradle.properties if needed, ensuring
org.gradle.jvmargs remains overrideable by local gradle configuration.

In `@widgetbook/ios/Podfile`:
- Line 33: Replace the call to File.dirname(File.realpath(__FILE__)) used as the
argument to flutter_install_all_ios_pods with the Ruby built-in __dir__ to get
the current file directory; update the invocation of
flutter_install_all_ios_pods (the line containing flutter_install_all_ios_pods
and File.dirname(File.realpath(__FILE__))) so it passes __dir__ instead, keeping
the same behavior but following RuboCop's Style/Dir and more idiomatic Ruby.

In `@widgetbook/ios/Runner.xcodeproj/project.pbxproj`:
- Around line 474-475: The project file currently hard-codes DEVELOPMENT_TEAM =
NQ6ZND3746 in the Runner build configurations; remove that literal team ID from
the Runner build configs and either (a) delete the DEVELOPMENT_TEAM entries from
project.pbxproj so signing is resolved via each developer's/user .xcconfig or
CI, or (b) replace the literal with a placeholder/variable (e.g.
DEVELOPMENT_TEAM = $(DEVELOPMENT_TEAM)) and add the real value in a
user-specific .xcconfig or CI build settings; make the same change for every
Runner build config where DEVELOPMENT_TEAM appears.

In `@widgetbook/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md`:
- Around line 1-5: Add a single trailing newline to the Markdown file README.md
in LaunchImage.imageset to satisfy markdownlint rule MD047; simply open the
README.md and ensure the file ends with a newline character (no other content
changes).

In `@widgetbook/lib/main.directories.g.dart`:
- Around line 13-14: The generated import
package:sloth_widgetbook/stories/colors.dart fails because the root pubspec.yaml
is missing a path dependency for the local package named sloth_widgetbook; fix
this by adding sloth_widgetbook as a dependency that points to the widgetbook
directory (i.e., under dependencies add sloth_widgetbook with path: widgetbook)
so the import in main.directories.g.dart can be resolved by the generator.

In `@widgetbook/lib/stories/colors.dart`:
- Around line 200-224: The build fails because SemanticColors is missing the
getters borderInfo, borderSuccess, and borderWarning which are referenced by
light.borderInfo, light.borderSuccess, and light.borderWarning in the
_ColorPairItem instances inside colors.dart; fix it by either adding these
getters to the SemanticColors class (in lib/theme.dart) with the correct return
type (e.g., Color) and sensible default/derived values, or remove/comment out
the three _ColorPairItem blocks (semanticName 'Border Info', 'Border Success',
'Border Warning') in widgetbook/lib/stories/colors.dart so the code no longer
references the non-existent properties.

In `@widgetbook/macos/Podfile`:
- Around line 29-36: Replace the long path expression used when invoking
flutter_install_all_macos_pods in the Runner target: locate the call
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) and replace
the File.dirname(File.realpath(__FILE__)) argument with the Ruby idiom __dir__
to simplify path resolution while preserving behavior.

In `@widgetbook/macos/Runner/Configs/AppInfo.xcconfig`:
- Around line 8-12: Replace the placeholder bundle identifier in the macOS app
config: update the PRODUCT_BUNDLE_IDENTIFIER value (currently
"com.example.slothWidgetbook") to your app's real reverse‑DNS identifier that
matches your team/app ID and provisioning profile; ensure PRODUCT_NAME
(sloth_widgetbook) and signing settings remain consistent with the new bundle
identifier to avoid provisioning/signing collisions.

In `@widgetbook/pubspec.yaml`:
- Around line 5-7: The environment SDK constraints in the pubspec's environment
block are incompatible with the specified Flutter version; update the Dart SDK
constraint under the environment keys (sdk: ...) to match Flutter 3.38.4+ by
changing the Dart constraint to ^3.10.0 (or alternatively downgrade the flutter
constraint to a 3.35.x series if you must stay on Dart 3.9.2) so the sdk and
flutter entries are consistent.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@justfile`:
- Around line 165-171: Update the widgetbook run targets to avoid fuzzy device
matching: in the justfile entries for widgetbook-ios and widgetbook-android
(currently invoking flutter run -d iphone and flutter run -d android), replace
the device flags with -d ios for iOS simulators and keep -d android for Android
but add a short comment/documentation noting users may need to supply a specific
device ID when multiple devices are available (e.g., via flutter devices and
flutter run -d <device-id>); ensure the targets named widgetbook-ios and
widgetbook-android reflect these changes.

In `@widgetbook/android/settings.gradle.kts`:
- Around line 1-26: The pluginManagement block's run lambda uses
file("local.properties").inputStream() which will throw if the file is missing,
bypassing the intended require message; update the val flutterSdkPath
initialization (the run block that defines flutterSdkPath used by
includeBuild("$flutterSdkPath/...")) to first check
file("local.properties").exists() and throw/require with a clear message if
absent, then load properties and require that
properties.getProperty("flutter.sdk") is non-null; this ensures a deterministic,
human-friendly error in CI/local environments.

In `@widgetbook/lib/introduction.dart`:
- Around line 105-110: The _launchUrl function silently does nothing when
canLaunchUrl(uri) is false; update _launchUrl to handle this case by logging or
showing feedback: after computing uri and before/after canLaunchUrl call, add a
debugPrint (or ScaffoldMessenger.showSnackBar in UI contexts) that reports the
attempted URL and the failure to launch so developers see why nothing happened;
keep existing launchUrl call (with LaunchMode.externalApplication) unchanged and
only add the failure logging/feedback path tied to the canLaunchUrl check.
- Around line 55-83: The _ResourceCard widget instances should be created with
const to satisfy prefer_const_constructors; update each instantiation of
_ResourceCard (the four places with titles 'Foundations', 'Application
Components', 'Application Design', 'Widgetbook Docs') to use const
_ResourceCard(...) since _ResourceCard has a const constructor and all arguments
are compile-time constants.
♻️ Duplicate comments (4)
widgetbook/android/gradle.properties (1)

1-2: Duplicate: JVM args sizing already discussed on this file.

widgetbook/analysis_options.yaml (1)

12-25: Enable repo-standard Dart lints here.

Repository guidelines enforce prefer_const_constructors and prefer_final_locals; please add them under rules: for consistency. Based on learnings.

♻️ Proposed addition
   rules:
     # avoid_print: false  # Uncomment to disable the `avoid_print` rule
     # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule
+    prefer_const_constructors: true
+    prefer_final_locals: true
widgetbook/macos/Podfile (1)

1-42: LGTM!

Standard Flutter macOS Podfile configuration. The flutter_root helper, project configurations, and post_install hook are all correctly set up per Flutter's template.

widgetbook/ios/Podfile (1)

1-43: Standard Flutter iOS Podfile - LGTM.

This is a Flutter-generated Podfile with standard configuration for iOS. The structure follows Flutter's recommended pattern for CocoaPods integration.

Note: The RuboCop Style/Dir suggestion on line 33 regarding __dir__ was previously discussed and deferred since this file is autogenerated by Flutter.

Comment on lines +165 to +171
widgetbook-ios: deps-widgetbook generate-widgetbook
@echo "📖 Running Widgetbook on iOS Simulator..."
cd widgetbook && flutter run -d iphone

widgetbook-android: deps-widgetbook generate-widgetbook
@echo "📖 Running Widgetbook on Android Emulator..."
cd widgetbook && flutter run -d android
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider using more explicit device targets.

The device targets -d iphone and -d android rely on fuzzy matching. For more predictable behavior:

  • Use -d ios to target iOS simulators more reliably
  • Consider documenting that users may need to specify a specific device ID if multiple are available

This is minor since the current approach works in typical single-device scenarios.

♻️ Suggested improvement
 widgetbook-ios: deps-widgetbook generate-widgetbook
     `@echo` "📖 Running Widgetbook on iOS Simulator..."
-    cd widgetbook && flutter run -d iphone
+    cd widgetbook && flutter run -d ios

 widgetbook-android: deps-widgetbook generate-widgetbook
     `@echo` "📖 Running Widgetbook on Android Emulator..."
-    cd widgetbook && flutter run -d android
+    cd widgetbook && flutter run -d emulator
📝 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
widgetbook-ios: deps-widgetbook generate-widgetbook
@echo "📖 Running Widgetbook on iOS Simulator..."
cd widgetbook && flutter run -d iphone
widgetbook-android: deps-widgetbook generate-widgetbook
@echo "📖 Running Widgetbook on Android Emulator..."
cd widgetbook && flutter run -d android
widgetbook-ios: deps-widgetbook generate-widgetbook
`@echo` "📖 Running Widgetbook on iOS Simulator..."
cd widgetbook && flutter run -d ios
widgetbook-android: deps-widgetbook generate-widgetbook
`@echo` "📖 Running Widgetbook on Android Emulator..."
cd widgetbook && flutter run -d emulator
🤖 Prompt for AI Agents
In `@justfile` around lines 165 - 171, Update the widgetbook run targets to avoid
fuzzy device matching: in the justfile entries for widgetbook-ios and
widgetbook-android (currently invoking flutter run -d iphone and flutter run -d
android), replace the device flags with -d ios for iOS simulators and keep -d
android for Android but add a short comment/documentation noting users may need
to supply a specific device ID when multiple devices are available (e.g., via
flutter devices and flutter run -d <device-id>); ensure the targets named
widgetbook-ios and widgetbook-android reflect these changes.

Comment on lines +1 to +26
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}

include(":app")
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

Guard missing local.properties to surface a clear error.

inputStream() will throw if the file is absent, so the intended require message is never shown. Add an existence check before loading to make failure deterministic and clearer for CI/local setups.

✅ Suggested fix
     val flutterSdkPath =
         run {
             val properties = java.util.Properties()
-            file("local.properties").inputStream().use { properties.load(it) }
+            val localPropertiesFile = file("local.properties")
+            require(localPropertiesFile.exists()) {
+                "local.properties not found. Please set flutter.sdk"
+            }
+            localPropertiesFile.inputStream().use { properties.load(it) }
             val flutterSdkPath = properties.getProperty("flutter.sdk")
-            require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
+            require(!flutterSdkPath.isNullOrBlank()) {
+                "flutter.sdk not set in local.properties"
+            }
             flutterSdkPath
         }
📝 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
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
val localPropertiesFile = file("local.properties")
require(localPropertiesFile.exists()) {
"local.properties not found. Please set flutter.sdk"
}
localPropertiesFile.inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(!flutterSdkPath.isNullOrBlank()) {
"flutter.sdk not set in local.properties"
}
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")
🤖 Prompt for AI Agents
In `@widgetbook/android/settings.gradle.kts` around lines 1 - 26, The
pluginManagement block's run lambda uses file("local.properties").inputStream()
which will throw if the file is missing, bypassing the intended require message;
update the val flutterSdkPath initialization (the run block that defines
flutterSdkPath used by includeBuild("$flutterSdkPath/...")) to first check
file("local.properties").exists() and throw/require with a clear message if
absent, then load properties and require that
properties.getProperty("flutter.sdk") is non-null; this ensures a deterministic,
human-friendly error in CI/local environments.

Comment on lines +55 to +83
_ResourceCard(
title: 'Foundations',
description:
'Colors, typography, icons, and other design basics',
url:
'https://www.figma.com/design/CUEbUyUPJhdH8VRrL7JzWl/00.-Foundations',
icon: Icons.palette_outlined,
),
_ResourceCard(
title: 'Application Components',
description: 'Reusable application components',
url:
'https://www.figma.com/design/J9pCZpUhcm0MRs7dFX7LTN/01.-Application-Components',
icon: Icons.widgets_outlined,
),
_ResourceCard(
title: 'Application Design',
description: 'Full application screens and user flows',
url:
'https://www.figma.com/design/Y12t1SzBbrQ9Q4UTNBSoEs/02.-Application-Design',
icon: Icons.phone_android_outlined,
),
_ResourceCard(
title: 'Widgetbook Docs',
description: 'Learn how to use and extend this catalog',
url: 'https://docs.widgetbook.io',
icon: Icons.menu_book_outlined,
),
],
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add const to _ResourceCard instances.

Per coding guidelines (prefer_const_constructors), these widget instantiations should be const since _ResourceCard has a const constructor and all arguments are compile-time constants.

♻️ Proposed fix
             Wrap(
               spacing: 16,
               runSpacing: 16,
               children: [
-                _ResourceCard(
+                const _ResourceCard(
                   title: 'Foundations',
                   description:
                       'Colors, typography, icons, and other design basics',
                   url:
                       'https://www.figma.com/design/CUEbUyUPJhdH8VRrL7JzWl/00.-Foundations',
                   icon: Icons.palette_outlined,
                 ),
-                _ResourceCard(
+                const _ResourceCard(
                   title: 'Application Components',
                   description: 'Reusable application components',
                   url:
                       'https://www.figma.com/design/J9pCZpUhcm0MRs7dFX7LTN/01.-Application-Components',
                   icon: Icons.widgets_outlined,
                 ),
-                _ResourceCard(
+                const _ResourceCard(
                   title: 'Application Design',
                   description: 'Full application screens and user flows',
                   url:
                       'https://www.figma.com/design/Y12t1SzBbrQ9Q4UTNBSoEs/02.-Application-Design',
                   icon: Icons.phone_android_outlined,
                 ),
-                _ResourceCard(
+                const _ResourceCard(
                   title: 'Widgetbook Docs',
                   description: 'Learn how to use and extend this catalog',
                   url: 'https://docs.widgetbook.io',
                   icon: Icons.menu_book_outlined,
                 ),
               ],
             ),
📝 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
_ResourceCard(
title: 'Foundations',
description:
'Colors, typography, icons, and other design basics',
url:
'https://www.figma.com/design/CUEbUyUPJhdH8VRrL7JzWl/00.-Foundations',
icon: Icons.palette_outlined,
),
_ResourceCard(
title: 'Application Components',
description: 'Reusable application components',
url:
'https://www.figma.com/design/J9pCZpUhcm0MRs7dFX7LTN/01.-Application-Components',
icon: Icons.widgets_outlined,
),
_ResourceCard(
title: 'Application Design',
description: 'Full application screens and user flows',
url:
'https://www.figma.com/design/Y12t1SzBbrQ9Q4UTNBSoEs/02.-Application-Design',
icon: Icons.phone_android_outlined,
),
_ResourceCard(
title: 'Widgetbook Docs',
description: 'Learn how to use and extend this catalog',
url: 'https://docs.widgetbook.io',
icon: Icons.menu_book_outlined,
),
],
const _ResourceCard(
title: 'Foundations',
description:
'Colors, typography, icons, and other design basics',
url:
'https://www.figma.com/design/CUEbUyUPJhdH8VRrL7JzWl/00.-Foundations',
icon: Icons.palette_outlined,
),
const _ResourceCard(
title: 'Application Components',
description: 'Reusable application components',
url:
'https://www.figma.com/design/J9pCZpUhcm0MRs7dFX7LTN/01.-Application-Components',
icon: Icons.widgets_outlined,
),
const _ResourceCard(
title: 'Application Design',
description: 'Full application screens and user flows',
url:
'https://www.figma.com/design/Y12t1SzBbrQ9Q4UTNBSoEs/02.-Application-Design',
icon: Icons.phone_android_outlined,
),
const _ResourceCard(
title: 'Widgetbook Docs',
description: 'Learn how to use and extend this catalog',
url: 'https://docs.widgetbook.io',
icon: Icons.menu_book_outlined,
),
],
🤖 Prompt for AI Agents
In `@widgetbook/lib/introduction.dart` around lines 55 - 83, The _ResourceCard
widget instances should be created with const to satisfy
prefer_const_constructors; update each instantiation of _ResourceCard (the four
places with titles 'Foundations', 'Application Components', 'Application
Design', 'Widgetbook Docs') to use const _ResourceCard(...) since _ResourceCard
has a const constructor and all arguments are compile-time constants.

Comment on lines +105 to +110
Future<void> _launchUrl() async {
final uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
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

Silent failure when URL cannot be launched.

If canLaunchUrl returns false, the user receives no feedback. Consider showing a snackbar or logging for debugging purposes.

💡 Proposed fix
   Future<void> _launchUrl() async {
     final uri = Uri.parse(url);
     if (await canLaunchUrl(uri)) {
       await launchUrl(uri, mode: LaunchMode.externalApplication);
+    } else {
+      debugPrint('Could not launch $url');
     }
   }

Note: Since this is a Widgetbook catalog (dev tooling), a debugPrint may suffice. For production code, user-visible feedback would be more appropriate.

📝 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
Future<void> _launchUrl() async {
final uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
Future<void> _launchUrl() async {
final uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
} else {
debugPrint('Could not launch $url');
}
}
🤖 Prompt for AI Agents
In `@widgetbook/lib/introduction.dart` around lines 105 - 110, The _launchUrl
function silently does nothing when canLaunchUrl(uri) is false; update
_launchUrl to handle this case by logging or showing feedback: after computing
uri and before/after canLaunchUrl call, add a debugPrint (or
ScaffoldMessenger.showSnackBar in UI contexts) that reports the attempted URL
and the failure to launch so developers see why nothing happened; keep existing
launchUrl call (with LaunchMode.externalApplication) unchanged and only add the
failure logging/feedback path tied to the canLaunchUrl check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants