mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
73 lines
2.8 KiB
Dart
73 lines
2.8 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 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),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|