pmu_flutter/lec6/lib/view/home_page/home_page_spinner.dart

24 lines
616 B
Dart

part of 'home_page.dart';
class _HomePageSpinner extends StatelessWidget {
const _HomePageSpinner();
@override
Widget build(BuildContext context) {
return BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) => Align(
alignment: state.data?.data?.isEmpty ?? true
? Alignment.topCenter
: Alignment.bottomCenter,
child: Visibility(
visible: state.isLoading,
child: const Padding(
padding: EdgeInsets.only(bottom: 32, top: 16),
child: CircularProgressIndicator(),
),
),
),
);
}
}