fix: when snapshot.hasError is true, text has not been initialized

This commit is contained in:
qiang.zeng
2024-03-13 11:14:28 +08:00
parent faed5cd624
commit 8bfa824677

View File

@ -23,6 +23,9 @@ class IntroMessage extends StatelessWidget {
return FutureBuilder(
future: introData(),
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.hasError) {
return const ErrorMessage(message: "An error occured");
}
if (snapshot.connectionState == ConnectionState.done) {
if (Theme.of(context).brightness == Brightness.dark) {
text = text.replaceAll("{{mode}}", "dark");
@ -37,9 +40,6 @@ class IntroMessage extends StatelessWidget {
padding: kPh60,
);
}
if (snapshot.hasError) {
return const ErrorMessage(message: "An error occured");
}
return const Center(child: CircularProgressIndicator());
},
);