mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 02:57:55 +00:00
Implemented home creation and add counter to the sign up screen
This commit is contained in:
+21
-1
@@ -11,6 +11,8 @@ 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_small.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
@@ -26,6 +28,14 @@ class CreateUnitView extends StatelessWidget {
|
||||
return BlocProvider(
|
||||
create: (context) => CreateUnitBloc(),
|
||||
child: BlocConsumer<CreateUnitBloc, CreateUnitState>(listener: (context, state) {
|
||||
if (state is RoomsSavedSuccessfully) {
|
||||
CustomSnackBar.displaySnackBar('Saved successfully');
|
||||
NavigationService.navigatorKey.currentState!.pushNamedAndRemoveUntil(
|
||||
Routes.homeRoute,
|
||||
(Route route) => false,
|
||||
);
|
||||
}
|
||||
|
||||
if (state is ErrorState) {
|
||||
CustomSnackBar.displaySnackBar(state.message);
|
||||
}
|
||||
@@ -34,7 +44,17 @@ class CreateUnitView extends StatelessWidget {
|
||||
return DefaultScaffold(
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
if (unitName.isNotEmpty) {
|
||||
BlocProvider.of<CreateUnitBloc>(context).add(SaveRooms(
|
||||
communityName: 'Community Test',
|
||||
buildingName: 'Building Test',
|
||||
floorName: 'Floor Test',
|
||||
unitName: unitName));
|
||||
} else {
|
||||
CustomSnackBar.displaySnackBar('Please enter the unit name');
|
||||
}
|
||||
},
|
||||
child: const BodyLarge(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.bold,
|
||||
Reference in New Issue
Block a user