Repository: flutter/flutter
File: packages/flutter/test/widgets/decorated_sliver_test.dart (Dart)

Code before:
      ),
    );
  });

  /// Regression test for https://github.com/flutter/flutter/issues/179801
  testWidgets('DecoratedSliver works with PinnedHeaderSliver overscroll', (
    WidgetTester tester,
  ) async {
    const key = Key('DecoratedSliver with border');

    await tester.pumpWidget(
      TestWidgetsApp(
        home: Align(
          alignment: Alignment.topLeft,
          child: SizedBox(
            height: 500,
            width: 300,
            child: CustomScrollView(
              physics: const BouncingScrollPhysics(),
              slivers: <Widget>[
                DecoratedSliver(
                  key: key,
                  decoration: BoxDecoration(
                    border: Border.all(strokeAlign: BorderSide.strokeAlignCenter),
                  ),
                  sliver: SliverPersistentHeader(
                    pinned: true,
                    delegate: TestDelegate(
                      stretchConfiguration: OverScrollHeaderStretchConfiguration(),
                    ),
                  ),
                ),
                const SliverToBoxAdapter(child: SizedBox(height: 1000)),
              ],
            ),
          ),
        ),
      ),
    );

    await tester.drag(find.byType(CustomScrollView), const Offset(0, 45));
    await tester.pump();

    expect(
      find.byKey(key),
      paints..something((methodName, arguments) {
        if (methodName != #drawRect) {
          return false;
        }
        final rect = arguments[0] as Rect;


Review comment (suggestion):
`strokeAlignCenter` was needed to ensure that the rect for the paint matcher starts at 0,0 for the expectation (otherwise it starts at 0.5,0.5)

Code after:
        style: PaintingStyle.stroke,
        strokeWidth: 1.0,
      ),
    );
  });

  /// Regression test for https://github.com/flutter/flutter/issues/179801
  testWidgets('DecoratedSliver works with PinnedHeaderSliver overscroll', (
    WidgetTester tester,
  ) async {
    const key = Key('DecoratedSliver with border');

    await tester.pumpWidget(
      TestWidgetsApp(
        home: Align(
          alignment: Alignment.topLeft,
          child: SizedBox(
            height: 500,
            width: 300,
            child: CustomScrollView(
              physics: const BouncingScrollPhysics(),
              slivers: <Widget>[
                DecoratedSliver(
                  key: key,
                  decoration: BoxDecoration(
                    border: Border.all(strokeAlign: BorderSide.strokeAlignCenter),
                  ),
                  sliver: SliverPersistentHeader(
                    pinned: true,
                    delegate: TestDelegate(
                      stretchConfiguration: OverScrollHeaderStretchConfiguration(),
                    ),
                  ),
                ),
                const SliverToBoxAdapter(child: SizedBox(height: 1000)),
              ],
            ),
          ),
        ),
      ),
    );

    await tester.drag(find.byType(CustomScrollView), const Offset(0, 45));
    await tester.pump();

    expect(
      find.byKey(key),
      paints..something((methodName, arguments) {
        if (methodName != #drawRect) {
          return false;
        }