Skip to content

Refactor constants and logging in Shapes widget for consistency#11

Open
charlesoj6205 wants to merge 1 commit intomainfrom
feature/shape_app_update
Open

Refactor constants and logging in Shapes widget for consistency#11
charlesoj6205 wants to merge 1 commit intomainfrom
feature/shape_app_update

Conversation

@charlesoj6205
Copy link
Copy Markdown

No description provided.

@charlesoj6205 charlesoj6205 requested review from adriantuk and ivolz April 7, 2026 12:13
@charlesoj6205 charlesoj6205 added the bug Something isn't working label Apr 7, 2026
@adriantuk adriantuk requested a review from Copilot April 7, 2026 14:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Shapes example app to use consistent Dart naming for constants and logging, and updates the example widget test to point at the correct package/app entry widget.

Changes:

  • Renamed API-related constants to lowerCamelCase and updated all call sites.
  • Refactored Shapes to have a const constructor and adjusted state/logging identifiers for consistency.
  • Updated the widget test import and target widget from the old example package to approov_http_client_example.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
example/test/widget_test.dart Switches import/target widget to Shapes (but test logic still assumes a counter template).
example/lib/main.dart Renames constants and logging identifiers; adds const Shapes constructor and adjusts state/log naming.
Comments suppressed due to low confidence (1)

example/test/widget_test.dart:24

  • widget_test.dart is still the default counter template test (expects '0'/'1' text and a Icons.add button), but the app under test is now Shapes, which renders 'Approov Shapes' and 'Hello/Shape/Shape (Isolate)' buttons. This test will fail; update it to assert the initial Shapes UI (e.g., header text and buttons) rather than counter behavior, and avoid tapping buttons that trigger real network calls.
  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
    // Build our app and trigger a frame.
    await tester.pumpWidget(const Shapes());

    // Verify that our counter starts at 0.
    expect(find.text('0'), findsOneWidget);
    expect(find.text('1'), findsNothing);

    // Tap the '+' icon and trigger a frame.
    await tester.tap(find.byIcon(Icons.add));
    await tester.pump();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread example/lib/main.dart
Comment on lines 49 to 51
// execute the main function of the app
runApp(Shapes());
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

Shapes now has a const constructor, but main() still calls runApp(Shapes()). Use runApp(const Shapes()) to satisfy prefer_const_constructors and avoid an unnecessary widget instantiation.

Copilot uses AI. Check for mistakes.
Comment thread example/lib/main.dart
class ShapesState extends State<Shapes> {
// logger
static Logger Log = Logger();
static Logger log = Logger();
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

log is a mutable static field (static Logger log = Logger();) but it is never reassigned. Make it static final to prevent accidental reassignment and better express intent.

Suggested change
static Logger log = Logger();
static final Logger log = Logger();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants