This commit is contained in:
hannathkadher
2025-04-03 10:47:27 +04:00
4 changed files with 40 additions and 25 deletions

1
.gitignore vendored
View File

@ -42,3 +42,4 @@ app.*.map.json
/android/app/debug /android/app/debug
/android/app/profile /android/app/profile
/android/app/release /android/app/release
/android/app/.cxx/

View File

@ -1,8 +1,8 @@
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:smooth_page_indicator/smooth_page_indicator.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.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/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/all_devices.dart'; import 'package:syncrow_app/features/devices/view/widgets/all_devices.dart';
import 'package:syncrow_app/features/devices/view/widgets/room_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart'; import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
@ -15,7 +15,7 @@ import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
class DevicesViewBody extends StatelessWidget { class DevicesViewBody extends StatelessWidget {
const DevicesViewBody({Key? key}) : super(key: key); const DevicesViewBody({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<HomeCubit, HomeState>( return BlocBuilder<HomeCubit, HomeState>(
@ -80,10 +80,7 @@ class DevicesViewBody extends StatelessWidget {
), ),
], ],
), ),
SizedBox( const SceneView(pageType: true),
height: MediaQuery.of(context).size.height * 0.1,
child: const SceneView(pageType: true),
),
const SizedBox(height: 20), const SizedBox(height: 20),
const RoomsSlider(), const RoomsSlider(),
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@ -8,9 +8,9 @@ import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.d
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart'; import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
import 'package:syncrow_app/features/scene/bloc/smart_scene/smart_scene_select_dart_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/smart_scene/smart_scene_select_dart_bloc.dart';
import 'package:syncrow_app/features/scene/widgets/empty_devices_widget.dart';
import 'package:syncrow_app/features/scene/widgets/scene_view_widget/scene_grid_view.dart'; import 'package:syncrow_app/features/scene/widgets/scene_view_widget/scene_grid_view.dart';
import 'package:syncrow_app/features/scene/widgets/scene_view_widget/scene_header.dart'; import 'package:syncrow_app/features/scene/widgets/scene_view_widget/scene_header.dart';
import 'package:syncrow_app/features/shared_widgets/create_unit.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
@ -89,8 +89,8 @@ class SceneView extends StatelessWidget {
'Scene ${state.sceneName} triggered successfully!'); 'Scene ${state.sceneName} triggered successfully!');
} }
}, },
child: HomeCubit.getInstance().spaces.isEmpty child: HomeCubit.getInstance().spaces.isEmpty
? const CreateUnitWidget() ? const EmptyDevicesWidget()
: Column( : Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@ -101,8 +101,7 @@ class SceneView extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
if (state is SceneLoading) { if (state is SceneLoading) {
return const Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator());
);
} }
if (state is SceneError) { if (state is SceneError) {
return Center( return Center(
@ -114,11 +113,13 @@ class SceneView extends StatelessWidget {
final automationList = state.automationList; final automationList = state.automationList;
return pageType return pageType
? Expanded( ? SizedBox(
height: context.height * 0.1,
child: SceneListview( child: SceneListview(
scenes: scenes, scenes: scenes,
loadingSceneId: state.loadingSceneId, loadingSceneId: state.loadingSceneId,
)) ),
)
: Expanded( : Expanded(
child: ListView( child: ListView(
children: [ children: [
@ -149,9 +150,7 @@ class SceneView extends StatelessWidget {
'No scenes have been added yet', 'No scenes have been added yet',
), ),
), ),
const SizedBox( const SizedBox(height: 10),
height: 10,
),
], ],
), ),
), ),
@ -182,20 +181,16 @@ class SceneView extends StatelessWidget {
'No automations have been added yet', 'No automations have been added yet',
), ),
), ),
const SizedBox( const SizedBox(height: 10),
height: 10,
),
], ],
), ),
), ),
const SizedBox( const SizedBox(height: 15),
height: 15,
),
], ],
), ),
); );
} }
return const SizedBox(); return const SizedBox.shrink();
}, },
), ),
], ],

View File

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class EmptyDevicesWidget extends StatelessWidget {
const EmptyDevicesWidget({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 48),
child: Text(
"No routines.\nEnable 'Show on Home Screen' to add routines",
textAlign: TextAlign.center,
style: TextStyle(
color: ColorsManager.grayColor,
fontWeight: FontWeight.w400,
fontSize: 12,
),
),
);
}
}