mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 18:27:55 +00:00
30 lines
959 B
Dart
30 lines
959 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/categories_view.dart';
|
|
|
|
import '../../bloc/devices_cubit.dart';
|
|
import 'no_devices_view.dart';
|
|
|
|
class DevicesViewBody extends StatelessWidget {
|
|
const DevicesViewBody({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (context) => DevicesCubit(),
|
|
child: BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return state is DevicesLoading
|
|
? const Center(child: CircularProgressIndicator())
|
|
: state is DevicesSuccess
|
|
? DevicesCubit.get(context).categories.isEmpty
|
|
? const NoDevicesView()
|
|
: const CategoriesView()
|
|
: const Center(child: Text('Error'));
|
|
},
|
|
));
|
|
}
|
|
}
|