Extract fl_lib to avoid bloating#77
Conversation
|
Warning Review limit reached
More reviews will be available in 33 minutes and 47 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (20)
📝 WalkthroughWalkthroughThis PR migrates the app from the ChangesKit Package Creation and App Migration
Possibly Related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 5
🧹 Nitpick comments (21)
lib/pages/download_page/components/add_task_dialog.dart (1)
6-6: 💤 Low valueConsider using consistent import alias for kit package.
This file imports
../../../kit/kit.dartwithout an alias, while all other files in this migration useas kit. This inconsistency makes the codebase less uniform—for example, this file usesBtn.ok()directly while other files would usekit.Btn.ok().♻️ Suggested change for consistency
-import '../../../kit/kit.dart'; +import '../../../kit/kit.dart' as kit;Then update usages:
-Btn.tile(...) +kit.Btn.tile(...)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/pages/download_page/components/add_task_dialog.dart` at line 6, Replace the plain import of the kit package with a consistent alias and update usages: change the import line importing '../../../kit/kit.dart' to use "as kit", then update any direct references such as Btn.ok(), Btn.cancel(), TextStyles, etc. in this file to prefixed references like kit.Btn.ok(), kit.Btn.cancel(), kit.TextStyles (or other kit symbols) so the file matches the rest of the migration's use of the kit alias.lib/app.dart (2)
3-4: ⚡ Quick winConsolidate duplicate kit imports.
The kit package is imported twice on lines 3-4. These can be combined into a single import statement.
♻️ Suggested consolidation
-import 'kit/kit.dart' as kit; -import 'kit/kit.dart' show ChineseThemeData; +import 'kit/kit.dart' as kit show ChineseThemeData;As per coding guidelines, the dart formatter should be used for consistent import handling.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/app.dart` around lines 3 - 4, Consolidate the two imports of kit/kit.dart into a single import: remove the separate plain import and keep one import that both assigns the alias kit and also exposes ChineseThemeData (so references to kit.* and ChineseThemeData still work); update the import statement accordingly and run dart format to ensure consistent ordering and formatting.
3-27: ⚡ Quick winReorder imports to follow project guidelines.
Imports should be ordered:
dart:→package:flutter/→package:→ relative paths. Currently, thekit/kit.dartimports (lines 3-4) appear beforepackage:imports (lines 5-7).♻️ Suggested reordering
import 'dart:async'; -import 'kit/kit.dart' as kit; -import 'kit/kit.dart' show ChineseThemeData; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:window_manager/window_manager.dart'; + +import 'kit/kit.dart' as kit show ChineseThemeData; import 'constants/app_branding.dart';As per coding guidelines, imports should follow the specified order and
flutter format .should be used for automatic code formatting.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/app.dart` around lines 3 - 27, The import order in lib/app.dart is incorrect: move the two kit imports (import 'kit/kit.dart' as kit; and import 'kit/kit.dart' show ChineseThemeData;) so they appear after the dart: and package:flutter/ imports and after other package: imports (i.e., follow dart: → package:flutter/... → package:... → relative/project imports order used across this repo), then run flutter format . to apply automatic formatting; use the symbols kit, ChineseThemeData and existing package imports (package:flutter/material.dart, package:provider/provider.dart, etc.) to locate and reorder the lines.lib/utils/logging.dart (1)
3-5: ⚡ Quick winReorder the new imports to keep Dart groups consistent.
package:logging/logging.dartshould stay above the relative../kit/...imports. As per coding guidelines,**/*.dart: Order imports as: dart: → package:flutter/ → package: → relative paths.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/utils/logging.dart` around lines 3 - 5, Reorder the import statements so package imports come before relative imports: move "package:logging/logging.dart" above the two relative imports ("../kit/provider/debug.dart" and "../kit/core/logger.dart") so the file follows the dart import grouping (dart:, package:, then relative paths); ensure no other import order changes are introduced and keep existing import names unchanged.lib/pages/settings_page/settings_page.dart (1)
3-17: ⚡ Quick winReorder these imports to match the repo's Dart convention.
../../kit/kit.dartshould be grouped with the other relative imports after thepackage:imports. As per coding guidelines,**/*.dart: Order imports as: dart: → package:flutter/ → package: → relative paths.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/pages/settings_page/settings_page.dart` around lines 3 - 17, Reorder the import lines in settings_page.dart so the relative import ../../kit/kit.dart is moved out of the top and placed with the other relative imports after all package imports; follow the repo convention: dart: imports first, then package:flutter and other package: imports (e.g., package:material, package:provider, package:package_info_plus, package:url_launcher), and finally relative imports such as ../../kit/kit.dart, ../../constants/..., ../../generated/..., ../../models/..., ../../services/..., ../../utils/..., and ./components/appearance_dialog.dart so the import groups and ordering match the project's Dart style.lib/kit/core/rnode.dart (1)
59-63: ⚡ Quick win
VNodesetter notifies even when the value is unchanged.Unlike Flutter's
ValueNotifier, this firesnotify()on every assignment, including no-op writes, causing avoidable rebuilds. Consider short-circuiting when_value == newVal.♻️ Proposed change
set value(T newVal) { + if (_value == newVal) return; _value = newVal; notify(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/core/rnode.dart` around lines 59 - 63, The VNode setter currently always calls notify() on assignment; change the set value(T newVal) in the VNode (the setter that writes to _value and calls notify()) to short-circuit when the incoming newVal equals the current _value (i.e., if (_value == newVal) return;) before assigning and calling notify(), so notifications only occur on real changes.lib/kit/core/func.dart (1)
12-12: ⚡ Quick winPrefer a concrete callback type over
Function?.
Function?is effectively untyped. Since it is only invoked ascontinueClick?.call(), avoid Function()?signature gives stronger typing and clearer intent.♻️ Proposed change
- Function? continueClick, + void Function()? continueClick,As per coding guidelines: "Use strong typing and avoid
dynamictype."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/core/func.dart` at line 12, The parameter continueClick is currently declared as untyped Function? — change its type to a nullable concrete callback signature void Function()? by updating the parameter declaration for continueClick in the function/class (look for the parameter named continueClick in lib/kit/core/func.dart) and any matching fields/constructor parameters or usages (e.g., where continueClick?.call() is invoked) so the type is consistently void Function()? throughout the class/function.lib/kit/core/platform.dart (1)
28-28: 💤 Low valueTypo in public API name:
seperator→separator.This is a newly exported member, so correcting the spelling now avoids a breaking rename later.
✏️ Proposed fix
- static final String seperator = isWindows ? '\\' : '/'; + static final String separator = isWindows ? '\\' : '/';🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/core/platform.dart` at line 28, Rename the misspelled public static field `seperator` to `separator` (i.e., change `static final String seperator` → `static final String separator`) in the Platform class, then update all references, exports, documentation and tests that use `seperator` to the new `separator` identifier so the public API is corrected consistently; ensure no remaining references to `seperator` remain.lib/kit/widgets/appbar.dart (2)
51-51: ⚡ Quick winUse SCREAMING_SNAKE_CASE for compile-time constants.
The static const
appBarHeightshould follow SCREAMING_SNAKE_CASE naming convention. As per coding guidelines, "Use SCREAMING_SNAKE_CASE for compile-time constants".♻️ Proposed fix
-static const double appBarHeight = kToolbarHeight - 10; +static const double APP_BAR_HEIGHT = kToolbarHeight - 10;And update references to use
APP_BAR_HEIGHTinstead ofappBarHeight.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/appbar.dart` at line 51, Rename the compile-time constant appBarHeight to follow SCREAMING_SNAKE_CASE (APP_BAR_HEIGHT) in the AppBar widget file and update all references accordingly; specifically change the static const declaration named appBarHeight to APP_BAR_HEIGHT (in the class where it's declared) and replace every usage of appBarHeight throughout the codebase with APP_BAR_HEIGHT to keep naming consistent with compile-time constant conventions.
6-19: ⚡ Quick winAdd trailing commas for multi-line constructs.
Multi-line widget constructors and function calls should include trailing commas. As per coding guidelines, "Use trailing commas in multi-line constructs".
♻️ Proposed fix
const CustomAppBar({ super.key, this.title, this.actions, this.centerTitle = true, this.leading, this.backgroundColor, this.bottom, this.scrolledUnderElevation = 0, - this.surfaceTintColor = Colors.transparent, + this.surfaceTintColor = Colors.transparent, }); return AppBar( key: key, title: title, actions: actions, centerTitle: centerTitle, leading: leading, backgroundColor: backgroundColor, toolbarHeight: appBarHeight, bottom: bottom, scrolledUnderElevation: scrolledUnderElevation, - surfaceTintColor: surfaceTintColor, + surfaceTintColor: surfaceTintColor, );Also applies to: 32-43
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/appbar.dart` around lines 6 - 19, The CustomAppBar constructor and other multi-line widget constructors (e.g., the parameter list for CustomAppBar and the multi-line build members around the class) are missing trailing commas; update the constructor parameter list in class CustomAppBar (and any other multi-line widget or function calls in the same file, including the section around the bottom/fields and the multi-line block referenced near lines 32-43) to include trailing commas after each parameter/item to satisfy the style guide and ensure proper formatting.lib/kit/widgets/btn.dart (2)
34-47: ⚡ Quick winAdd trailing commas for multi-line constructors.
All named constructors should include trailing commas after the last parameter to enable proper auto-formatting. As per coding guidelines, "Use trailing commas in multi-line constructs".
♻️ Proposed fix (example for Btn.text)
const Btn.text({ super.key, required this.text, this.onTap = _defaultOnTap, this.textStyle, this.padding, - this.onLongTap, + this.onLongTap, }) : type = BtnType.text, gap = null, mainAxisAlignment = null, mainAxisSize = null, borderRadius = null, popVal = null, icon = null;Apply similar changes to all other named constructors.
Also applies to: 49-62, 64-77, 79-92, 94-110, 112-125, 127-142, 144-158
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/btn.dart` around lines 34 - 47, The named constructors (e.g., Btn.text) are missing trailing commas after their last parameter which prevents proper Dart auto-formatting; for each multi-line named constructor in Btn (Btn.text and the other named constructors referenced) add a trailing comma after the final parameter list (for example after this.onLongTap,) so the constructor argument list ends with a comma, then run dartfmt to verify formatting across all constructors.
203-218: ⚡ Quick winAdd trailing commas in widget trees.
Multi-line
Column,Row, andElevatedButtonwidget trees should include trailing commas. As per coding guidelines, "Use trailing commas in multi-line constructs".♻️ Proposed fix (example)
Widget child = Column( children: [ icon ?? _kPlaceholderIcon, SizedBox(height: gap ?? _kGap), - Text(text, style: textStyle), + Text(text, style: textStyle), ], );Apply similar changes to other widget trees in
_rowand_elevated.Also applies to: 228-241, 254-267
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/btn.dart` around lines 203 - 218, The multi-line widget trees (e.g., the Column assigned to local variable child, the Padding wrapping child, and the returned InkWell) are missing trailing commas; update these multi-line constructors to include trailing commas so Dart formatter produces readable, multi-line layout (apply the same change to other widget trees in the file such as the _row and _elevated widget builders referenced in the comment). Specifically, add trailing commas after the Column children list, after the Padding(...) argument list when present, and after the InkWell(...) argument list (and mirror this pattern in the _row and _elevated functions) so all multi-line widget constructors end with a trailing comma.lib/kit/core/ext/widget.dart (1)
4-5: ⚡ Quick winAdd trailing commas for multi-line constructs.
Multi-line function expressions should include trailing commas to enable
flutter format .to work correctly with the 80-character line limit. As per coding guidelines, "Use trailing commas in multi-line constructs".♻️ Proposed fix
Widget paddingAll(double value) => - Padding(padding: EdgeInsets.all(value), child: this); + Padding(padding: EdgeInsets.all(value), child: this,); Widget paddingOnly({ double left = 0, double top = 0, double right = 0, double bottom = 0, }) => Padding( padding: EdgeInsets.only( left: left, top: top, right: right, bottom: bottom, ), child: this, - ); + ),;Also applies to: 13-21
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/core/ext/widget.dart` around lines 4 - 5, The multi-line widget extension methods (e.g., the paddingAll method) are missing trailing commas, which prevents proper Flutter formatting; update each multi-line expression (such as Widget paddingAll(double value) => Padding(padding: EdgeInsets.all(value), child: this); and the other extension methods in the same file) to place trailing commas after positional/ named parameters and after the child where appropriate so the construct ends with a comma and the formatter can reflow lines correctly.lib/kit/widgets/loading.dart (2)
39-41: ⚡ Quick winUse SCREAMING_SNAKE_CASE for static compile-time constants.
The static const instances
small,medium, andlargeshould follow SCREAMING_SNAKE_CASE naming convention. As per coding guidelines, "Use SCREAMING_SNAKE_CASE for compile-time constants".♻️ Proposed fix
-static const small = SizedLoading(25); -static const medium = SizedLoading(45); -static const large = SizedLoading(65); +static const SMALL = SizedLoading(25); +static const MEDIUM = SizedLoading(45); +static const LARGE = SizedLoading(65);Update usage sites accordingly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/loading.dart` around lines 39 - 41, The static const instances small, medium, and large in the SizedLoading widget are compile-time constants and must use SCREAMING_SNAKE_CASE; rename the symbols to SMALL, MEDIUM, and LARGE (references: SizedLoading, small/medium/large) and update all usage sites to the new names so callers reference SizedLoading.SMALL, .MEDIUM, and .LARGE.
12-18: ⚡ Quick winAdd trailing commas for multi-line constructs.
The constructor, function definitions, and widget trees should include trailing commas. As per coding guidelines, "Use trailing commas in multi-line constructs".
♻️ Proposed fix
const SizedLoading( this.size, { this.padding = 7, this.valueColor, this.builder = linearBuilder, - super.key, + super.key, }); static Widget linearBuilder( BuildContext context, - Animation<Color>? valueColor, + Animation<Color>? valueColor, ) { return LinearProgressIndicator( valueColor: valueColor ?? AlwaysStoppedAnimation(Theme.of(context).colorScheme.primary), ); } return SizedBox( width: size - 2 * padding, height: size - 2 * padding, child: Center(child: builder(context, valueColor)).paddingAll(padding), -).paddingAll(3); +).paddingAll(3),;Also applies to: 20-27, 31-36
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/loading.dart` around lines 12 - 18, The SizedLoading constructor declaration (const SizedLoading) and other multi-line constructs (including the parameter lists around padding, valueColor, builder, and super.key, as well as the function/widget definitions noted at lines 20-27 and 31-36) need trailing commas added so Dart formatter produces proper multi-line formatting; update the parameter lists and any multi-line widget trees or function signatures (e.g., the constructor for SizedLoading and the functions referencing linearBuilder) to include trailing commas after each argument/parameter and after the final parameter (including super.key) where applicable.lib/kit/res/ui.dart (1)
5-8: ⚡ Quick winAdd trailing commas for multi-line constructs.
Multi-line
TextStyle,BoxDecoration, and widget definitions should include trailing commas to enableflutter format .with the 80-character line limit. As per coding guidelines, "Use trailing commas in multi-line constructs".♻️ Proposed fix (partial example)
static const text11Bold = TextStyle( fontSize: 11, - fontWeight: FontWeight.w500, + fontWeight: FontWeight.w500, ); static Widget dot({Color? color, double? size}) => Container( width: size ?? 7, height: size ?? 7, decoration: BoxDecoration( color: color ?? primaryColor, shape: BoxShape.circle, ), - ); + ),;Apply similar changes to other multi-line constructs.
Also applies to: 11-13, 17-20, 23-26, 39-46, 48-51
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/res/ui.dart` around lines 5 - 8, The multi-line constructors (e.g., the TextStyle constant text11Bold) in lib/kit/res/ui.dart are missing trailing commas; add trailing commas to every multi-line TextStyle, BoxDecoration, and widget definition in this file (including the other TextStyle constants and any multi-line BoxDecoration/widget blocks referenced in the comment ranges) so dartfmt/Flutter format will layout them across multiple lines correctly; ensure each multi-line argument list and constructor invocation ends with a comma.lib/kit/widgets/card.dart (2)
9-15: ⚡ Quick winAdd trailing comma in constructor.
The constructor should include a trailing comma after the last parameter. As per coding guidelines, "Use trailing commas in multi-line constructs".
♻️ Proposed fix
const CardX({ super.key, required this.child, this.color, this.radius, - this.clipBehavior = Clip.hardEdge, + this.clipBehavior = Clip.hardEdge, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/card.dart` around lines 9 - 15, The CardX constructor declaration is missing a trailing comma after the last parameter; update the constructor (const CardX({...})) to place a trailing comma after the clipBehavior = Clip.hardEdge parameter so the multi-line parameter list follows the project's trailing-comma style.
17-17: ⚡ Quick winUse SCREAMING_SNAKE_CASE for static compile-time constants.
The static const
borderRadiusshould follow SCREAMING_SNAKE_CASE naming convention. As per coding guidelines, "Use SCREAMING_SNAKE_CASE for compile-time constants".♻️ Proposed fix
-static const borderRadius = BorderRadius.all(Radius.circular(13)); +static const BORDER_RADIUS = BorderRadius.all(Radius.circular(13));And update the reference on line 26:
-borderRadius: radius ?? borderRadius, +borderRadius: radius ?? BORDER_RADIUS,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/card.dart` at line 17, Rename the static compile-time constant `borderRadius` to SCREAMING_SNAKE_CASE (e.g., `BORDER_RADIUS`) and update its declaration to `static const BORDER_RADIUS = BorderRadius.all(Radius.circular(13));`; then update all references to this symbol (e.g., `borderRadius`) to use the new `BORDER_RADIUS` identifier so code compiles and follows the constant naming convention.lib/kit/res/font.dart (1)
7-11: ⚡ Quick winAdd trailing commas for multi-line constructs.
Multi-line lists, switch expressions, and function bodies should include trailing commas to enable
flutter format .with the 80-character line limit. As per coding guidelines, "Use trailing commas in multi-line constructs".♻️ Proposed fix
const _fontFamilyFallback = [ 'system-font', 'sans-serif', - 'Microsoft YaHei', + 'Microsoft YaHei', ]; TextTheme _fixChinese(Brightness brightness) { final newTextTheme = switch (brightness) { Brightness.dark => _typography.white.apply(fontFamilyFallback: _fontFamilyFallback), Brightness.light => - _typography.black.apply(fontFamilyFallback: _fontFamilyFallback), + _typography.black.apply(fontFamilyFallback: _fontFamilyFallback), }; return newTextTheme.merge(this); } return switch (Platform.localeName) { final locale when locale.startsWith('zh') => copyWith(textTheme: textTheme._fixChinese(brightness)), - _ => this, + _ => this, };Also applies to: 16-24, 31-35
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/res/font.dart` around lines 7 - 11, The multi-line list literal _fontFamilyFallback (and other multi-line constructs in this file) is missing a trailing comma; update the list and any other multi-line lists or collection literals in lib/kit/res/font.dart (e.g., the other multi-line list blocks referenced in the review) to include a trailing comma after the last element so flutter format can apply the 80-char rule and produce the intended formatting. Ensure each multi-line list/collection expression ends with a comma (and similarly add trailing commas to multi-line argument or parameter lists if present).lib/kit/widgets/input.dart (1)
33-63: ⚡ Quick winAdd trailing commas for multi-line constructs.
The constructor, widget trees, and method calls should include trailing commas. As per coding guidelines, "Use trailing commas in multi-line constructs".
♻️ Proposed fix (partial example)
const Input({ super.key, this.controller, this.maxLines = 1, this.minLines, this.hint, this.label, this.onSubmitted, this.onChanged, this.obscureText = false, this.icon, this.type, this.action, this.node, this.autoCorrect = false, this.suggestion, this.errorText, this.autoFocus = false, this.onViewPwdTap, this.noWrap = false, this.suffix, this.counterBuilder, this.onTap, this.onTapOutside, this.contextMenuBuilder, this.maxLength, - this.enabled, + this.enabled, }) : assert( !(obscureText && suffix != null), - 'suffix != null && obscureText', + 'suffix != null && obscureText', );Apply similar changes to widget trees and other multi-line constructs.
Also applies to: 73-85, 89-120, 127-137
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/input.dart` around lines 33 - 63, The Input constructor and other multi-line constructs (e.g., the Input widget build trees and method calls) are missing trailing commas; update the Input constructor parameter list (the const Input({...}) and its assert), the widget tree expressions inside the Input class (build method, any nested widgets), and multi-line method calls like counterBuilder/contextMenuBuilder declarations to add trailing commas at the end of each multi-line argument/list/collection so the formatter produces proper line breaks and consistent formatting.lib/kit/widgets/virtual_window_frame.dart (1)
7-15: ⚡ Quick winConsider documenting the intended usage of
WindowFrameConfig.The
setShowCaptionmethod updates static state but doesn't trigger widget rebuilds. If this is only intended to be called during app initialization (before widgets are built), consider adding a doc comment to clarify this. If runtime updates are expected, consider using aChangeNotifierorValueNotifierto enable reactive updates.💡 Example documentation approach
abstract final class WindowFrameConfig { static bool _showCaption = true; static bool get showCaption => _showCaption && isDesktop; + /// Sets whether to show the window caption. + /// This should only be called during app initialization before + /// VirtualWindowFrame widgets are built. static void setShowCaption(bool value) { _showCaption = value; } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/kit/widgets/virtual_window_frame.dart` around lines 7 - 15, Document the intended usage of WindowFrameConfig and either make it reactive or mark it as initialization-only: add a doc comment above the WindowFrameConfig class explaining that setShowCaption updates the static _showCaption and does not trigger widget rebuilds (so it must be called before widgets are built) if that's the intended behavior; otherwise, replace or wrap _showCaption with a reactive mechanism (e.g., a static ValueNotifier<bool> or a ChangeNotifier-backed API) and expose showCaption via that notifier so widgets can listen and rebuild when setShowCaption is called; reference WindowFrameConfig, setShowCaption, _showCaption, showCaption and isDesktop in the doc and implementation change to make the expected lifecycle explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/kit/core/rnode.dart`:
- Around line 22-29: notify currently iterates _listeners directly and swallows
all exceptions; make a stable snapshot before iterating (e.g., iterate over a
List.of(_listeners) so addListener/removeListener during dispatch won't cause
ConcurrentModificationError) and replace the empty catch with proper error
handling: catch (error, stack) and forward the information to your logger or
report it (e.g., FlutterError.reportError or a process logger) instead of
silently discarding it so listener failures are visible and debuggable.
In `@lib/kit/provider/debug.dart`:
- Around line 9-13: The _level2Color map in DebugProvider uses the key 'ERROR'
but log.e() emits Level.SEVERE via record.level.name, causing error rows to use
the fallback color; update the map named _level2Color to include 'SEVERE' (or
replace 'ERROR' with 'SEVERE') so record.level.name (from DebugProvider's
lookup) finds the intended color, e.g., adjust entries for 'ERROR'/'SEVERE'
while keeping 'INFO' and 'WARNING' as-is.
In `@lib/kit/res/ui.dart`:
- Around line 53-54: The static mutable variables colorSeed and primaryColor in
ui.dart create global mutable state; replace them with an injectable, immutable
theme/config provider: create a ColorTheme or UiConfig class that exposes final
colorSeed and primaryColor, register it with Provider (ChangeNotifier or a plain
immutable provider) at app root, and update consumers to read
Provider.of<ColorTheme>(context).colorSeed / .primaryColor instead of using the
static variables so state is managed via Provider and becomes testable and
instance-scoped.
In `@lib/kit/widgets/virtual_window_frame.dart`:
- Around line 59-77: The wm.WindowCaption widget in virtual_window_frame.dart is
missing a trailing comma which breaks the project's multi-line formatting rules;
update the children list by adding a trailing comma after the closing
parenthesis of wm.WindowCaption (the widget built when isLinux || isWindows) so
the multi-line widget follows formatting conventions and the analyzer/formatter
can apply proper layout.
In `@lib/pages/settings_page/settings_page.dart`:
- Around line 538-545: The linkText widget currently calls launchUrl directly
(onTap: () => launchUrl(Uri.parse(url))) and drops the Future; change it to call
and await the centralized helper _launchExternalUri(Uri) used elsewhere (e.g.,
from _buildAboutRichText) so all external launches use the same UX/error
handling; update the onTap to an async handler that awaits
_launchExternalUri(Uri.parse(url)) and ensure _launchExternalUri or the new
onTap wraps the call in a try-catch to handle PlatformException/errors and
surface feedback via the existing error reporting mechanism.
---
Nitpick comments:
In `@lib/app.dart`:
- Around line 3-4: Consolidate the two imports of kit/kit.dart into a single
import: remove the separate plain import and keep one import that both assigns
the alias kit and also exposes ChineseThemeData (so references to kit.* and
ChineseThemeData still work); update the import statement accordingly and run
dart format to ensure consistent ordering and formatting.
- Around line 3-27: The import order in lib/app.dart is incorrect: move the two
kit imports (import 'kit/kit.dart' as kit; and import 'kit/kit.dart' show
ChineseThemeData;) so they appear after the dart: and package:flutter/ imports
and after other package: imports (i.e., follow dart: → package:flutter/... →
package:... → relative/project imports order used across this repo), then run
flutter format . to apply automatic formatting; use the symbols kit,
ChineseThemeData and existing package imports (package:flutter/material.dart,
package:provider/provider.dart, etc.) to locate and reorder the lines.
In `@lib/kit/core/ext/widget.dart`:
- Around line 4-5: The multi-line widget extension methods (e.g., the paddingAll
method) are missing trailing commas, which prevents proper Flutter formatting;
update each multi-line expression (such as Widget paddingAll(double value) =>
Padding(padding: EdgeInsets.all(value), child: this); and the other extension
methods in the same file) to place trailing commas after positional/ named
parameters and after the child where appropriate so the construct ends with a
comma and the formatter can reflow lines correctly.
In `@lib/kit/core/func.dart`:
- Line 12: The parameter continueClick is currently declared as untyped
Function? — change its type to a nullable concrete callback signature void
Function()? by updating the parameter declaration for continueClick in the
function/class (look for the parameter named continueClick in
lib/kit/core/func.dart) and any matching fields/constructor parameters or usages
(e.g., where continueClick?.call() is invoked) so the type is consistently void
Function()? throughout the class/function.
In `@lib/kit/core/platform.dart`:
- Line 28: Rename the misspelled public static field `seperator` to `separator`
(i.e., change `static final String seperator` → `static final String separator`)
in the Platform class, then update all references, exports, documentation and
tests that use `seperator` to the new `separator` identifier so the public API
is corrected consistently; ensure no remaining references to `seperator` remain.
In `@lib/kit/core/rnode.dart`:
- Around line 59-63: The VNode setter currently always calls notify() on
assignment; change the set value(T newVal) in the VNode (the setter that writes
to _value and calls notify()) to short-circuit when the incoming newVal equals
the current _value (i.e., if (_value == newVal) return;) before assigning and
calling notify(), so notifications only occur on real changes.
In `@lib/kit/res/font.dart`:
- Around line 7-11: The multi-line list literal _fontFamilyFallback (and other
multi-line constructs in this file) is missing a trailing comma; update the list
and any other multi-line lists or collection literals in lib/kit/res/font.dart
(e.g., the other multi-line list blocks referenced in the review) to include a
trailing comma after the last element so flutter format can apply the 80-char
rule and produce the intended formatting. Ensure each multi-line list/collection
expression ends with a comma (and similarly add trailing commas to multi-line
argument or parameter lists if present).
In `@lib/kit/res/ui.dart`:
- Around line 5-8: The multi-line constructors (e.g., the TextStyle constant
text11Bold) in lib/kit/res/ui.dart are missing trailing commas; add trailing
commas to every multi-line TextStyle, BoxDecoration, and widget definition in
this file (including the other TextStyle constants and any multi-line
BoxDecoration/widget blocks referenced in the comment ranges) so dartfmt/Flutter
format will layout them across multiple lines correctly; ensure each multi-line
argument list and constructor invocation ends with a comma.
In `@lib/kit/widgets/appbar.dart`:
- Line 51: Rename the compile-time constant appBarHeight to follow
SCREAMING_SNAKE_CASE (APP_BAR_HEIGHT) in the AppBar widget file and update all
references accordingly; specifically change the static const declaration named
appBarHeight to APP_BAR_HEIGHT (in the class where it's declared) and replace
every usage of appBarHeight throughout the codebase with APP_BAR_HEIGHT to keep
naming consistent with compile-time constant conventions.
- Around line 6-19: The CustomAppBar constructor and other multi-line widget
constructors (e.g., the parameter list for CustomAppBar and the multi-line build
members around the class) are missing trailing commas; update the constructor
parameter list in class CustomAppBar (and any other multi-line widget or
function calls in the same file, including the section around the bottom/fields
and the multi-line block referenced near lines 32-43) to include trailing commas
after each parameter/item to satisfy the style guide and ensure proper
formatting.
In `@lib/kit/widgets/btn.dart`:
- Around line 34-47: The named constructors (e.g., Btn.text) are missing
trailing commas after their last parameter which prevents proper Dart
auto-formatting; for each multi-line named constructor in Btn (Btn.text and the
other named constructors referenced) add a trailing comma after the final
parameter list (for example after this.onLongTap,) so the constructor argument
list ends with a comma, then run dartfmt to verify formatting across all
constructors.
- Around line 203-218: The multi-line widget trees (e.g., the Column assigned to
local variable child, the Padding wrapping child, and the returned InkWell) are
missing trailing commas; update these multi-line constructors to include
trailing commas so Dart formatter produces readable, multi-line layout (apply
the same change to other widget trees in the file such as the _row and _elevated
widget builders referenced in the comment). Specifically, add trailing commas
after the Column children list, after the Padding(...) argument list when
present, and after the InkWell(...) argument list (and mirror this pattern in
the _row and _elevated functions) so all multi-line widget constructors end with
a trailing comma.
In `@lib/kit/widgets/card.dart`:
- Around line 9-15: The CardX constructor declaration is missing a trailing
comma after the last parameter; update the constructor (const CardX({...})) to
place a trailing comma after the clipBehavior = Clip.hardEdge parameter so the
multi-line parameter list follows the project's trailing-comma style.
- Line 17: Rename the static compile-time constant `borderRadius` to
SCREAMING_SNAKE_CASE (e.g., `BORDER_RADIUS`) and update its declaration to
`static const BORDER_RADIUS = BorderRadius.all(Radius.circular(13));`; then
update all references to this symbol (e.g., `borderRadius`) to use the new
`BORDER_RADIUS` identifier so code compiles and follows the constant naming
convention.
In `@lib/kit/widgets/input.dart`:
- Around line 33-63: The Input constructor and other multi-line constructs
(e.g., the Input widget build trees and method calls) are missing trailing
commas; update the Input constructor parameter list (the const Input({...}) and
its assert), the widget tree expressions inside the Input class (build method,
any nested widgets), and multi-line method calls like
counterBuilder/contextMenuBuilder declarations to add trailing commas at the end
of each multi-line argument/list/collection so the formatter produces proper
line breaks and consistent formatting.
In `@lib/kit/widgets/loading.dart`:
- Around line 39-41: The static const instances small, medium, and large in the
SizedLoading widget are compile-time constants and must use
SCREAMING_SNAKE_CASE; rename the symbols to SMALL, MEDIUM, and LARGE
(references: SizedLoading, small/medium/large) and update all usage sites to the
new names so callers reference SizedLoading.SMALL, .MEDIUM, and .LARGE.
- Around line 12-18: The SizedLoading constructor declaration (const
SizedLoading) and other multi-line constructs (including the parameter lists
around padding, valueColor, builder, and super.key, as well as the
function/widget definitions noted at lines 20-27 and 31-36) need trailing commas
added so Dart formatter produces proper multi-line formatting; update the
parameter lists and any multi-line widget trees or function signatures (e.g.,
the constructor for SizedLoading and the functions referencing linearBuilder) to
include trailing commas after each argument/parameter and after the final
parameter (including super.key) where applicable.
In `@lib/kit/widgets/virtual_window_frame.dart`:
- Around line 7-15: Document the intended usage of WindowFrameConfig and either
make it reactive or mark it as initialization-only: add a doc comment above the
WindowFrameConfig class explaining that setShowCaption updates the static
_showCaption and does not trigger widget rebuilds (so it must be called before
widgets are built) if that's the intended behavior; otherwise, replace or wrap
_showCaption with a reactive mechanism (e.g., a static ValueNotifier<bool> or a
ChangeNotifier-backed API) and expose showCaption via that notifier so widgets
can listen and rebuild when setShowCaption is called; reference
WindowFrameConfig, setShowCaption, _showCaption, showCaption and isDesktop in
the doc and implementation change to make the expected lifecycle explicit.
In `@lib/pages/download_page/components/add_task_dialog.dart`:
- Line 6: Replace the plain import of the kit package with a consistent alias
and update usages: change the import line importing '../../../kit/kit.dart' to
use "as kit", then update any direct references such as Btn.ok(), Btn.cancel(),
TextStyles, etc. in this file to prefixed references like kit.Btn.ok(),
kit.Btn.cancel(), kit.TextStyles (or other kit symbols) so the file matches the
rest of the migration's use of the kit alias.
In `@lib/pages/settings_page/settings_page.dart`:
- Around line 3-17: Reorder the import lines in settings_page.dart so the
relative import ../../kit/kit.dart is moved out of the top and placed with the
other relative imports after all package imports; follow the repo convention:
dart: imports first, then package:flutter and other package: imports (e.g.,
package:material, package:provider, package:package_info_plus,
package:url_launcher), and finally relative imports such as ../../kit/kit.dart,
../../constants/..., ../../generated/..., ../../models/..., ../../services/...,
../../utils/..., and ./components/appearance_dialog.dart so the import groups
and ordering match the project's Dart style.
In `@lib/utils/logging.dart`:
- Around line 3-5: Reorder the import statements so package imports come before
relative imports: move "package:logging/logging.dart" above the two relative
imports ("../kit/provider/debug.dart" and "../kit/core/logger.dart") so the file
follows the dart import grouping (dart:, package:, then relative paths); ensure
no other import order changes are introduced and keep existing import names
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b016f3d3-04d0-4de3-9abe-5c2828056825
⛔ Files ignored due to path filters (1)
pubspec.lockis excluded by!**/*.lock
📒 Files selected for processing (38)
lib/app.dartlib/kit/core/build.dartlib/kit/core/ext/datetime.dartlib/kit/core/ext/obj.dartlib/kit/core/ext/string.dartlib/kit/core/ext/widget.dartlib/kit/core/func.dartlib/kit/core/logger.dartlib/kit/core/platform.dartlib/kit/core/rnode.dartlib/kit/kit.dartlib/kit/pages/debug_page.dartlib/kit/provider/debug.dartlib/kit/res/font.dartlib/kit/res/ui.dartlib/kit/widgets/appbar.dartlib/kit/widgets/btn.dartlib/kit/widgets/card.dartlib/kit/widgets/input.dartlib/kit/widgets/loading.dartlib/kit/widgets/text.dartlib/kit/widgets/virtual_window_frame.dartlib/main.dartlib/pages/builtin_instance_settings_page.dartlib/pages/components/settings_helpers.dartlib/pages/download_page/components/add_task_dialog.dartlib/pages/instance_page/components/instance_dialog.dartlib/pages/remote_instance_settings_page.dartlib/pages/remote_instance_status_page.dartlib/pages/settings_page/settings_page.dartlib/utils/logging.dartlinux/flutter/generated_plugin_registrant.cclinux/flutter/generated_plugins.cmakemacos/Flutter/GeneratedPluginRegistrant.swiftpackages/fl_libpubspec.yamlwindows/flutter/generated_plugin_registrant.ccwindows/flutter/generated_plugins.cmake
💤 Files with no reviewable changes (6)
- macos/Flutter/GeneratedPluginRegistrant.swift
- windows/flutter/generated_plugin_registrant.cc
- linux/flutter/generated_plugins.cmake
- windows/flutter/generated_plugins.cmake
- linux/flutter/generated_plugin_registrant.cc
- packages/fl_lib
| static var colorSeed = const Color.fromARGB(255, 72, 15, 15); | ||
| static var primaryColor = colorSeed; |
There was a problem hiding this comment.
Avoid mutable static state; use Provider for color theme management.
The mutable static variables colorSeed and primaryColor introduce global state that bypasses the recommended state management pattern. This makes it difficult to track changes, test the code, and follow Flutter best practices. As per coding guidelines, "Use Provider for dependency injection and state management".
Consider refactoring to use a Provider-based theme or color configuration.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/kit/res/ui.dart` around lines 53 - 54, The static mutable variables
colorSeed and primaryColor in ui.dart create global mutable state; replace them
with an injectable, immutable theme/config provider: create a ColorTheme or
UiConfig class that exposes final colorSeed and primaryColor, register it with
Provider (ChangeNotifier or a plain immutable provider) at app root, and update
consumers to read Provider.of<ColorTheme>(context).colorSeed / .primaryColor
instead of using the static variables so state is managed via Provider and
becomes testable and instance-scoped.
Summary by CodeRabbit
Release Notes
New Features
Chores