-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/widgetbook #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feat/widgetbook #82
Conversation
WalkthroughThis 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this 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.
10ebf56 to
6c2eab4
Compare
There was a problem hiding this 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_constructorsandprefer_final_locals; please add them underrules: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: truewidgetbook/macos/Podfile (1)
1-42: LGTM!Standard Flutter macOS Podfile configuration. The
flutter_roothelper, project configurations, andpost_installhook 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/Dirsuggestion on line 33 regarding__dir__was previously discussed and deferred since this file is autogenerated by Flutter.
| 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 |
There was a problem hiding this comment.
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 iosto 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.
| 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.
| 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
| _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, | ||
| ), | ||
| ], |
There was a problem hiding this comment.
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.
| _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.
| Future<void> _launchUrl() async { | ||
| final uri = Uri.parse(url); | ||
| if (await canLaunchUrl(uri)) { | ||
| await launchUrl(uri, mode: LaunchMode.externalApplication); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
Description
Setup widget book with colors story
widgetbook.mov
Type of Change
Checklist
just precommitto ensure that formatting and linting are correctCHANGELOG.mdfile with your changes (if they affect the user experience)Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.