mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
count_down_ac
This commit is contained in:
@ -1,15 +1,142 @@
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/svg.dart';
|
||||
// import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||
// import 'package:syncrow_app/generated/assets.dart';
|
||||
// import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/generated/assets.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';
|
||||
|
||||
class CreateUnitWidget extends StatelessWidget {
|
||||
const CreateUnitWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
TextEditingController textEditingController = TextEditingController();
|
||||
return BlocConsumer<HomeCubit, HomeState>(
|
||||
listener: (context, state) {
|
||||
if (state is ActivationError) {}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'Join a Space',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.secondaryColor),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.assetsIconsMenuIconsHomeManagementIconsJoinAHome,
|
||||
width: 70,
|
||||
height: 70,
|
||||
color: ColorsManager.grayButtonColors,
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 30,
|
||||
),
|
||||
child: BodyMedium(
|
||||
fontWeight: FontWeight.w400,
|
||||
textAlign: TextAlign.center,
|
||||
text: 'Please enter your invitation code'),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: state is ActivationError
|
||||
? ColorsManager.red // Red border for error
|
||||
: ColorsManager
|
||||
.grayBox, // Default border color
|
||||
width: 1.5, // Border width
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.0), // Border radius
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
validator: (value) {},
|
||||
controller: textEditingController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Invitation code',
|
||||
hintStyle: context.bodyMedium.copyWith(
|
||||
color: Colors.grey,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (textEditingController.text.isEmpty) {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'Please enter the invitation code');
|
||||
return;
|
||||
}
|
||||
//3Hsn4X
|
||||
if (await HomeCubit.getInstance()
|
||||
.activationCode(
|
||||
textEditingController.text)) {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'Done successfully');
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'Wrong code!');
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.arrow_right_alt,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
state is ActivationError
|
||||
? Text(
|
||||
state.errMessage,
|
||||
style: const TextStyle(
|
||||
color: ColorsManager.red,
|
||||
fontWeight: FontWeight.w400),
|
||||
)
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
// return state is! GetSpacesLoading
|
||||
// ? state is! GetSpaceRoomsLoading
|
||||
// ? HomeCubit.getInstance().pages[HomeCubit.pageIndex]
|
||||
// : const Center(child: CircularProgressIndicator())
|
||||
// : const Center(child: CircularProgressIndicator());
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return SizedBox(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// height: MediaQuery.sizeOf(context).height,
|
||||
@ -47,5 +174,5 @@ class CreateUnitWidget extends StatelessWidget {
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
Reference in New Issue
Block a user