initialized Dashboard Page

This commit is contained in:
Mohammad Salameh
2024-02-20 12:08:59 +03:00
parent 0c390a8062
commit d27063f149
98 changed files with 1704 additions and 824 deletions
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../model/device_model.dart';
part 'devices_state.dart';
class DevicesCubit extends Cubit<DevicesState> {
DevicesCubit() : super(DevicesInitial()) {
getDevices();
}
//TODO separate the navigation logic to another cubit
static DevicesCubit get(context) => BlocProvider.of(context);
var devices = <DeviceModel>[];
Future<List<DeviceModel>> getDevices() async {
emit(DevicesLoading());
await Future.delayed(const Duration(seconds: 2));
emit(DevicesSuccess());
return devices = [];
}
}
@@ -0,0 +1,14 @@
part of 'devices_cubit.dart';
@immutable
abstract class DevicesState {}
class DevicesInitial extends DevicesState {}
class DevicesLoading extends DevicesState {}
class DevicesSuccess extends DevicesState {}
class DevicesFailure extends DevicesState {}
class ChangeIndex extends DevicesState {}