mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 18:44:55 +00:00
Compare commits
1 Commits
SP-1569-fe
...
fix-calend
| Author | SHA1 | Date | |
|---|---|---|---|
| 5589e5b587 |
@ -1,9 +0,0 @@
|
|||||||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M38.0142 39.2553L35.3682 40H20.9308H19.9999H19.0691H1.24111C0.555643 40 0 39.4444 0 38.7589V1.24111C0 0.555643 0.555643 0 1.24111 0H19.0682H20.1226H20.9543H35.4255L38.2625 1.24111C38.9479 1.24111 39.5036 1.79675 39.5036 2.48221L39.2553 38.0142C39.2553 38.6997 38.6997 39.2553 38.0142 39.2553Z" fill="#E9E9E9"/>
|
|
||||||
<path d="M38.7585 0H35.0352C35.7206 0 36.2763 0.555643 36.2763 1.24111V38.7589C36.2763 39.4444 35.7206 40 35.0352 40H38.7585C39.4439 40 39.9996 39.4444 39.9996 38.7589V1.24111C39.9996 0.555643 39.4439 0 38.7585 0Z" fill="#D1D1D1"/>
|
|
||||||
<path opacity="0.6" d="M12.0283 31.8319V33.3212C12.0283 34.0067 11.6086 34.5623 11.0908 34.5623H6.96582C6.44804 34.5623 6.02832 34.0067 6.02832 33.3212V31.8319C6.02832 31.1465 6.44804 30.5908 6.96582 30.5908H11.0908C11.6086 30.5908 12.0283 31.1465 12.0283 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M12.0283 7.24109V8.73042C12.0283 9.41588 11.6086 9.97153 11.0908 9.97153H6.96582C6.44804 9.97153 6.02832 9.41588 6.02832 8.73042V7.24109C6.02832 6.55563 6.44804 5.99998 6.96582 5.99998H11.0908C11.6086 5.99998 12.0283 6.55563 12.0283 7.24109Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M26.0283 31.8319V33.3212C26.0283 34.0067 26.448 34.5623 26.9658 34.5623H31.0908C31.6086 34.5623 32.0283 34.0067 32.0283 33.3212V31.8319C32.0283 31.1465 31.6086 30.5908 31.0908 30.5908H26.9658C26.448 30.5908 26.0283 31.1465 26.0283 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M26.0283 7.24109V8.73042C26.0283 9.41588 26.448 9.97153 26.9658 9.97153H31.0908C31.6086 9.97153 32.0283 9.41588 32.0283 8.73042V7.24109C32.0283 6.55563 31.6086 5.99998 31.0908 5.99998H26.9658C26.448 5.99998 26.0283 6.55563 26.0283 7.24109Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path d="M19.0693 0H20.931V40H19.0693V0Z" fill="#D1D1D1"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB |
@ -1,12 +0,0 @@
|
|||||||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M38.0142 39.2553L35.3682 40H20.9308H19.9999H19.0691H1.24111C0.555643 40 0 39.4444 0 38.7589V1.24111C0 0.555651 0.555643 7.62939e-06 1.24111 7.62939e-06H19.0682H20.1226H20.9543H35.4255L38.2625 1.24111C38.9479 1.24111 39.5036 1.79676 39.5036 2.48222L39.2553 38.0142C39.2553 38.6997 38.6997 39.2553 38.0142 39.2553Z" fill="#E9E9E9"/>
|
|
||||||
<path d="M38.7585 0H35.0352C35.7206 0 36.2763 0.555643 36.2763 1.24111V38.7589C36.2763 39.4444 35.7206 40 35.0352 40H38.7585C39.4439 40 39.9996 39.4444 39.9996 38.7589V1.24111C39.9996 0.555643 39.4439 0 38.7585 0Z" fill="#D1D1D1"/>
|
|
||||||
<path opacity="0.6" d="M8.64062 31.8319V33.3212C8.64062 34.0067 8.22091 34.5623 7.70312 34.5623H3.57813C3.06034 34.5623 2.64062 34.0067 2.64062 33.3212V31.8319C2.64062 31.1464 3.06034 30.5908 3.57813 30.5908H7.70312C8.22091 30.5908 8.64062 31.1464 8.64062 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M8.64062 7.24109V8.73042C8.64062 9.41588 8.22091 9.97152 7.70312 9.97152H3.57813C3.06034 9.97152 2.64062 9.41588 2.64062 8.73042V7.24109C2.64062 6.55563 3.06034 5.99998 3.57813 5.99998H7.70312C8.22091 5.99998 8.64062 6.55563 8.64062 7.24109Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M27.6406 31.8319V33.3212C27.6406 34.0067 28.0603 34.5623 28.5781 34.5623H32.7031C33.2209 34.5623 33.6406 34.0067 33.6406 33.3212V31.8319C33.6406 31.1464 33.2209 30.5908 32.7031 30.5908H28.5781C28.0603 30.5908 27.6406 31.1464 27.6406 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M27.6406 7.24109V8.73042C27.6406 9.41588 28.0603 9.97152 28.5781 9.97152H32.7031C33.2209 9.97152 33.6406 9.41588 33.6406 8.73042V7.24109C33.6406 6.55563 33.2209 5.99998 32.7031 5.99998H28.5781C28.0603 5.99998 27.6406 6.55563 27.6406 7.24109Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M15.0625 31.8319V33.3212C15.0625 34.0067 15.4822 34.5623 16 34.5623H20.125C20.6428 34.5623 21.0625 34.0067 21.0625 33.3212V31.8319C21.0625 31.1464 20.6428 30.5908 20.125 30.5908H16C15.4822 30.5908 15.0625 31.1464 15.0625 31.8319Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path opacity="0.6" d="M15.0625 7.24109V8.73042C15.0625 9.41588 15.4822 9.97152 16 9.97152H20.125C20.6428 9.97152 21.0625 9.41588 21.0625 8.73042V7.24109C21.0625 6.55563 20.6428 5.99998 20.125 5.99998H16C15.4822 5.99998 15.0625 6.55563 15.0625 7.24109Z" fill="#023DFE" fill-opacity="0.5"/>
|
|
||||||
<path d="M23.125 0H24.9867V40H23.125V0Z" fill="#D1D1D1"/>
|
|
||||||
<path d="M11.1719 0H13.0335V40H11.1719V0Z" fill="#D1D1D1"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.5 KiB |
@ -10,7 +10,7 @@ part 'events_event.dart';
|
|||||||
part 'events_state.dart';
|
part 'events_state.dart';
|
||||||
|
|
||||||
class CalendarEventsBloc extends Bloc<CalendarEventsEvent, CalendarEventState> {
|
class CalendarEventsBloc extends Bloc<CalendarEventsEvent, CalendarEventState> {
|
||||||
final EventController eventController = EventController();
|
EventController eventController = EventController();
|
||||||
final CalendarSystemService calendarService;
|
final CalendarSystemService calendarService;
|
||||||
|
|
||||||
CalendarEventsBloc({
|
CalendarEventsBloc({
|
||||||
@ -20,7 +20,9 @@ class CalendarEventsBloc extends Bloc<CalendarEventsEvent, CalendarEventState> {
|
|||||||
on<AddEvent>(_onAddEvent);
|
on<AddEvent>(_onAddEvent);
|
||||||
on<DisposeResources>(_onDisposeResources);
|
on<DisposeResources>(_onDisposeResources);
|
||||||
on<GoToWeek>(_onGoToWeek);
|
on<GoToWeek>(_onGoToWeek);
|
||||||
|
on<ResetEvents>(_onResetEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onLoadEvents(
|
Future<void> _onLoadEvents(
|
||||||
LoadEvents event,
|
LoadEvents event,
|
||||||
Emitter<CalendarEventState> emit,
|
Emitter<CalendarEventState> emit,
|
||||||
@ -126,4 +128,18 @@ class CalendarEventsBloc extends Bloc<CalendarEventsEvent, CalendarEventState> {
|
|||||||
eventController.dispose();
|
eventController.dispose();
|
||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onResetEvents(
|
||||||
|
ResetEvents event,
|
||||||
|
Emitter<CalendarEventState> emit,
|
||||||
|
) {
|
||||||
|
if (calendarService is MemoryCalendarServiceWithRemoteFallback) {
|
||||||
|
(calendarService as MemoryCalendarServiceWithRemoteFallback)
|
||||||
|
.memoryService
|
||||||
|
.clear();
|
||||||
|
}
|
||||||
|
eventController.dispose();
|
||||||
|
eventController = EventController();
|
||||||
|
emit(EventsInitial());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,3 +29,10 @@ class CheckWeekHasEvents extends CalendarEventsEvent {
|
|||||||
final DateTime weekStart;
|
final DateTime weekStart;
|
||||||
const CheckWeekHasEvents(this.weekStart);
|
const CheckWeekHasEvents(this.weekStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ResetEvents extends CalendarEventsEvent {
|
||||||
|
const ResetEvents();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [];
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
// booking_page.dart
|
||||||
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:calendar_view/calendar_view.dart';
|
import 'package:calendar_view/calendar_view.dart';
|
||||||
@ -26,7 +27,33 @@ class BookingPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BookingPageState extends State<BookingPage> {
|
class _BookingPageState extends State<BookingPage> {
|
||||||
late final EventController _eventController;
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider(create: (_) => SelectedBookableSpaceBloc()),
|
||||||
|
BlocProvider(create: (_) => DateSelectionBloc()),
|
||||||
|
BlocProvider(
|
||||||
|
create: (_) => CalendarEventsBloc(
|
||||||
|
calendarService: MemoryCalendarServiceWithRemoteFallback(
|
||||||
|
remoteService: RemoteCalendarService(HTTPService()),
|
||||||
|
memoryService: MemoryCalendarService(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: _BookingPageContent(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BookingPageContent extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<_BookingPageContent> createState() => _BookingPageContentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BookingPageContentState extends State<_BookingPageContent> {
|
||||||
|
late EventController _eventController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -40,7 +67,7 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _dispatchLoadEvents(BuildContext context) {
|
void _loadEvents(BuildContext context) {
|
||||||
final selectedRoom =
|
final selectedRoom =
|
||||||
context.read<SelectedBookableSpaceBloc>().state.selectedBookableSpace;
|
context.read<SelectedBookableSpaceBloc>().state.selectedBookableSpace;
|
||||||
final dateState = context.read<DateSelectionBloc>().state;
|
final dateState = context.read<DateSelectionBloc>().state;
|
||||||
@ -60,35 +87,25 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MultiBlocProvider(
|
return BlocListener<SelectedBookableSpaceBloc, SelectedBookableSpaceState>(
|
||||||
providers: [
|
listener: (context, state) {
|
||||||
BlocProvider(create: (_) => SelectedBookableSpaceBloc()),
|
if (state.selectedBookableSpace != null) {
|
||||||
BlocProvider(create: (_) => DateSelectionBloc()),
|
// Reset events and clear cache when room changes
|
||||||
BlocProvider(
|
context.read<CalendarEventsBloc>().add(ResetEvents());
|
||||||
create: (_) => CalendarEventsBloc(
|
_loadEvents(context);
|
||||||
calendarService: MemoryCalendarServiceWithRemoteFallback(
|
}
|
||||||
remoteService: RemoteCalendarService(
|
},
|
||||||
HTTPService(),
|
child: BlocListener<DateSelectionBloc, DateSelectionState>(
|
||||||
),
|
listener: (context, state) {
|
||||||
memoryService: MemoryCalendarService(),
|
_loadEvents(context);
|
||||||
),
|
},
|
||||||
)),
|
child: BlocListener<CalendarEventsBloc, CalendarEventState>(
|
||||||
],
|
|
||||||
child: Builder(
|
|
||||||
builder: (context) =>
|
|
||||||
BlocListener<CalendarEventsBloc, CalendarEventState>(
|
|
||||||
listenWhen: (prev, curr) => curr is EventsLoaded,
|
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is EventsLoaded) {
|
if (state is EventsLoaded) {
|
||||||
_eventController.removeWhere((_) => true);
|
_eventController.removeWhere((_) => true);
|
||||||
_eventController.addAll(state.events);
|
_eventController.addAll(state.events);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: BlocListener<SelectedBookableSpaceBloc,
|
|
||||||
SelectedBookableSpaceState>(
|
|
||||||
listener: (context, state) => _dispatchLoadEvents(context),
|
|
||||||
child: BlocListener<DateSelectionBloc, DateSelectionState>(
|
|
||||||
listener: (context, state) => _dispatchLoadEvents(context),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -123,8 +140,8 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: BlocBuilder<DateSelectionBloc,
|
child:
|
||||||
DateSelectionState>(
|
BlocBuilder<DateSelectionBloc, DateSelectionState>(
|
||||||
builder: (context, dateState) {
|
builder: (context, dateState) {
|
||||||
return CustomCalendarPage(
|
return CustomCalendarPage(
|
||||||
selectedDate: dateState.selectedDate,
|
selectedDate: dateState.selectedDate,
|
||||||
@ -169,8 +186,7 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
BlocBuilder<DateSelectionBloc,
|
BlocBuilder<DateSelectionBloc, DateSelectionState>(
|
||||||
DateSelectionState>(
|
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final weekStart = state.weekStart;
|
final weekStart = state.weekStart;
|
||||||
final weekEnd =
|
final weekEnd =
|
||||||
@ -193,6 +209,7 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: BlocBuilder<SelectedBookableSpaceBloc,
|
child: BlocBuilder<SelectedBookableSpaceBloc,
|
||||||
@ -203,22 +220,16 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
return BlocBuilder<DateSelectionBloc,
|
return BlocBuilder<DateSelectionBloc,
|
||||||
DateSelectionState>(
|
DateSelectionState>(
|
||||||
builder: (context, dateState) {
|
builder: (context, dateState) {
|
||||||
return BlocListener<CalendarEventsBloc,
|
return BlocBuilder<CalendarEventsBloc,
|
||||||
CalendarEventState>(
|
CalendarEventState>(
|
||||||
listenWhen: (prev, curr) =>
|
builder: (context, eventState) {
|
||||||
curr is EventsLoaded,
|
return WeeklyCalendarPage(
|
||||||
listener: (context, state) {
|
key: ValueKey(
|
||||||
if (state is EventsLoaded) {
|
selectedRoom?.uuid ?? 'no-room'),
|
||||||
_eventController
|
|
||||||
.removeWhere((_) => true);
|
|
||||||
_eventController.addAll(state.events);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: WeeklyCalendarPage(
|
|
||||||
startTime: selectedRoom
|
startTime: selectedRoom
|
||||||
?.bookableConfig.startTime,
|
?.bookableConfig.startTime,
|
||||||
endTime: selectedRoom
|
endTime:
|
||||||
?.bookableConfig.endTime,
|
selectedRoom?.bookableConfig.endTime,
|
||||||
weekStart: dateState.weekStart,
|
weekStart: dateState.weekStart,
|
||||||
selectedDate: dateState.selectedDate,
|
selectedDate: dateState.selectedDate,
|
||||||
eventController: _eventController,
|
eventController: _eventController,
|
||||||
@ -226,7 +237,9 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
.watch<DateSelectionBloc>()
|
.watch<DateSelectionBloc>()
|
||||||
.state
|
.state
|
||||||
.selectedDateFromSideBarCalender,
|
.selectedDateFromSideBarCalender,
|
||||||
),
|
// isLoading: eventState is EventsLoading,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -241,8 +254,6 @@ class _BookingPageState extends State<BookingPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,21 +76,29 @@ class __SidebarContentState extends State<_SidebarContent> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const _SidebarHeader(title: 'Spaces'),
|
Padding(
|
||||||
Container(
|
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: ColorsManager.blackColor.withOpacity(0.1),
|
color: ColorsManager.blackColor.withOpacity(0.1),
|
||||||
offset: const Offset(0, -2),
|
offset: const Offset(0, 4),
|
||||||
blurRadius: 4,
|
blurRadius: 4,
|
||||||
spreadRadius: 0,
|
spreadRadius: 0,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _SidebarHeader(title: 'Spaces')),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ColorsManager.whiteColors,
|
||||||
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: ColorsManager.blackColor.withOpacity(0.1),
|
color: ColorsManager.blackColor.withOpacity(0.1),
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 4),
|
||||||
blurRadius: 4,
|
blurRadius: 4,
|
||||||
spreadRadius: 0,
|
spreadRadius: 0,
|
||||||
),
|
),
|
||||||
@ -220,7 +228,7 @@ class _SidebarHeader extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -66,7 +66,16 @@ class _CustomCalendarPageState extends State<CustomCalendarPage> {
|
|||||||
weekdayLabels: const ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
weekdayLabels: const ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
||||||
);
|
);
|
||||||
|
|
||||||
return CalendarDatePicker2(
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: CalendarDatePicker2(
|
||||||
config: config,
|
config: config,
|
||||||
value: [_selectedDate],
|
value: [_selectedDate],
|
||||||
onValueChanged: (dates) {
|
onValueChanged: (dates) {
|
||||||
@ -78,6 +87,7 @@ class _CustomCalendarPageState extends State<CustomCalendarPage> {
|
|||||||
widget.onDateChanged(picked.day, picked.month, picked.year);
|
widget.onDateChanged(picked.day, picked.month, picked.year);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,15 +32,17 @@ class EventTileWidget extends StatelessWidget {
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.all(5),
|
padding: const EdgeInsets.all(5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isEventEnded
|
color: isEventEnded
|
||||||
? ColorsManager.grayColor.withOpacity(0.1)
|
? ColorsManager.grayColor.withOpacity(0.1)
|
||||||
: ColorsManager.blue1.withOpacity(0.1),
|
: ColorsManager.blue1.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
border: const Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: ColorsManager.grayColor,
|
color: isEventEnded
|
||||||
|
? ColorsManager.grayColor
|
||||||
|
: ColorsManager.secondaryColor,
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class RoomListItem extends StatelessWidget {
|
|||||||
groupValue: isSelected ? room.uuid : null,
|
groupValue: isSelected ? room.uuid : null,
|
||||||
visualDensity: const VisualDensity(vertical: -4),
|
visualDensity: const VisualDensity(vertical: -4),
|
||||||
onChanged: (value) => onTap(),
|
onChanged: (value) => onTap(),
|
||||||
activeColor: ColorsManager.primaryColor,
|
activeColor: ColorsManager.secondaryColor,
|
||||||
title: Text(
|
title: Text(
|
||||||
room.spaceName,
|
room.spaceName,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
|
|||||||
@ -14,26 +14,33 @@ class WeekDayHeader extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return ColoredBox(
|
||||||
|
color: isSelectedDay
|
||||||
|
? ColorsManager.secondaryColor.withOpacity(0.1)
|
||||||
|
: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
DateFormat('EEE').format(date).toUpperCase(),
|
DateFormat('EEE').format(date).toUpperCase(),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: isSelectedDay ? Colors.blue : Colors.black,
|
color: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
DateFormat('d').format(date),
|
DateFormat('d').format(date),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
fontSize: 20,
|
fontSize: 30,
|
||||||
color:
|
color: ColorsManager.blackColor,
|
||||||
isSelectedDay ? ColorsManager.blue1 : ColorsManager.blackColor,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,13 +57,10 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const double timeLineWidth = 90;
|
||||||
|
|
||||||
const double timeLineWidth = 65;
|
|
||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
|
|
||||||
bool isInRange(DateTime date, DateTime start, DateTime end) {
|
bool isInRange(DateTime date, DateTime start, DateTime end) {
|
||||||
!date.isBefore(start) && !date.isAfter(end);
|
!date.isBefore(start) && !date.isAfter(end);
|
||||||
// remove this line and Check if the date is within the range
|
// remove this line and Check if the date is within the range
|
||||||
@ -100,7 +97,6 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
width: width,
|
width: width,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.orange.withOpacity(0.13),
|
color: Colors.orange.withOpacity(0.13),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (isSelected) {
|
} else if (isSelected) {
|
||||||
@ -110,7 +106,6 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color:
|
||||||
ColorsManager.spaceColor.withOpacity(0.07),
|
ColorsManager.spaceColor.withOpacity(0.07),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -143,7 +138,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
heightPerMinute: 1.7,
|
heightPerMinute: 1.7,
|
||||||
showLiveTimeLineInAllDays: false,
|
showLiveTimeLineInAllDays: false,
|
||||||
showVerticalLines: true,
|
showVerticalLines: true,
|
||||||
emulateVerticalOffsetBy: -80,
|
emulateVerticalOffsetBy: -95,
|
||||||
startDay: WeekDays.monday,
|
startDay: WeekDays.monday,
|
||||||
liveTimeIndicatorSettings:
|
liveTimeIndicatorSettings:
|
||||||
const LiveTimeIndicatorSettings(
|
const LiveTimeIndicatorSettings(
|
||||||
@ -161,7 +156,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
timeLineWidth: timeLineWidth,
|
timeLineWidth: timeLineWidth,
|
||||||
weekPageHeaderBuilder: (start, end) => Container(),
|
weekPageHeaderBuilder: (start, end) => Container(),
|
||||||
weekTitleHeight: 60,
|
weekTitleHeight: 90,
|
||||||
weekNumberBuilder: (firstDayOfWeek) => Padding(
|
weekNumberBuilder: (firstDayOfWeek) => Padding(
|
||||||
padding: const EdgeInsets.only(right: 15, bottom: 10),
|
padding: const EdgeInsets.only(right: 15, bottom: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -208,8 +203,6 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSameDay(DateTime d1, DateTime d2) {
|
bool isSameDay(DateTime d1, DateTime d2) {
|
||||||
|
|||||||
@ -100,7 +100,6 @@ class _DeviceItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return DeviceControlsContainer(
|
return DeviceControlsContainer(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -103,9 +103,7 @@ class SpaceDetailsDevicesBox extends StatelessWidget {
|
|||||||
).then((resultSpace) {
|
).then((resultSpace) {
|
||||||
if (resultSpace != null) {
|
if (resultSpace != null) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context
|
context.read<SpaceDetailsModelBloc>().add(UpdateSpaceDetails(resultSpace));
|
||||||
.read<SpaceDetailsModelBloc>()
|
|
||||||
.add(UpdateSpaceDetails(resultSpace));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -135,9 +133,6 @@ class SpaceDetailsDevicesBox extends StatelessWidget {
|
|||||||
DeviceType.ThreeTouch => Assets.gangSwitch,
|
DeviceType.ThreeTouch => Assets.gangSwitch,
|
||||||
DeviceType.NCPS => Assets.sensors,
|
DeviceType.NCPS => Assets.sensors,
|
||||||
DeviceType.PC => Assets.powerClamp,
|
DeviceType.PC => Assets.powerClamp,
|
||||||
DeviceType.fourSceen => Assets.fourSceenSwitch,
|
|
||||||
DeviceType.sixSceen => Assets.sixSceenSwitch,
|
|
||||||
DeviceType.SOS => Assets.sos,
|
|
||||||
DeviceType.Other => Assets.blackLogo,
|
DeviceType.Other => Assets.blackLogo,
|
||||||
null => Assets.blackLogo,
|
null => Assets.blackLogo,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -84,14 +84,6 @@ class DeviceModel {
|
|||||||
tempIcon = Assets.curtainIcon;
|
tempIcon = Assets.curtainIcon;
|
||||||
} else if (type == DeviceType.Curtain) {
|
} else if (type == DeviceType.Curtain) {
|
||||||
tempIcon = Assets.curtainIcon;
|
tempIcon = Assets.curtainIcon;
|
||||||
} else if (type == DeviceType.fourSceen) {
|
|
||||||
tempIcon = Assets.fourSceenSwitch;
|
|
||||||
} else if (type == DeviceType.sixSceen) {
|
|
||||||
tempIcon = Assets.sixSceenSwitch;
|
|
||||||
} else if (type == DeviceType.SOS) {
|
|
||||||
tempIcon = Assets.sos;
|
|
||||||
} else if (type == DeviceType.NCPS) {
|
|
||||||
tempIcon = Assets.presenceSensor;
|
|
||||||
} else {
|
} else {
|
||||||
tempIcon = Assets.blackLogo;
|
tempIcon = Assets.blackLogo;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,6 +140,5 @@ abstract class ApiEndpoints {
|
|||||||
static const String saveSchedule = '/schedule/{deviceUuid}';
|
static const String saveSchedule = '/schedule/{deviceUuid}';
|
||||||
|
|
||||||
static const String getBookableSpaces = '/bookable-spaces';
|
static const String getBookableSpaces = '/bookable-spaces';
|
||||||
static const String getBookings =
|
static const String getBookings = '/bookings?month={mm}-{yyyy}&space={space}';
|
||||||
'/bookings?month={mm}%2F{yyyy}&space={space}';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,6 @@ class Assets {
|
|||||||
static const String webBackground = 'assets/images/web_Background.svg';
|
static const String webBackground = 'assets/images/web_Background.svg';
|
||||||
static const String webBackgroundPng = 'assets/images/web_Background.png';
|
static const String webBackgroundPng = 'assets/images/web_Background.png';
|
||||||
static const String blackLogo = 'assets/images/black-logo.png';
|
static const String blackLogo = 'assets/images/black-logo.png';
|
||||||
static const String fourSceenSwitch = 'assets/images/4_sceen_switch.svg';
|
|
||||||
static const String sixSceenSwitch = 'assets/images/6_sceen_switch.svg';
|
|
||||||
static const String logo = 'assets/images/Logo.svg';
|
static const String logo = 'assets/images/Logo.svg';
|
||||||
static const String logoHorizontal = 'assets/images/logo_horizontal.png';
|
static const String logoHorizontal = 'assets/images/logo_horizontal.png';
|
||||||
static const String vector = 'assets/images/Vector.png';
|
static const String vector = 'assets/images/Vector.png';
|
||||||
|
|||||||
@ -21,9 +21,6 @@ enum DeviceType {
|
|||||||
NCPS,
|
NCPS,
|
||||||
DoorSensor,
|
DoorSensor,
|
||||||
PC,
|
PC,
|
||||||
fourSceen,
|
|
||||||
sixSceen,
|
|
||||||
SOS,
|
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -66,7 +63,4 @@ Map<String, DeviceType> devicesTypesMap = {
|
|||||||
'WL': DeviceType.WaterLeak,
|
'WL': DeviceType.WaterLeak,
|
||||||
'NCPS': DeviceType.NCPS,
|
'NCPS': DeviceType.NCPS,
|
||||||
'PC': DeviceType.PC,
|
'PC': DeviceType.PC,
|
||||||
'4S': DeviceType.fourSceen,
|
|
||||||
'6S': DeviceType.sixSceen,
|
|
||||||
'SOS': DeviceType.SOS,
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user