mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 03:44:56 +00:00
Compare commits
2 Commits
fix-week-n
...
SP-1569-fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 68153e41ed | |||
| 0ad562b6ce |
9
assets/images/4_sceen_switch.svg
Normal file
9
assets/images/4_sceen_switch.svg
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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>
|
||||||
|
After Width: | Height: | Size: 1.9 KiB |
12
assets/images/6_sceen_switch.svg
Normal file
12
assets/images/6_sceen_switch.svg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<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>
|
||||||
|
After Width: | Height: | Size: 2.5 KiB |
@ -1,9 +1,22 @@
|
|||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/firebase_options.dart';
|
import 'package:syncrow_web/firebase_options.dart';
|
||||||
|
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||||
import 'package:syncrow_web/services/locator.dart';
|
import 'package:syncrow_web/services/locator.dart';
|
||||||
import 'package:syncrow_web/syncrow_app.dart';
|
import 'package:syncrow_web/utils/app_routes.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||||
|
import 'package:syncrow_web/utils/navigation_service.dart';
|
||||||
|
import 'package:syncrow_web/utils/theme/theme.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
try {
|
try {
|
||||||
@ -20,5 +33,59 @@ Future<void> main() async {
|
|||||||
);
|
);
|
||||||
initialSetup();
|
initialSetup();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
runApp(const SyncrowApp());
|
runApp(MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
MyApp({super.key});
|
||||||
|
|
||||||
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: RoutesConst.auth,
|
||||||
|
routes: AppRoutes.getRoutes(),
|
||||||
|
redirect: (context, state) async {
|
||||||
|
final checkToken = await AuthBloc.getTokenAndValidate();
|
||||||
|
final loggedIn = checkToken == 'Success';
|
||||||
|
final goingToLogin = state.uri.toString() == RoutesConst.auth;
|
||||||
|
|
||||||
|
if (!loggedIn && !goingToLogin) return RoutesConst.auth;
|
||||||
|
if (loggedIn && goingToLogin) return RoutesConst.home;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider<CreateRoutineBloc>(
|
||||||
|
create: (context) => CreateRoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(create: (context) => HomeBloc()..add(const FetchUserInfo())),
|
||||||
|
BlocProvider<VisitorPasswordBloc>(
|
||||||
|
create: (context) => VisitorPasswordBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<RoutineBloc>(
|
||||||
|
create: (context) => RoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<SpaceTreeBloc>(
|
||||||
|
create: (context) => SpaceTreeBloc(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: MaterialApp.router(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
||||||
|
dragDevices: {
|
||||||
|
PointerDeviceKind.mouse,
|
||||||
|
PointerDeviceKind.touch,
|
||||||
|
PointerDeviceKind.stylus,
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
key: NavigationService.navigatorKey,
|
||||||
|
// scaffoldMessengerKey: NavigationService.snackbarKey,
|
||||||
|
theme: myTheme,
|
||||||
|
routerConfig: _router,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,22 @@
|
|||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/firebase_options.dart';
|
import 'package:syncrow_web/firebase_options.dart';
|
||||||
|
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||||
import 'package:syncrow_web/services/locator.dart';
|
import 'package:syncrow_web/services/locator.dart';
|
||||||
import 'package:syncrow_web/syncrow_app.dart';
|
import 'package:syncrow_web/utils/app_routes.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||||
|
import 'package:syncrow_web/utils/navigation_service.dart';
|
||||||
|
import 'package:syncrow_web/utils/theme/theme.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
try {
|
try {
|
||||||
@ -20,5 +33,59 @@ Future<void> main() async {
|
|||||||
);
|
);
|
||||||
initialSetup();
|
initialSetup();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
runApp(const SyncrowApp());
|
runApp(MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
MyApp({super.key});
|
||||||
|
|
||||||
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: RoutesConst.auth,
|
||||||
|
routes: AppRoutes.getRoutes(),
|
||||||
|
redirect: (context, state) async {
|
||||||
|
final checkToken = await AuthBloc.getTokenAndValidate();
|
||||||
|
final loggedIn = checkToken == 'Success';
|
||||||
|
final goingToLogin = state.uri.toString() == RoutesConst.auth;
|
||||||
|
|
||||||
|
if (!loggedIn && !goingToLogin) return RoutesConst.auth;
|
||||||
|
if (loggedIn && goingToLogin) return RoutesConst.home;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider<CreateRoutineBloc>(
|
||||||
|
create: (context) => CreateRoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(create: (context) => HomeBloc()..add(const FetchUserInfo())),
|
||||||
|
BlocProvider<VisitorPasswordBloc>(
|
||||||
|
create: (context) => VisitorPasswordBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<RoutineBloc>(
|
||||||
|
create: (context) => RoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<SpaceTreeBloc>(
|
||||||
|
create: (context) => SpaceTreeBloc(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: MaterialApp.router(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
||||||
|
dragDevices: {
|
||||||
|
PointerDeviceKind.mouse,
|
||||||
|
PointerDeviceKind.touch,
|
||||||
|
PointerDeviceKind.stylus,
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
key: NavigationService.navigatorKey,
|
||||||
|
// scaffoldMessengerKey: NavigationService.snackbarKey,
|
||||||
|
theme: myTheme,
|
||||||
|
routerConfig: _router,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,26 @@
|
|||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/firebase_options.dart';
|
import 'package:syncrow_web/firebase_options.dart';
|
||||||
|
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||||
import 'package:syncrow_web/services/locator.dart';
|
import 'package:syncrow_web/services/locator.dart';
|
||||||
import 'package:syncrow_web/syncrow_app.dart';
|
import 'package:syncrow_web/utils/app_routes.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||||
|
import 'package:syncrow_web/utils/navigation_service.dart';
|
||||||
|
import 'package:syncrow_web/utils/theme/theme.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
try {
|
try {
|
||||||
const environment = String.fromEnvironment(
|
const environment = String.fromEnvironment('FLAVOR', defaultValue: 'staging');
|
||||||
'FLAVOR',
|
|
||||||
defaultValue: 'staging',
|
|
||||||
);
|
|
||||||
await dotenv.load(fileName: '.env.$environment');
|
await dotenv.load(fileName: '.env.$environment');
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
@ -20,5 +30,59 @@ Future<void> main() async {
|
|||||||
);
|
);
|
||||||
initialSetup();
|
initialSetup();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
runApp(const SyncrowApp());
|
runApp(MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
MyApp({super.key});
|
||||||
|
|
||||||
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: RoutesConst.auth,
|
||||||
|
routes: AppRoutes.getRoutes(),
|
||||||
|
redirect: (context, state) async {
|
||||||
|
final checkToken = await AuthBloc.getTokenAndValidate();
|
||||||
|
final loggedIn = checkToken == 'Success';
|
||||||
|
final goingToLogin = state.uri.toString() == RoutesConst.auth;
|
||||||
|
|
||||||
|
if (!loggedIn && !goingToLogin) return RoutesConst.auth;
|
||||||
|
if (loggedIn && goingToLogin) return RoutesConst.home;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider<CreateRoutineBloc>(
|
||||||
|
create: (context) => CreateRoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider(create: (context) => HomeBloc()..add(const FetchUserInfo())),
|
||||||
|
BlocProvider<VisitorPasswordBloc>(
|
||||||
|
create: (context) => VisitorPasswordBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<RoutineBloc>(
|
||||||
|
create: (context) => RoutineBloc(),
|
||||||
|
),
|
||||||
|
BlocProvider<SpaceTreeBloc>(
|
||||||
|
create: (context) => SpaceTreeBloc(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: MaterialApp.router(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
||||||
|
dragDevices: {
|
||||||
|
PointerDeviceKind.mouse,
|
||||||
|
PointerDeviceKind.touch,
|
||||||
|
PointerDeviceKind.stylus,
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
key: NavigationService.navigatorKey,
|
||||||
|
// scaffoldMessengerKey: NavigationService.snackbarKey,
|
||||||
|
theme: myTheme,
|
||||||
|
routerConfig: _router,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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> {
|
||||||
EventController eventController = EventController();
|
final EventController eventController = EventController();
|
||||||
final CalendarSystemService calendarService;
|
final CalendarSystemService calendarService;
|
||||||
|
|
||||||
CalendarEventsBloc({
|
CalendarEventsBloc({
|
||||||
@ -20,9 +20,7 @@ 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,
|
||||||
@ -128,18 +126,4 @@ 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,10 +29,3 @@ 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 => [];
|
|
||||||
}
|
|
||||||
@ -26,33 +26,7 @@ class BookingPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _BookingPageState extends State<BookingPage> {
|
class _BookingPageState extends State<BookingPage> {
|
||||||
@override
|
late final EventController _eventController;
|
||||||
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() {
|
||||||
@ -66,7 +40,7 @@ class _BookingPageContentState extends State<_BookingPageContent> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadEvents(BuildContext context) {
|
void _dispatchLoadEvents(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;
|
||||||
@ -86,168 +60,186 @@ class _BookingPageContentState extends State<_BookingPageContent> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocListener<SelectedBookableSpaceBloc, SelectedBookableSpaceState>(
|
return MultiBlocProvider(
|
||||||
listener: (context, state) {
|
providers: [
|
||||||
if (state.selectedBookableSpace != null) {
|
BlocProvider(create: (_) => SelectedBookableSpaceBloc()),
|
||||||
context.read<CalendarEventsBloc>().add(const ResetEvents());
|
BlocProvider(create: (_) => DateSelectionBloc()),
|
||||||
_loadEvents(context);
|
BlocProvider(
|
||||||
}
|
create: (_) => CalendarEventsBloc(
|
||||||
},
|
calendarService: MemoryCalendarServiceWithRemoteFallback(
|
||||||
child: BlocListener<DateSelectionBloc, DateSelectionState>(
|
remoteService: RemoteCalendarService(
|
||||||
listener: (context, state) {
|
HTTPService(),
|
||||||
_loadEvents(context);
|
),
|
||||||
},
|
memoryService: MemoryCalendarService(),
|
||||||
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: Row(
|
child: BlocListener<SelectedBookableSpaceBloc,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
SelectedBookableSpaceState>(
|
||||||
children: [
|
listener: (context, state) => _dispatchLoadEvents(context),
|
||||||
Expanded(
|
child: BlocListener<DateSelectionBloc, DateSelectionState>(
|
||||||
child: Container(
|
listener: (context, state) => _dispatchLoadEvents(context),
|
||||||
decoration: BoxDecoration(
|
child: Row(
|
||||||
color: ColorsManager.whiteColors,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
boxShadow: [
|
children: [
|
||||||
BoxShadow(
|
Expanded(
|
||||||
color: ColorsManager.blackColor.withOpacity(0.1),
|
child: Container(
|
||||||
offset: const Offset(3, 0),
|
decoration: BoxDecoration(
|
||||||
blurRadius: 6,
|
color: ColorsManager.whiteColors,
|
||||||
spreadRadius: 0,
|
boxShadow: [
|
||||||
),
|
BoxShadow(
|
||||||
],
|
color: ColorsManager.blackColor.withOpacity(0.1),
|
||||||
),
|
offset: const Offset(3, 0),
|
||||||
child: Column(
|
blurRadius: 6,
|
||||||
children: [
|
spreadRadius: 0,
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: BlocBuilder<SelectedBookableSpaceBloc,
|
|
||||||
SelectedBookableSpaceState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return BookingSidebar(
|
|
||||||
onRoomSelected: (selectedRoom) {
|
|
||||||
context
|
|
||||||
.read<SelectedBookableSpaceBloc>()
|
|
||||||
.add(SelectBookableSpace(selectedRoom));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child:
|
|
||||||
BlocBuilder<DateSelectionBloc, DateSelectionState>(
|
|
||||||
builder: (context, dateState) {
|
|
||||||
return CustomCalendarPage(
|
|
||||||
selectedDate: dateState.selectedDate,
|
|
||||||
onDateChanged: (day, month, year) {
|
|
||||||
final newDate = DateTime(year, month, day);
|
|
||||||
context
|
|
||||||
.read<DateSelectionBloc>()
|
|
||||||
.add(SelectDate(newDate));
|
|
||||||
context.read<DateSelectionBloc>().add(
|
|
||||||
SelectDateFromSidebarCalendar(newDate));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 5,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(20.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
SvgTextButton(
|
|
||||||
svgAsset: Assets.homeIcon,
|
|
||||||
label: 'Manage Bookable Spaces',
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
SvgTextButton(
|
|
||||||
svgAsset: Assets.groupIcon,
|
|
||||||
label: 'Manage Users',
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
BlocBuilder<DateSelectionBloc, DateSelectionState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
final weekStart = state.weekStart;
|
|
||||||
final weekEnd =
|
|
||||||
weekStart.add(const Duration(days: 6));
|
|
||||||
return WeekNavigation(
|
|
||||||
weekStart: weekStart,
|
|
||||||
weekEnd: weekEnd,
|
|
||||||
onPreviousWeek: () {
|
|
||||||
context
|
|
||||||
.read<DateSelectionBloc>()
|
|
||||||
.add(PreviousWeek());
|
|
||||||
},
|
|
||||||
onNextWeek: () {
|
|
||||||
context
|
|
||||||
.read<DateSelectionBloc>()
|
|
||||||
.add(NextWeek());
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
child: Column(
|
||||||
Expanded(
|
children: [
|
||||||
flex: 5,
|
Expanded(
|
||||||
child: BlocBuilder<SelectedBookableSpaceBloc,
|
flex: 2,
|
||||||
SelectedBookableSpaceState>(
|
child: BlocBuilder<SelectedBookableSpaceBloc,
|
||||||
builder: (context, roomState) {
|
SelectedBookableSpaceState>(
|
||||||
final selectedRoom =
|
builder: (context, state) {
|
||||||
roomState.selectedBookableSpace;
|
return BookingSidebar(
|
||||||
return BlocBuilder<DateSelectionBloc,
|
onRoomSelected: (selectedRoom) {
|
||||||
|
context
|
||||||
|
.read<SelectedBookableSpaceBloc>()
|
||||||
|
.add(SelectBookableSpace(selectedRoom));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: BlocBuilder<DateSelectionBloc,
|
||||||
DateSelectionState>(
|
DateSelectionState>(
|
||||||
builder: (context, dateState) {
|
builder: (context, dateState) {
|
||||||
return BlocBuilder<CalendarEventsBloc,
|
return CustomCalendarPage(
|
||||||
CalendarEventState>(
|
selectedDate: dateState.selectedDate,
|
||||||
builder: (context, eventState) {
|
onDateChanged: (day, month, year) {
|
||||||
return WeeklyCalendarPage(
|
final newDate = DateTime(year, month, day);
|
||||||
key: ValueKey(
|
context
|
||||||
selectedRoom?.uuid ?? 'no-room'),
|
.read<DateSelectionBloc>()
|
||||||
startTime: selectedRoom
|
.add(SelectDate(newDate));
|
||||||
?.bookableConfig.startTime,
|
context.read<DateSelectionBloc>().add(
|
||||||
endTime:
|
SelectDateFromSidebarCalendar(newDate));
|
||||||
selectedRoom?.bookableConfig.endTime,
|
},
|
||||||
weekStart: dateState.weekStart,
|
);
|
||||||
selectedDate: dateState.selectedDate,
|
},
|
||||||
eventController: _eventController,
|
),
|
||||||
selectedDateFromSideBarCalender: context
|
),
|
||||||
.watch<DateSelectionBloc>()
|
],
|
||||||
.state
|
),
|
||||||
.selectedDateFromSideBarCalender,
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 5,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SvgTextButton(
|
||||||
|
svgAsset: Assets.homeIcon,
|
||||||
|
label: 'Manage Bookable Spaces',
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
SvgTextButton(
|
||||||
|
svgAsset: Assets.groupIcon,
|
||||||
|
label: 'Manage Users',
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
BlocBuilder<DateSelectionBloc,
|
||||||
|
DateSelectionState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
final weekStart = state.weekStart;
|
||||||
|
final weekEnd =
|
||||||
|
weekStart.add(const Duration(days: 6));
|
||||||
|
return WeekNavigation(
|
||||||
|
weekStart: weekStart,
|
||||||
|
weekEnd: weekEnd,
|
||||||
|
onPreviousWeek: () {
|
||||||
|
context
|
||||||
|
.read<DateSelectionBloc>()
|
||||||
|
.add(PreviousWeek());
|
||||||
|
},
|
||||||
|
onNextWeek: () {
|
||||||
|
context
|
||||||
|
.read<DateSelectionBloc>()
|
||||||
|
.add(NextWeek());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 5,
|
||||||
|
child: BlocBuilder<SelectedBookableSpaceBloc,
|
||||||
|
SelectedBookableSpaceState>(
|
||||||
|
builder: (context, roomState) {
|
||||||
|
final selectedRoom =
|
||||||
|
roomState.selectedBookableSpace;
|
||||||
|
return BlocBuilder<DateSelectionBloc,
|
||||||
|
DateSelectionState>(
|
||||||
|
builder: (context, dateState) {
|
||||||
|
return BlocListener<CalendarEventsBloc,
|
||||||
|
CalendarEventState>(
|
||||||
|
listenWhen: (prev, curr) =>
|
||||||
|
curr is EventsLoaded,
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is EventsLoaded) {
|
||||||
|
_eventController
|
||||||
|
.removeWhere((_) => true);
|
||||||
|
_eventController.addAll(state.events);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: WeeklyCalendarPage(
|
||||||
|
startTime: selectedRoom
|
||||||
|
?.bookableConfig.startTime,
|
||||||
|
endTime: selectedRoom
|
||||||
|
?.bookableConfig.endTime,
|
||||||
|
weekStart: dateState.weekStart,
|
||||||
|
selectedDate: dateState.selectedDate,
|
||||||
|
eventController: _eventController,
|
||||||
|
selectedDateFromSideBarCalender: context
|
||||||
|
.watch<DateSelectionBloc>()
|
||||||
|
.state
|
||||||
|
.selectedDateFromSideBarCalender,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -76,29 +76,21 @@ class __SidebarContentState extends State<_SidebarContent> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
const _SidebarHeader(title: 'Spaces'),
|
||||||
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ColorsManager.whiteColors,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: ColorsManager.blackColor.withOpacity(0.1),
|
|
||||||
offset: const Offset(0, 4),
|
|
||||||
blurRadius: 4,
|
|
||||||
spreadRadius: 0,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: _SidebarHeader(title: 'Spaces')),
|
|
||||||
),
|
|
||||||
Container(
|
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, 4),
|
offset: const Offset(0, -2),
|
||||||
|
blurRadius: 4,
|
||||||
|
spreadRadius: 0,
|
||||||
|
),
|
||||||
|
BoxShadow(
|
||||||
|
color: ColorsManager.blackColor.withOpacity(0.1),
|
||||||
|
offset: const Offset(0, 2),
|
||||||
blurRadius: 4,
|
blurRadius: 4,
|
||||||
spreadRadius: 0,
|
spreadRadius: 0,
|
||||||
),
|
),
|
||||||
@ -228,7 +220,7 @@ class _SidebarHeader extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -66,28 +66,18 @@ class _CustomCalendarPageState extends State<CustomCalendarPage> {
|
|||||||
weekdayLabels: const ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
weekdayLabels: const ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return CalendarDatePicker2(
|
||||||
decoration: const BoxDecoration(
|
config: config,
|
||||||
border: Border(
|
value: [_selectedDate],
|
||||||
top: BorderSide(
|
onValueChanged: (dates) {
|
||||||
color: ColorsManager.textGray,
|
final picked = dates.first;
|
||||||
width: 1.0,
|
if (picked != null) {
|
||||||
),
|
setState(() {
|
||||||
),
|
_selectedDate = picked;
|
||||||
),
|
});
|
||||||
child: CalendarDatePicker2(
|
widget.onDateChanged(picked.day, picked.month, picked.year);
|
||||||
config: config,
|
}
|
||||||
value: [_selectedDate],
|
},
|
||||||
onValueChanged: (dates) {
|
|
||||||
final picked = dates.first;
|
|
||||||
if (picked != null) {
|
|
||||||
setState(() {
|
|
||||||
_selectedDate = picked;
|
|
||||||
});
|
|
||||||
widget.onDateChanged(picked.day, picked.month, picked.year);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,17 +32,15 @@ class EventTileWidget extends StatelessWidget {
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.all(5),
|
padding: 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: Border(
|
border: const Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
color: isEventEnded
|
color: ColorsManager.grayColor,
|
||||||
? 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.secondaryColor,
|
activeColor: ColorsManager.primaryColor,
|
||||||
title: Text(
|
title: Text(
|
||||||
room.spaceName,
|
room.spaceName,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
|
|||||||
@ -14,33 +14,26 @@ class WeekDayHeader extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ColoredBox(
|
return Column(
|
||||||
color: isSelectedDay
|
children: [
|
||||||
? ColorsManager.secondaryColor.withOpacity(0.1)
|
Text(
|
||||||
: Colors.transparent,
|
DateFormat('EEE').format(date).toUpperCase(),
|
||||||
child: Column(
|
style: TextStyle(
|
||||||
children: [
|
fontWeight: FontWeight.w400,
|
||||||
const SizedBox(
|
fontSize: 14,
|
||||||
height: 10,
|
color: isSelectedDay ? Colors.blue : Colors.black,
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
DateFormat('EEE').format(date).toUpperCase(),
|
Text(
|
||||||
style: const TextStyle(
|
DateFormat('d').format(date),
|
||||||
fontWeight: FontWeight.w400,
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w700,
|
||||||
color: ColorsManager.blackColor,
|
fontSize: 20,
|
||||||
),
|
color:
|
||||||
|
isSelectedDay ? ColorsManager.blue1 : ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
DateFormat('d').format(date),
|
],
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 30,
|
|
||||||
color: ColorsManager.blackColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ class WeekNavigation extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 250,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.circleRolesBackground,
|
color: ColorsManager.circleRolesBackground,
|
||||||
@ -33,8 +32,6 @@ class WeekNavigation extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
iconSize: 15,
|
iconSize: 15,
|
||||||
@ -43,16 +40,12 @@ class WeekNavigation extends StatelessWidget {
|
|||||||
onPressed: onPreviousWeek,
|
onPressed: onPreviousWeek,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
SizedBox(
|
Text(
|
||||||
width: 120,
|
_getMonthYearText(weekStart, weekEnd),
|
||||||
child: Text(
|
style: const TextStyle(
|
||||||
_getMonthYearText(weekStart, weekEnd),
|
color: ColorsManager.lightGrayColor,
|
||||||
style: const TextStyle(
|
fontSize: 14,
|
||||||
color: ColorsManager.lightGrayColor,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
static const double timeLineWidth = 65;
|
static const double timeLineWidth = 65;
|
||||||
static const int totalDays = 7;
|
static const int totalDays = 7;
|
||||||
static const double dayColumnWidth = 220;
|
static const double dayColumnWidth = 220;
|
||||||
|
|
||||||
final double calendarContentWidth =
|
final double calendarContentWidth =
|
||||||
timeLineWidth + (totalDays * dayColumnWidth);
|
timeLineWidth + (totalDays * dayColumnWidth);
|
||||||
@ -57,10 +57,13 @@ 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
|
||||||
@ -97,6 +100,7 @@ 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) {
|
||||||
@ -106,6 +110,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color:
|
||||||
ColorsManager.spaceColor.withOpacity(0.07),
|
ColorsManager.spaceColor.withOpacity(0.07),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -138,7 +143,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
heightPerMinute: 1.7,
|
heightPerMinute: 1.7,
|
||||||
showLiveTimeLineInAllDays: false,
|
showLiveTimeLineInAllDays: false,
|
||||||
showVerticalLines: true,
|
showVerticalLines: true,
|
||||||
emulateVerticalOffsetBy: -95,
|
emulateVerticalOffsetBy: -80,
|
||||||
startDay: WeekDays.monday,
|
startDay: WeekDays.monday,
|
||||||
liveTimeIndicatorSettings:
|
liveTimeIndicatorSettings:
|
||||||
const LiveTimeIndicatorSettings(
|
const LiveTimeIndicatorSettings(
|
||||||
@ -156,7 +161,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
timeLineWidth: timeLineWidth,
|
timeLineWidth: timeLineWidth,
|
||||||
weekPageHeaderBuilder: (start, end) => Container(),
|
weekPageHeaderBuilder: (start, end) => Container(),
|
||||||
weekTitleHeight: 90,
|
weekTitleHeight: 60,
|
||||||
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(
|
||||||
@ -203,6 +208,8 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSameDay(DateTime d1, DateTime d2) {
|
bool isSameDay(DateTime d1, DateTime d2) {
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_
|
|||||||
import 'package:syncrow_web/pages/device_managment/garage_door/helper/garage_door_helper.dart';
|
import 'package:syncrow_web/pages/device_managment/garage_door/helper/garage_door_helper.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/garage_door/models/garage_door_model.dart';
|
import 'package:syncrow_web/pages/device_managment/garage_door/models/garage_door_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/garage_door/schedule_view/schedule_garage_view.dart';
|
import 'package:syncrow_web/pages/device_managment/garage_door/schedule_view/schedule_garage_view.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/icon_name_status_container.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/icon_name_status_container.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||||
@ -95,18 +94,11 @@ class GarageDoorControlView extends StatelessWidget
|
|||||||
FetchGarageDoorSchedulesEvent(
|
FetchGarageDoorSchedulesEvent(
|
||||||
deviceId: deviceId, category: 'doorcontact_state'),
|
deviceId: deviceId, category: 'doorcontact_state'),
|
||||||
);
|
);
|
||||||
|
showDialog(
|
||||||
showDialog<void>(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (ctx) => BlocProvider.value(
|
builder: (ctx) => BlocProvider.value(
|
||||||
value: BlocProvider.of<GarageDoorBloc>(context),
|
value: BlocProvider.of<GarageDoorBloc>(context),
|
||||||
child: BuildScheduleView(
|
child: BuildGarageDoorScheduleView(status: status),
|
||||||
deviceUuid: deviceId,
|
|
||||||
category: 'Timer',
|
|
||||||
code: 'doorcontact_state',
|
|
||||||
countdownCode: 'Timer',
|
|
||||||
deviceType: 'GD',
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
name: 'Scheduling',
|
name: 'Scheduling',
|
||||||
|
|||||||
@ -100,6 +100,7 @@ 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,
|
||||||
|
|||||||
@ -287,8 +287,7 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
|||||||
try {
|
try {
|
||||||
if (state is ScheduleLoaded) {
|
if (state is ScheduleLoaded) {
|
||||||
Status status = Status(code: '', value: '');
|
Status status = Status(code: '', value: '');
|
||||||
if (event.deviceType == 'CUR_2' ||
|
if (event.deviceType == 'CUR_2') {
|
||||||
event.deviceType == 'GD' ) {
|
|
||||||
status = status.copyWith(
|
status = status.copyWith(
|
||||||
code: 'control',
|
code: 'control',
|
||||||
value: event.functionOn == true ? 'open' : 'close');
|
value: event.functionOn == true ? 'open' : 'close');
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class CountdownModeButtons extends StatelessWidget {
|
|||||||
countDownCode: countDownCode),
|
countDownCode: countDownCode),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
backgroundColor: ColorsManager.secondaryColor,
|
backgroundColor: ColorsManager.primaryColorWithOpacity,
|
||||||
child: const Text('Save'),
|
child: const Text('Save'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class InchingModeButtons extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
backgroundColor: ColorsManager.secondaryColor,
|
backgroundColor: ColorsManager.primaryColor,
|
||||||
child: const Text('Save'),
|
child: const Text('Save'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -31,12 +31,11 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (_) => ScheduleBloc(
|
create: (_) => ScheduleBloc(deviceId: deviceUuid,)
|
||||||
deviceId: deviceUuid,
|
|
||||||
)
|
|
||||||
..add(ScheduleGetEvent(category: category))
|
..add(ScheduleGetEvent(category: category))
|
||||||
..add(ScheduleFetchStatusEvent(
|
..add(ScheduleFetchStatusEvent(
|
||||||
deviceId: deviceUuid, countdownCode: countdownCode ?? '')),
|
deviceId: deviceUuid,
|
||||||
|
countdownCode: countdownCode ?? '')),
|
||||||
child: Dialog(
|
child: Dialog(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
insetPadding: const EdgeInsets.all(20),
|
insetPadding: const EdgeInsets.all(20),
|
||||||
@ -57,7 +56,7 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const ScheduleHeader(),
|
const ScheduleHeader(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (deviceType == 'CUR_2' || deviceType == 'GD')
|
if (deviceType == 'CUR_2')
|
||||||
const SizedBox()
|
const SizedBox()
|
||||||
else
|
else
|
||||||
ScheduleModeSelector(
|
ScheduleModeSelector(
|
||||||
@ -77,7 +76,8 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
category: category,
|
category: category,
|
||||||
time: '',
|
time: '',
|
||||||
function: Status(
|
function: Status(
|
||||||
code: code.toString(), value: true),
|
code: code.toString(),
|
||||||
|
value: true),
|
||||||
days: [],
|
days: [],
|
||||||
),
|
),
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
@ -96,7 +96,7 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (deviceType != 'CUR_2'|| deviceType != 'GD')
|
if (deviceType != 'CUR_2')
|
||||||
if (state.scheduleMode == ScheduleModes.countdown ||
|
if (state.scheduleMode == ScheduleModes.countdown ||
|
||||||
state.scheduleMode == ScheduleModes.inching)
|
state.scheduleMode == ScheduleModes.inching)
|
||||||
CountdownInchingView(
|
CountdownInchingView(
|
||||||
|
|||||||
@ -24,13 +24,12 @@ class ScheduleManagementUI extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 177,
|
width: 170,
|
||||||
height: 40,
|
height: 40,
|
||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
borderWidth: 4,
|
borderColor: ColorsManager.grayColor.withOpacity(0.5),
|
||||||
borderColor: ColorsManager.neutralGray,
|
padding: 2,
|
||||||
padding: 8,
|
backgroundColor: ColorsManager.graysColor,
|
||||||
backgroundColor: ColorsManager.textFieldGreyColor,
|
|
||||||
borderRadius: 15,
|
borderRadius: 15,
|
||||||
onPressed: onAddSchedule,
|
onPressed: onAddSchedule,
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class ScheduleModeButtons extends StatelessWidget {
|
|||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
height: 40,
|
height: 40,
|
||||||
onPressed: onSave,
|
onPressed: onSave,
|
||||||
backgroundColor: ColorsManager.secondaryColor,
|
backgroundColor: ColorsManager.primaryColorWithOpacity,
|
||||||
child: const Text('Save'),
|
child: const Text('Save'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class _ScheduleTableView extends StatelessWidget {
|
|||||||
child: Text(_getSelectedDays(
|
child: Text(_getSelectedDays(
|
||||||
ScheduleModel.parseSelectedDays(schedule.days)))),
|
ScheduleModel.parseSelectedDays(schedule.days)))),
|
||||||
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
||||||
if (deviceType == 'CUR_2' || deviceType == 'GD')
|
if (deviceType == 'CUR_2')
|
||||||
Center(
|
Center(
|
||||||
child: Text(schedule.function.value == true ? 'open' : 'close'))
|
child: Text(schedule.function.value == true ? 'open' : 'close'))
|
||||||
else
|
else
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class ScheduleDialogHelper {
|
|||||||
required String deviceType,
|
required String deviceType,
|
||||||
}) {
|
}) {
|
||||||
bool temp;
|
bool temp;
|
||||||
if (deviceType == 'CUR_2' || deviceType == 'GD') {
|
if (deviceType == 'CUR_2') {
|
||||||
temp = schedule!.function.value == 'open' ? true : false;
|
temp = schedule!.function.value == 'open' ? true : false;
|
||||||
} else {
|
} else {
|
||||||
temp = schedule!.function.value;
|
temp = schedule!.function.value;
|
||||||
@ -116,7 +116,7 @@ class ScheduleDialogHelper {
|
|||||||
ScheduleModeButtons(
|
ScheduleModeButtons(
|
||||||
onSave: () {
|
onSave: () {
|
||||||
dynamic temp;
|
dynamic temp;
|
||||||
if (deviceType == 'CUR_2' || deviceType == 'GD') {
|
if (deviceType == 'CUR_2') {
|
||||||
temp = functionOn! ? 'open' : 'close';
|
temp = functionOn! ? 'open' : 'close';
|
||||||
} else {
|
} else {
|
||||||
temp = functionOn;
|
temp = functionOn;
|
||||||
@ -202,23 +202,18 @@ class ScheduleDialogHelper {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Radio<bool>(
|
Radio<bool>(
|
||||||
activeColor: ColorsManager.secondaryColor,
|
|
||||||
focusColor: ColorsManager.secondaryColor,
|
|
||||||
value: true,
|
value: true,
|
||||||
groupValue: isOn,
|
groupValue: isOn,
|
||||||
onChanged: (val) => onChanged(true),
|
onChanged: (val) => onChanged(true),
|
||||||
),
|
),
|
||||||
Text(categor == 'CUR_2' || categor == 'GD' ? 'open' : 'On'),
|
Text(categor == 'CUR_2' ? 'open' : 'On'),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Radio<bool>(
|
Radio<bool>(
|
||||||
activeColor: ColorsManager.secondaryColor,
|
|
||||||
focusColor: ColorsManager.secondaryColor,
|
|
||||||
|
|
||||||
value: false,
|
value: false,
|
||||||
groupValue: isOn,
|
groupValue: isOn,
|
||||||
onChanged: (val) => onChanged(false),
|
onChanged: (val) => onChanged(false),
|
||||||
),
|
),
|
||||||
Text(categor == 'CUR_2' || categor == 'GD' ? 'close' : 'Off'),
|
Text(categor == 'CUR_2' ? 'close' : 'Off'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,9 @@ class SpaceDetailsDevicesBox extends StatelessWidget {
|
|||||||
).then((resultSpace) {
|
).then((resultSpace) {
|
||||||
if (resultSpace != null) {
|
if (resultSpace != null) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.read<SpaceDetailsModelBloc>().add(UpdateSpaceDetails(resultSpace));
|
context
|
||||||
|
.read<SpaceDetailsModelBloc>()
|
||||||
|
.add(UpdateSpaceDetails(resultSpace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -133,6 +135,9 @@ 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,6 +84,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,9 @@ import 'package:syncrow_web/services/api/http_interceptor.dart';
|
|||||||
import 'package:syncrow_web/services/api/http_service.dart';
|
import 'package:syncrow_web/services/api/http_service.dart';
|
||||||
|
|
||||||
final GetIt serviceLocator = GetIt.instance;
|
final GetIt serviceLocator = GetIt.instance;
|
||||||
void initialSetup() {
|
//setupLocator() // to search for dependency injection in flutter
|
||||||
|
initialSetup() {
|
||||||
serviceLocator.registerSingleton<HTTPInterceptor>(HTTPInterceptor());
|
serviceLocator.registerSingleton<HTTPInterceptor>(HTTPInterceptor());
|
||||||
|
//Base classes
|
||||||
serviceLocator.registerSingleton<Dio>(HTTPService.setupDioClient());
|
serviceLocator.registerSingleton<Dio>(HTTPService.setupDioClient());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
|
||||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
|
||||||
import 'package:syncrow_web/utils/app_routes.dart';
|
|
||||||
import 'package:syncrow_web/utils/navigation_service.dart';
|
|
||||||
import 'package:syncrow_web/utils/theme/theme.dart';
|
|
||||||
|
|
||||||
class SyncrowApp extends StatelessWidget {
|
|
||||||
const SyncrowApp({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return MultiBlocProvider(
|
|
||||||
providers: [
|
|
||||||
BlocProvider<CreateRoutineBloc>(
|
|
||||||
create: (context) => CreateRoutineBloc(),
|
|
||||||
),
|
|
||||||
BlocProvider(
|
|
||||||
create: (context) => HomeBloc()..add(const FetchUserInfo()),
|
|
||||||
),
|
|
||||||
BlocProvider<VisitorPasswordBloc>(
|
|
||||||
create: (context) => VisitorPasswordBloc(),
|
|
||||||
),
|
|
||||||
BlocProvider<RoutineBloc>(
|
|
||||||
create: (context) => RoutineBloc(),
|
|
||||||
),
|
|
||||||
BlocProvider<SpaceTreeBloc>(
|
|
||||||
create: (context) => SpaceTreeBloc(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: MaterialApp.router(
|
|
||||||
debugShowCheckedModeBanner: false,
|
|
||||||
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
|
||||||
dragDevices: {
|
|
||||||
PointerDeviceKind.mouse,
|
|
||||||
PointerDeviceKind.touch,
|
|
||||||
PointerDeviceKind.stylus,
|
|
||||||
PointerDeviceKind.unknown,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
key: NavigationService.navigatorKey,
|
|
||||||
theme: myTheme,
|
|
||||||
routerConfig: AppRoutes.router,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,31 +1,17 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/analytics/views/analytics_page.dart';
|
import 'package:syncrow_web/pages/analytics/modules/analytics/views/analytics_page.dart';
|
||||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/view/device_managment_page.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/view/device_managment_page.dart';
|
||||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||||
import 'package:syncrow_web/pages/roles_and_permission/view/roles_and_permission_page.dart';
|
import 'package:syncrow_web/pages/roles_and_permission/view/roles_and_permission_page.dart';
|
||||||
import 'package:syncrow_web/pages/space_management_v2/main_module/views/space_management_page.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/view/spaces_management_page.dart';
|
||||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||||
|
|
||||||
abstract final class AppRoutes {
|
class AppRoutes {
|
||||||
const AppRoutes._();
|
static List<GoRoute> getRoutes() {
|
||||||
|
return [
|
||||||
static final GoRouter router = GoRouter(
|
|
||||||
initialLocation: RoutesConst.auth,
|
|
||||||
redirect: (context, state) async {
|
|
||||||
final checkToken = await AuthBloc.getTokenAndValidate();
|
|
||||||
final loggedIn = checkToken == 'Success';
|
|
||||||
final goingToLogin = state.uri.toString() == RoutesConst.auth;
|
|
||||||
|
|
||||||
if (!loggedIn && !goingToLogin) return RoutesConst.auth;
|
|
||||||
if (loggedIn && goingToLogin) return RoutesConst.home;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
routes: [
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RoutesConst.auth,
|
path: RoutesConst.auth,
|
||||||
builder: (context, state) => const LoginPage(),
|
builder: (context, state) => const LoginPage(),
|
||||||
@ -57,6 +43,6 @@ abstract final class AppRoutes {
|
|||||||
name: 'analytics',
|
name: 'analytics',
|
||||||
builder: (context, state) => const AnalyticsPage(),
|
builder: (context, state) => const AnalyticsPage(),
|
||||||
),
|
),
|
||||||
],
|
];
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,5 +140,6 @@ 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 = '/bookings?month={mm}-{yyyy}&space={space}';
|
static const String getBookings =
|
||||||
|
'/bookings?month={mm}%2F{yyyy}&space={space}';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ 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,6 +21,9 @@ enum DeviceType {
|
|||||||
NCPS,
|
NCPS,
|
||||||
DoorSensor,
|
DoorSensor,
|
||||||
PC,
|
PC,
|
||||||
|
fourSceen,
|
||||||
|
sixSceen,
|
||||||
|
SOS,
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -63,4 +66,7 @@ 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