fix: loading status widget on the signup page flickers.

This commit is contained in:
Lucas.Xu 2023-08-08 11:24:06 +08:00
parent 104851d330
commit 9dc209bda7

View File

@ -71,6 +71,8 @@ class SignInForm extends StatelessWidget {
@override
Widget build(BuildContext context) {
final isSubmitting = context.read<SignInBloc>().state.isSubmitting;
const indicatorMinHeight = 4.0;
return Align(
alignment: Alignment.center,
child: AuthFormContainer(
@ -104,13 +106,19 @@ class SignInForm extends StatelessWidget {
const VSpace(10),
const ThirdPartySignInButtons(),
const VSpace(20),
// loading status
if (context.read<SignInBloc>().state.isSubmitting) ...[
const SizedBox(height: 8),
const LinearProgressIndicator(value: null),
const VSpace(20),
],
...isSubmitting
? [
const VSpace(indicatorMinHeight),
const LinearProgressIndicator(
value: null,
minHeight: indicatorMinHeight,
),
]
: [
const VSpace(indicatorMinHeight * 2.0)
], // add the same space when there's no loading status.
const VSpace(20)
],
),
);