Removed MaterialApp accentColor dependency. (#77652)
This commit is contained in:
parent
99c75a7300
commit
48f5674085
@ -678,7 +678,7 @@ class _MaterialScrollBehavior extends ScrollBehavior {
|
||||
return GlowingOverscrollIndicator(
|
||||
child: child,
|
||||
axisDirection: axisDirection,
|
||||
color: Theme.of(context).accentColor,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../rendering/mock_canvas.dart';
|
||||
|
||||
class StateMarker extends StatefulWidget {
|
||||
const StateMarker({ Key? key, this.child }) : super(key: key);
|
||||
|
||||
@ -882,6 +884,37 @@ void main() {
|
||||
expect(themeAfterBrightnessChange!.brightness, Brightness.dark);
|
||||
});
|
||||
|
||||
testWidgets('MaterialApp provides default overscroll color', (WidgetTester tester) async {
|
||||
Future<void> slowDrag(WidgetTester tester, Offset start, Offset offset) async {
|
||||
final TestGesture gesture = await tester.startGesture(start);
|
||||
for (int index = 0; index < 10; index += 1) {
|
||||
await gesture.moveBy(offset);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
}
|
||||
await gesture.up();
|
||||
}
|
||||
|
||||
// The overscroll color should be a transparent version of the colorScheme's
|
||||
// secondary color.
|
||||
const Color secondaryColor = Color(0xff008800);
|
||||
final Color glowSecondaryColor = secondaryColor.withOpacity(0.05);
|
||||
final ThemeData theme = ThemeData.from(
|
||||
colorScheme: const ColorScheme.light().copyWith(secondary: secondaryColor),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: theme,
|
||||
home: const SingleChildScrollView(
|
||||
child: SizedBox(height: 2000.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final RenderObject painter = tester.renderObject(find.byType(CustomPaint).first);
|
||||
await slowDrag(tester, const Offset(200.0, 200.0), const Offset(0.0, 5.0));
|
||||
expect(painter, paints..circle(color: glowSecondaryColor));
|
||||
});
|
||||
|
||||
testWidgets('MaterialApp can customize initial routes', (WidgetTester tester) async {
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
await tester.pumpWidget(
|
||||
|
Loading…
x
Reference in New Issue
Block a user