简体   繁体   中英

How to change the color of the back button in a CupertinoNavigationBar in Flutter

I would like to change the color of the back button in my flutter app.

Here is what I have at the moment: Screenshoot

I would like to change the color from light blu to white. I have searched online but found nothing. Here is my code (note my button is create automatically)

@override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        heroTag: 'menupage',
        transitionBetweenRoutes: false,
        middle: Text(
          'Menu Page',
          style: kSendButtonTextStyle,
        ),
      ),

Many thanks in advance !

Example

在此处输入图片说明 在此处输入图片说明

actionsForegroundColor: Colors.white in CupertinoNavigationBar

Do it

return  CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(actionsForegroundColor: Colors.white,
        heroTag: 'menupage',
        transitionBetweenRoutes: false,
        middle: Text(
          'Menu Page',
          style: TextStyle(),
        ),
      ), child: Text(''),
    );

I resolved with setting the CupertinoTextThemeData...

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      theme: CupertinoThemeData(
        primaryColor:
            Colors.white, //change color of the BOTTOM navbar icons when selected
        textTheme: CupertinoTextThemeData(
          primaryColor:
              Colors.white, //change color of the TOP navbar icon

Thanks Lucas for pointing me in the right direction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM