can we use API to change this color on iOS/Android in Flutter?
Asked
Active
Viewed 708 times
1

TeeTracker
- 7,064
- 8
- 40
- 46
-
You can try this answer https://stackoverflow.com/questions/49441187/how-to-change-status-bar-and-app-bar-color-in-flutter – David Sedlář Aug 15 '22 at 11:12
2 Answers
1
Yes, You can use API to change the color of the bottom safe area try with the below code. I hope your problem will be resolved.
@override
Widget build(BuildContext context) {
return FutureBuilder<ModelClassName>(
future: getColorFromAPI....,
builder:(context,snapshot){
final color = snapshot.data;
return Container(
color: color,
child: SafeArea(
top: false,
child: Scaffold(
resizeToAvoidBottomInset: false,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Change Bottom Bar Color',
),
],
),
),
),
),
),
}
);
}
}

Tina Detroja
- 124
- 6
-
this workaround works only when using AppBar, also it is not the goal, it would possibly change the status bar, this is not we want, because the goal is ONLY to change the region I pointed to. – TeeTracker Aug 15 '22 at 12:49
-
Remove app bar from code then also work.If i am not understand your problem then please tell me in detailed i will try to help you – Tina Detroja Aug 15 '22 at 12:55
-
What does the code above do? It changes the color of the in-app bottom bar to the color of the outside-app bottom navigation bar...? Coz I wanted to do the opposite. – Karolina Hagegård Jul 11 '23 at 14:28
-
The above code is used for change color of the bottom safe area of mobile.Please explain in detail what you need to change – Tina Detroja Jul 12 '23 at 12:31
0
If you want to use with Package try this
import 'package:flutter_statusbarcolor_ns/flutter_statusbarcolor_ns.dart';
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
Without package, Recommended solution (Flutter 2.0 and above)
You have to add in "main.dart" file so it's reflect overall application.
import 'package:flutter/services.dart';
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white
));

Nitin Gadhiya
- 359
- 1
- 7
-
-
1And it seems you also need to add `import 'package:flutter/services.dart';` at the top of the screen, isn't it? Plz add this to your answer, to make it fully functional. :) – Karolina Hagegård Jul 11 '23 at 15:40