Browse Source

MaterialApp设置title,解决在某些设备的任务列表里不显示app名字的问题

gjh 4 days ago
parent
commit
936f242fc1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lib/main.dart

+ 4 - 0
lib/main.dart

@@ -93,6 +93,10 @@ class MyApp extends StatelessWidget {
93 93
           designSize: size,
94 94
           child: MaterialApp.router(
95 95
             //debugShowCheckedModeBanner: false,
96
+            onGenerateTitle: (ctx) => switch (appFlavor) {
97
+              flavorHst => S.of(ctx).appNameHst,
98
+              _ => S.of(ctx).appName
99
+            },
96 100
             builder: (ctx, child) {
97 101
               return botToastBuilder(ctx, child);
98 102
             },