Skip to content

Commit

Permalink
connectivity condition for youtube home page
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Apr 11, 2024
1 parent f6a944d commit 561c234
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions lib/screens/screen/explore_screen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:Bloomee/blocs/explore/cubit/explore_cubits.dart';
import 'package:Bloomee/blocs/internet_connectivity/cubit/connectivity_cubit.dart';
import 'package:Bloomee/blocs/mediaPlayer/bloomee_player_cubit.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/screen/home_views/recents_view.dart';
import 'package:Bloomee/screens/widgets/more_bottom_sheet.dart';
import 'package:Bloomee/screens/widgets/sign_board_widget.dart';
import 'package:Bloomee/screens/widgets/song_tile.dart';
import 'package:Bloomee/services/db/cubit/bloomee_db_cubit.dart';
import 'package:Bloomee/utils/app_updater.dart';
Expand Down Expand Up @@ -127,13 +129,29 @@ class _ExploreScreenState extends State<ExploreScreen> {
),
),
),
BlocBuilder<YTMusicCubit, YTMusicCubitState>(
BlocBuilder<ConnectivityCubit, ConnectivityState>(
builder: (context, state) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
child: state is YTMusicCubitInitial
? const SizedBox()
: ytSection(state.ytmData),
child: switch (state) {
ConnectivityState.connected =>
BlocBuilder<YTMusicCubit, YTMusicCubitState>(
builder: (context, state) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
child: state is YTMusicCubitInitial
? const SizedBox()
: ytSection(state.ytmData),
);
},
),
ConnectivityState.disconnected =>
const SignBoardWidget(
message: "No Internet Connection",
icon: MingCute.wifi_off_line,
),
_ => const SizedBox()
},
);
},
),
Expand Down

0 comments on commit 561c234

Please sign in to comment.