-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Navigation bar's color unable to restored after the picker was dismissed #35
Comments
Please provide the usage of your code. |
action(String name) async {
if (name == '相册') {
final List<AssetEntity> assets = await AssetPicker.pickAssets(context);
} else if (name == '拍摄') {
File file = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Camera(mode: CameraMode.fullscreen)));
} else{
}
} |
BottomNavigationBar color from white to black |
it‘s ok after Lock screen |
test phone is redmi 7 |
Can you provide a smallest demo to reproduce the issue? |
import 'package:flutter/material.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(),
floatingActionButton: FloatingActionButton(
onPressed: ()async{
final List<AssetEntity> assets = await AssetPicker.pickAssets(context);
},
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
} |
lock screen didn't fix it |
because your BottomNavigationBar is black |
Cannot reproduce, because the code you have provided starts with a black navigator on my side. |
but redme 7 defalut color is white |
Oh now it takes effect. |
Finish investigation, ref flutter/40590 . Add below line into the void main() {
runApp(MyApp());
WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = false;
} |
You can use a light theme to implement your picker, rather than a dark version. |
Though, it's not an issue from the picker. :-) |
void main() {
WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = false;
runApp(createApp());
}
Color barColor;
@override
initState() {
super.initState();
FlutterStatusbarcolor.getNavigationBarColor().then((value) {
if(value!=null)
barColor = value;
});
}
if(barColor!=null){
//android
if(barColor.value==Colors.white.value){
//底部为白色
await FlutterStatusbarcolor.setNavigationBarColor(Colors.black);
await FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
//状态栏的前景色需要区别,我的状态栏是白底黑字
await FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
final List<AssetEntity> assets = await AssetPicker.pickAssets(context);
//状态栏的前景色需要区别,我的状态栏是白底黑字
await FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
await FlutterStatusbarcolor.setNavigationBarColor(barColor);
await FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
}else{
//底部为黑色
await FlutterStatusbarcolor.setNavigationBarColor(Colors.white);
await FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
//状态栏的前景色需要区别
await FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
final List<AssetEntity> assets = await AssetPicker.pickAssets(context);
//状态栏的前景色需要区别
await FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
await FlutterStatusbarcolor.setNavigationBarColor(barColor);
await FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
}
}else{
//ios或回调未完成
await FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
final List<AssetEntity> assets = await AssetPicker.pickAssets(context);
//状态栏的前景色需要区别,我的状态栏是白底黑字
await FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
} it is my current solution |
The Locking this until the official one is resolved. |
Describe the bug (描述)
BottomNavigationBar color was changed after picker closed
How to reproduce (如何复现)
close picker
Steps to reproduce the behavior (描述复现步骤):
close picker
Expected behavior (期望行为)
Screenshots (If contains) (是否有截图可以提供)
If applicable, add screenshots to help explain your problem.
Device information (设备信息)
Additional context (附加信息)
Add any other context about the problem here. 在此提供更多的内容。
The text was updated successfully, but these errors were encountered: