17681880207
V2EX  ›  Flutter

关于 SearchDelegate 中修改样式的问题

  •  
  •   17681880207 · Jun 14, 2019 · 9231 views
    This topic created in 2561 days ago, the information mentioned may be changed or developed.
      @override
      ThemeData appBarTheme(BuildContext context) {
        assert(context != null);
        final ThemeData theme = Theme.of(context);
        assert(theme != null);
        return theme.copyWith(
          primaryColor: Colors.white,
          primaryIconTheme: theme.primaryIconTheme.copyWith(color: Colors.grey),
          primaryColorBrightness: Brightness.light,
          primaryTextTheme: theme.textTheme,
        );
      }
    

    是不是只能修改这 4 中样式啊?我尝试了修改其他的样式,发现均无效。
    怎么修改默认的提示文字?默认的提示文字一直是 Search,跪求大佬帮忙解答下!不胜感激!

    3 replies    2019-06-19 18:55:54 +08:00
    17681880207
        2
    17681880207  
    OP
       Jun 19, 2019
    @StefanJ
    我看了这种方式,发现只是使用代理修改了原来定义的一个常量而已。字体、样式,包括 Textfield 都是无法修改的。如果实在不行,我在想是不是只能考虑自己写一个页面来实现。
    StefanJ
        3
    StefanJ  
       Jun 19, 2019
    使用内置的组件应该只能通过国际化修改,自定义样式就只能自己实现了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   896 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 19:27 · PVG 03:27 · LAX 12:27 · JFK 15:27
    ♥ Do have faith in what you're doing.