mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 13:14:55 +00:00
126 lines
5.1 KiB
Dart
126 lines
5.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.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/color_manager.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
|
|
|
class RoomsSlider extends StatelessWidget {
|
|
const RoomsSlider({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
|
builder: (context, state) {
|
|
return SizedBox(
|
|
height: 40,
|
|
child: PageView(
|
|
controller: SpacesCubit.get(context).roomsPageController,
|
|
onPageChanged: (index) {
|
|
SpacesCubit.get(context).roomSliderPageChanged(index);
|
|
},
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
child: InkWell(
|
|
onTap: () {
|
|
SpacesCubit.get(context).unselectRoom();
|
|
},
|
|
child: TitleMedium(
|
|
text: StringsManager.wizard,
|
|
style: context.titleMedium.copyWith(
|
|
fontSize: 25,
|
|
color: SpacesCubit.get(context).selectedRoom == null
|
|
? ColorsManager.textPrimaryColor
|
|
: ColorsManager.textPrimaryColor.withOpacity(.2),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
...SpacesCubit.get(context).selectedSpace.rooms.map(
|
|
(room) => Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
child: InkWell(
|
|
onTap: () {
|
|
SpacesCubit.get(context).roomSliderPageChanged(
|
|
SpacesCubit.get(context)
|
|
.selectedSpace
|
|
.rooms
|
|
.indexOf(room));
|
|
},
|
|
child: TitleMedium(
|
|
text: room.name,
|
|
style: context.titleMedium.copyWith(
|
|
fontSize: 25,
|
|
color: SpacesCubit.get(context).selectedRoom == room
|
|
? ColorsManager.textPrimaryColor
|
|
: ColorsManager.textPrimaryColor
|
|
.withOpacity(.2),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
|
|
// SingleChildScrollView(
|
|
// controller: SpacesCubit.get(context).roomsScrollController,
|
|
// scrollDirection: Axis.horizontal,
|
|
// child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
// children: [
|
|
// Padding(
|
|
// padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
// child: InkWell(
|
|
// onTap: () {
|
|
// SpacesCubit.get(context).unselectRoom();
|
|
// },
|
|
// child: TitleMedium(
|
|
// text: StringsManager.wizard,
|
|
// style: context.titleMedium.copyWith(
|
|
// fontSize: 25,
|
|
// color: SpacesCubit.get(context).selectedRoom == null
|
|
// ? ColorsManager.textPrimaryColor
|
|
// : ColorsManager.textPrimaryColor.withOpacity(.2),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ...SpacesCubit.get(context).selectedSpace.rooms.map(
|
|
// (room) => Padding(
|
|
// padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
// child: InkWell(
|
|
// onTap: () {
|
|
// SpacesCubit.get(context).selectRoom(room);
|
|
// },
|
|
// child: TitleMedium(
|
|
// text: room.name,
|
|
// style: context.titleMedium.copyWith(
|
|
// fontSize: 25,
|
|
// color: SpacesCubit.get(context).selectedRoomIndex ==
|
|
// SpacesCubit.get(context)
|
|
// .selectedSpace
|
|
// .rooms
|
|
// .indexOf(room) +
|
|
// 1
|
|
// ? ColorsManager.textPrimaryColor
|
|
// : ColorsManager.textPrimaryColor
|
|
// .withOpacity(.2),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// );
|
|
},
|
|
);
|
|
}
|
|
}
|