Widget build(BuildContext context) {
return MaterialApp(
title: 'Trip App',
theme: ThemeData(
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
primarySwatch: Colors.blue,
),
home: FutureBuilder<dynamic>(
future: HiCache.preInit(), // 初始化预加载
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
// 异步操作状态已完成
if (snapshot.connectionState == ConnectionState.done) {
// 没有登录令牌,说明没有登录过,跳转到登录页
if (LoginDao.getBoardingPass() == null) {
return const Login();
} else {
return const Home();
}
} else {
// 初始化过程中,设置一个居中圆形的进度条
return const Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
},
));
}
} 我刚试了下添加了primarySwatch: Colors.blue, 还是没有生效