mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
syncing to origin/dev
This commit is contained in:
@ -10,7 +10,6 @@ import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart
|
|||||||
import 'package:syncrow_app/features/menu/view/menu_view.dart';
|
import 'package:syncrow_app/features/menu/view/menu_view.dart';
|
||||||
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
|
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart';
|
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart';
|
import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart';
|
import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart';
|
||||||
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
|
||||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
class AppLayout extends StatelessWidget {
|
class AppLayout extends StatelessWidget {
|
||||||
@ -17,74 +16,30 @@ class AppLayout extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<AuthCubit, AuthState>(
|
return BlocProvider(
|
||||||
listener: (context, state) {
|
create: (context) => HomeCubit.getInstance(),
|
||||||
if (state is AuthError) {
|
child: BlocBuilder<HomeCubit, HomeState>(
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
builder: (context, state) {
|
||||||
// SnackBar(
|
return AnnotatedRegion(
|
||||||
// content: Text(state.message),
|
value: SystemUiOverlayStyle(
|
||||||
// ),
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||||
// );
|
statusBarIconBrightness: Brightness.light,
|
||||||
Navigator.of(context)
|
),
|
||||||
.popUntil((route) => route.settings.name == Routes.authLogin);
|
child: SafeArea(
|
||||||
}
|
child: Scaffold(
|
||||||
},
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
builder: (context, state) {
|
extendBodyBehindAppBar: true,
|
||||||
return BlocProvider(
|
extendBody: true,
|
||||||
create: (context) => HomeCubit.getInstance(),
|
appBar: HomeCubit.getInstance().spaces != null
|
||||||
child: BlocConsumer<HomeCubit, HomeState>(
|
? const DefaultAppBar()
|
||||||
listener: (context, state) async {
|
: null,
|
||||||
if (state is GetSpacesError) {
|
body: const AppBody(),
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
bottomNavigationBar: const DefaultNavBar(),
|
||||||
// SnackBar(
|
),
|
||||||
// content: Text(state.errMessage),
|
),
|
||||||
// ),
|
);
|
||||||
// );
|
},
|
||||||
Navigator.of(context).popUntil(
|
),
|
||||||
(route) => route.settings.name == Routes.authLogin);
|
|
||||||
}
|
|
||||||
String? token = await const FlutterSecureStorage()
|
|
||||||
.read(key: Token.loginAccessTokenKey);
|
|
||||||
if (token == null) {
|
|
||||||
// ignore: use_build_context_synchronously
|
|
||||||
Navigator.of(context).popAndPushNamed(Routes.authLogin);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
builder: (context, state) {
|
|
||||||
return AnnotatedRegion(
|
|
||||||
value: SystemUiOverlayStyle(
|
|
||||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
|
||||||
statusBarIconBrightness: Brightness.light,
|
|
||||||
),
|
|
||||||
child: SafeArea(
|
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: ColorsManager.backgroundColor,
|
|
||||||
extendBodyBehindAppBar: true,
|
|
||||||
extendBody: true,
|
|
||||||
appBar: HomeCubit.getInstance().spaces != null
|
|
||||||
? const DefaultAppBar()
|
|
||||||
: null,
|
|
||||||
body: const AppBody(),
|
|
||||||
bottomNavigationBar: const DefaultNavBar(),
|
|
||||||
// floatingActionButton: FloatingActionButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// CustomPageRoute(
|
|
||||||
// builder: (context) =>
|
|
||||||
// const ThreeGangSwitchesView(),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// child: const Icon(Icons.arrow_forward_ios_sharp),
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import 'package:syncrow_app/features/auth/model/user_model.dart';
|
|||||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||||
import 'package:syncrow_app/services/api/authentication_api.dart';
|
import 'package:syncrow_app/services/api/authentication_api.dart';
|
||||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
|
||||||
|
|
||||||
part 'auth_state.dart';
|
part 'auth_state.dart';
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import 'package:syncrow_app/features/auth/model/token.dart';
|
|||||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:developer' as developer;
|
|
||||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
import 'package:syncrow_app/services/api/network_exception.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'dart:developer' as developer;
|
|
||||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||||
import 'package:syncrow_app/services/api/http_interceptor.dart';
|
import 'package:syncrow_app/services/api/http_interceptor.dart';
|
||||||
import 'package:syncrow_app/services/locator.dart';
|
import 'package:syncrow_app/services/locator.dart';
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
||||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||||
import 'package:syncrow_app/services/api/http_service.dart';
|
import 'package:syncrow_app/services/api/http_service.dart';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'dart:developer' as developer;
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
class StringHelpers {
|
class StringHelpers {
|
||||||
|
Reference in New Issue
Block a user