Fix: CupertinoSheetTransition moves SystemUIOverlayStyle to outside of delegatedTransition and only changes top bar (#164680)
Fix: CupertinoSheetTransition should set the SystemUIOverlayStyle in init state fixes: #164633 Fixes https://github.com/flutter/flutter/issues/164134 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
This commit is contained in:
parent
e5cd67b6fc
commit
b44137f078
@ -258,8 +258,6 @@ class CupertinoSheetTransition extends StatefulWidget {
|
|||||||
final Animation<double> scaleAnimation = curvedAnimation.drive(_kScaleTween);
|
final Animation<double> scaleAnimation = curvedAnimation.drive(_kScaleTween);
|
||||||
curvedAnimation.dispose();
|
curvedAnimation.dispose();
|
||||||
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
|
|
||||||
|
|
||||||
final bool isDarkMode = CupertinoTheme.brightnessOf(context) == Brightness.dark;
|
final bool isDarkMode = CupertinoTheme.brightnessOf(context) == Brightness.dark;
|
||||||
final Color overlayColor = isDarkMode ? const Color(0xFFc8c8c8) : const Color(0xFF000000);
|
final Color overlayColor = isDarkMode ? const Color(0xFFc8c8c8) : const Color(0xFF000000);
|
||||||
|
|
||||||
@ -350,6 +348,12 @@ class _CupertinoSheetTransitionState extends State<CupertinoSheetTransition> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
const SystemUiOverlayStyle(
|
||||||
|
statusBarBrightness: Brightness.dark,
|
||||||
|
statusBarIconBrightness: Brightness.light,
|
||||||
|
),
|
||||||
|
);
|
||||||
_setupAnimation();
|
_setupAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
@ -1212,4 +1213,38 @@ void main() {
|
|||||||
expect(finalPosition, equals(initialPosition));
|
expect(finalPosition, equals(initialPosition));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('CupertinoSheetTransition handles SystemUiOverlayStyle changes', (
|
||||||
|
WidgetTester tester,
|
||||||
|
) async {
|
||||||
|
final AnimationController controller = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
vsync: const TestVSync(),
|
||||||
|
);
|
||||||
|
addTearDown(controller.dispose);
|
||||||
|
|
||||||
|
final Animation<double> secondaryAnimation = Tween<double>(
|
||||||
|
begin: 1,
|
||||||
|
end: 0,
|
||||||
|
).animate(controller);
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
CupertinoApp(
|
||||||
|
home: AnimatedBuilder(
|
||||||
|
animation: controller,
|
||||||
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
return CupertinoSheetTransition(
|
||||||
|
primaryRouteAnimation: controller,
|
||||||
|
secondaryRouteAnimation: secondaryAnimation,
|
||||||
|
linearTransition: false,
|
||||||
|
child: const SizedBox(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(SystemChrome.latestStyle!.statusBarBrightness, Brightness.dark);
|
||||||
|
expect(SystemChrome.latestStyle!.statusBarIconBrightness, Brightness.light);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user