mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
remove comment DevicesViewBody and fix home page
This commit is contained in:
@ -77,6 +77,7 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
static bool manageScene = false;
|
static bool manageScene = false;
|
||||||
static bool manageDeviceLocation = false;
|
static bool manageDeviceLocation = false;
|
||||||
static bool visitorPasswordManagement = false;
|
static bool visitorPasswordManagement = false;
|
||||||
|
String errorMsg = '';
|
||||||
|
|
||||||
Future<void> fetchPermissions() async {
|
Future<void> fetchPermissions() async {
|
||||||
try {
|
try {
|
||||||
@ -409,12 +410,11 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
return res['success'];
|
return res['success'];
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
final errorMessage = e.response?.data['error']['message'];
|
final errorMessage = e.response?.data['error']['message'];
|
||||||
emitSafe(ActivationError(errMessage: errorMessage));
|
errorMsg = e.response?.data['error']['message'];
|
||||||
return false;
|
emitSafe(ActivationError(errMessage: errorMsg));
|
||||||
} catch (e) {
|
|
||||||
emitSafe(ActivationError(errMessage: e.toString()));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////// Nav ///////////////////////////////////////
|
/////////////////////////////////////// Nav ///////////////////////////////////////
|
||||||
|
@ -14,8 +14,8 @@ class HomeError extends HomeState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class HomeSuccess extends HomeState {}
|
class HomeSuccess extends HomeState {}
|
||||||
class ActivationSuccess extends HomeState {}
|
|
||||||
|
|
||||||
|
class ActivationSuccess extends HomeState {}
|
||||||
|
|
||||||
class GetSpacesLoading extends HomeLoading {}
|
class GetSpacesLoading extends HomeLoading {}
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ class RoomSelected extends HomeState {
|
|||||||
class RoomUnSelected extends HomeState {}
|
class RoomUnSelected extends HomeState {}
|
||||||
|
|
||||||
class NavChangePage extends HomeState {}
|
class NavChangePage extends HomeState {}
|
||||||
class HomePermissionUpdated extends HomeState {}
|
|
||||||
|
|
||||||
|
class HomePermissionUpdated extends HomeState {}
|
||||||
|
|
||||||
class HomeUserInfoLoaded extends HomeState {
|
class HomeUserInfoLoaded extends HomeState {
|
||||||
final UserModel user;
|
final UserModel user;
|
||||||
|
@ -48,6 +48,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
return _instance ??= DevicesCubit._();
|
return _instance ??= DevicesCubit._();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() {
|
Future<void> close() {
|
||||||
_instance = null;
|
_instance = null;
|
||||||
@ -710,7 +711,6 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> changeGarageSwitch(
|
Future<void> changeGarageSwitch(
|
||||||
DeviceControlModel control, String deviceUuid) async {
|
DeviceControlModel control, String deviceUuid) async {
|
||||||
emit(SwitchControlLoading(code: control.code));
|
emit(SwitchControlLoading(code: control.code));
|
||||||
|
@ -1,138 +1,3 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
// import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
|
||||||
// import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/view/widgets/all_devices.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/view/widgets/wizard_page.dart';
|
|
||||||
// import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
|
|
||||||
// import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
|
||||||
// import 'package:syncrow_app/features/shared_widgets/create_unit.dart';
|
|
||||||
// import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
||||||
// import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
|
||||||
// import 'package:syncrow_app/utils/context_extension.dart';
|
|
||||||
// import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
|
||||||
|
|
||||||
// class DevicesViewPage extends StatelessWidget {
|
|
||||||
// const DevicesViewPage({super.key});
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return BlocProvider(
|
|
||||||
// create: (context) => SceneBloc(), // Initialize your SceneBloc here
|
|
||||||
// child: DevicesViewBody(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class DevicesViewBody extends StatelessWidget {
|
|
||||||
// const DevicesViewBody({
|
|
||||||
// super.key,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return BlocBuilder<DevicesCubit, DevicesState>(
|
|
||||||
// builder: (context, state) {
|
|
||||||
// if (state is DevicesLoading ||
|
|
||||||
// state is GetDevicesLoading ||
|
|
||||||
// state is DevicesCategoriesLoading) {
|
|
||||||
// return const Center(child: CircularProgressIndicator());
|
|
||||||
// } else {
|
|
||||||
// return HomeCubit.getInstance().spaces?.isEmpty ?? true
|
|
||||||
// ? const CreateUnitWidget()
|
|
||||||
// : Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// TitleMedium(
|
|
||||||
// text: StringsManager.devices,
|
|
||||||
// style: context.titleMedium.copyWith(
|
|
||||||
// fontSize: 25,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height: MediaQuery.of(context).size.height * 0.1,
|
|
||||||
// child: const SceneView(
|
|
||||||
// pageType: true,
|
|
||||||
// )),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 20,
|
|
||||||
// ),
|
|
||||||
// const RoomsSlider(),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 10,
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: PageView(
|
|
||||||
// controller:
|
|
||||||
// HomeCubit.getInstance().devicesPageController,
|
|
||||||
// onPageChanged: (index) {
|
|
||||||
// HomeCubit.getInstance().devicesPageChanged(index);
|
|
||||||
// print(index);
|
|
||||||
// if (index == 0) {
|
|
||||||
// context.read<DevicesCubit>().fetchAllDevices(HomeCubit.getInstance().selectedSpace);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// children: [
|
|
||||||
// AllDevices(
|
|
||||||
// allDevices: context.read<DevicesCubit>().allDevices,
|
|
||||||
// ),
|
|
||||||
// WizardPage(
|
|
||||||
// groupsList:
|
|
||||||
// DevicesCubit.getInstance().allCategories ?? [],
|
|
||||||
// ),
|
|
||||||
// if (HomeCubit.getInstance().selectedSpace != null)
|
|
||||||
// ...HomeCubit.getInstance()
|
|
||||||
// .selectedSpace!
|
|
||||||
// .subspaces
|
|
||||||
// .map(
|
|
||||||
// (room) {
|
|
||||||
// return RoomPage(
|
|
||||||
// room: room,
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// HomeCubit.getInstance().selectedSpace != null
|
|
||||||
// ? Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// vertical: 7,
|
|
||||||
// ),
|
|
||||||
// child: SmoothPageIndicator(
|
|
||||||
// controller:
|
|
||||||
// HomeCubit.getInstance().devicesPageController,
|
|
||||||
// count: HomeCubit.getInstance()
|
|
||||||
// .selectedSpace!
|
|
||||||
// .subspaces
|
|
||||||
// .length +
|
|
||||||
// 2,
|
|
||||||
// effect: const WormEffect(
|
|
||||||
// paintStyle: PaintingStyle.stroke,
|
|
||||||
// dotHeight: 8,
|
|
||||||
// dotWidth: 8,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : const Center(
|
|
||||||
// child: BodyLarge(text: 'No Home Found'),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||||
@ -151,48 +16,63 @@ import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
|||||||
|
|
||||||
class DevicesViewBody extends StatelessWidget {
|
class DevicesViewBody extends StatelessWidget {
|
||||||
const DevicesViewBody({Key? key}) : super(key: key);
|
const DevicesViewBody({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<HomeCubit, HomeState>(
|
return BlocBuilder<HomeCubit, HomeState>(
|
||||||
builder: (context, homeState) {
|
builder: (context, homeState) {
|
||||||
final homeCubit = HomeCubit.getInstance();
|
final homeCubit = HomeCubit.getInstance();
|
||||||
|
|
||||||
|
// Handle state priority: Errors first
|
||||||
|
if (homeState is ActivationError) {
|
||||||
|
return const CreateUnitWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle loading states
|
||||||
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
final spaces = homeCubit.spaces;
|
|
||||||
|
// Handle error states
|
||||||
|
if (homeState is GetSpacesError) {
|
||||||
|
return const CreateUnitWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle success states
|
||||||
|
if (homeState is GetSpacesSuccess ||
|
||||||
|
homeState is RoomUnSelected ||
|
||||||
|
homeState is RoomSelected ||
|
||||||
|
homeState is NavChangePage) {
|
||||||
|
// Show empty state if no spaces
|
||||||
|
if (homeCubit.spaces.isEmpty) {
|
||||||
|
return const CreateUnitWidget();
|
||||||
|
}
|
||||||
|
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, devicesState) {
|
builder: (context, devicesState) {
|
||||||
|
// Devices loading states
|
||||||
if (devicesState is DevicesLoading ||
|
if (devicesState is DevicesLoading ||
|
||||||
devicesState is DevicesCategoriesLoading ||
|
devicesState is DevicesCategoriesLoading ||
|
||||||
devicesState is GetDevicesLoading) {
|
devicesState is GetDevicesLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (spaces.isEmpty) {
|
|
||||||
return FutureBuilder(
|
|
||||||
future: Future.delayed(
|
|
||||||
const Duration(seconds: 1)),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return const Center(
|
|
||||||
child:
|
|
||||||
CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
if (spaces.isEmpty) {
|
|
||||||
return const CreateUnitWidget();
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Devices error state
|
||||||
if (devicesState is GetDevicesError) {
|
if (devicesState is GetDevicesError) {
|
||||||
return const Center(child: Text('Error'));
|
return Center(child: BodyLarge(text: devicesState.errorMsg));
|
||||||
}
|
}
|
||||||
if (devicesState is GetDevicesSuccess ||
|
// Main content for both GetSpacesSuccess and RoomUnSelected
|
||||||
devicesState is SwitchControlLoading ||
|
return _buildMainContent(context, homeCubit);
|
||||||
devicesState is DeviceControlSuccess ||
|
},
|
||||||
devicesState is DeviceControlError) {
|
);
|
||||||
if (spaces.isEmpty) {
|
}
|
||||||
return const CreateUnitWidget();
|
|
||||||
} else {
|
// Fallback for unknown states
|
||||||
|
return const Center(child: BodyLarge(text: ''));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
|
||||||
final devicesCubit = context.read<DevicesCubit>();
|
final devicesCubit = context.read<DevicesCubit>();
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
@ -220,18 +100,15 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
onPageChanged: (index) {
|
onPageChanged: (index) {
|
||||||
homeCubit.devicesPageChanged(index);
|
homeCubit.devicesPageChanged(index);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
devicesCubit.fetchAllDevices(
|
devicesCubit.fetchAllDevices(homeCubit.selectedSpace);
|
||||||
homeCubit.selectedSpace,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
AllDevices(
|
AllDevices(
|
||||||
allDevices: DevicesCubit.getInstance().allDevices,
|
allDevices: devicesCubit.allDevices,
|
||||||
),
|
),
|
||||||
WizardPage(
|
WizardPage(
|
||||||
groupsList:
|
groupsList: devicesCubit.allCategories ?? [],
|
||||||
DevicesCubit.getInstance().allCategories ?? [],
|
|
||||||
),
|
),
|
||||||
if (homeCubit.selectedSpace != null)
|
if (homeCubit.selectedSpace != null)
|
||||||
...homeCubit.selectedSpace!.subspaces.map(
|
...homeCubit.selectedSpace!.subspaces.map(
|
||||||
@ -240,13 +117,18 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
homeCubit.selectedSpace != null
|
_buildPageIndicator(homeCubit),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPageIndicator(HomeCubit homeCubit) {
|
||||||
|
return homeCubit.selectedSpace != null
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 7),
|
padding: const EdgeInsets.symmetric(vertical: 7),
|
||||||
child: SmoothPageIndicator(
|
child: SmoothPageIndicator(
|
||||||
controller: homeCubit.devicesPageController,
|
controller: homeCubit.devicesPageController,
|
||||||
count:
|
count: homeCubit.selectedSpace!.subspaces.length + 2,
|
||||||
homeCubit.selectedSpace!.subspaces.length + 2,
|
|
||||||
effect: const WormEffect(
|
effect: const WormEffect(
|
||||||
paintStyle: PaintingStyle.stroke,
|
paintStyle: PaintingStyle.stroke,
|
||||||
dotHeight: 8,
|
dotHeight: 8,
|
||||||
@ -256,15 +138,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: const Center(
|
: const Center(
|
||||||
child: BodyLarge(text: 'No Home Found'),
|
child: BodyLarge(text: 'No Home Found'),
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,12 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
class JoinHomeView extends StatelessWidget {
|
class JoinHomeView extends StatelessWidget {
|
||||||
const JoinHomeView({super.key});
|
const JoinHomeView({super.key});
|
||||||
@ -57,14 +59,93 @@ class JoinHomeView extends StatelessWidget {
|
|||||||
'Please enter the invitation code');
|
'Please enter the invitation code');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await HomeCubit.getInstance().activationCode(textEditingController.text)) {
|
if (await HomeCubit.getInstance()
|
||||||
|
.activationCode(textEditingController.text)) {
|
||||||
await HomeCubit.getInstance().fetchUnitsByUserId();
|
await HomeCubit.getInstance().fetchUnitsByUserId();
|
||||||
|
|
||||||
CustomSnackBar.displaySnackBar('Done successfully');
|
CustomSnackBar.displaySnackBar('Done successfully');
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} else {
|
} else {
|
||||||
CustomSnackBar.displaySnackBar('Wrong code!');
|
// CustomSnackBar.displaySnackBar('Wrong code!');
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
content: SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.2,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
const BodyLarge(
|
||||||
|
text: "Warning",
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontColor: ColorsManager.red,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 15, right: 15),
|
||||||
|
child: Divider(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
right: 20,
|
||||||
|
top: 15,
|
||||||
|
bottom: 20),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
HomeCubit.getInstance().errorMsg,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 5, bottom: 5),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Ok',
|
||||||
|
style: TextStyle(
|
||||||
|
color: ColorsManager
|
||||||
|
.switchButton
|
||||||
|
.withOpacity(0.6),
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
|
@ -16,7 +16,8 @@ class CreateUnitWidget extends StatelessWidget {
|
|||||||
TextEditingController textEditingController = TextEditingController();
|
TextEditingController textEditingController = TextEditingController();
|
||||||
return BlocConsumer<HomeCubit, HomeState>(
|
return BlocConsumer<HomeCubit, HomeState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
// if (state is ActivationError) {}
|
// if (state is ActivationError) {
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
@ -101,9 +102,6 @@ class CreateUnitWidget extends StatelessWidget {
|
|||||||
() {
|
() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
CustomSnackBar.displaySnackBar(
|
|
||||||
'Wrong code!');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -113,14 +111,14 @@ class CreateUnitWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// state is ActivationError
|
state is ActivationError
|
||||||
// ? Text(
|
? Text(
|
||||||
// state.errMessage,
|
state.errMessage,
|
||||||
// style: const TextStyle(
|
style: const TextStyle(
|
||||||
// color: ColorsManager.red,
|
color: ColorsManager.red,
|
||||||
// fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400),
|
||||||
// )
|
)
|
||||||
// : const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user