push folders revamp

This commit is contained in:
ashrafzarkanisala
2024-06-24 00:05:56 +03:00
parent 759888857d
commit b1dbee499f
9 changed files with 12 additions and 12 deletions

View File

@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/light_divider.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/navigation/routing_constants.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class CustomBottomSheetWidget extends StatelessWidget {
const CustomBottomSheetWidget({
super.key,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 16, bottom: 8),
child: BodyLarge(
text: 'Add Task',
style: context.bodyLarge.copyWith(
fontWeight: FontWeight.w700,
color: ColorsManager.primaryColorWithOpacity,
),
textAlign: TextAlign.center,
),
),
SizedBox(
width: context.width * 0.7,
child: const LightDivider(),
),
SceneListTile(
assetPath: Assets.assetsIconsLight,
assetHeight: 24,
minLeadingWidth: 30,
titleString: 'Control Single Device',
padding: const EdgeInsets.symmetric(horizontal: 20),
trailingWidget: const Icon(
Icons.arrow_forward_ios_rounded,
size: 16,
color: ColorsManager.greyColor,
),
onPressed: () {
Navigator.pushNamed(context, Routes.sceneControlDevicesRoute);
},
),
SceneListTile(
assetPath: Assets.player,
titleString: 'Select Automation',
minLeadingWidth: 30,
assetHeight: 24,
padding: const EdgeInsets.symmetric(horizontal: 20),
trailingWidget: const Icon(
Icons.arrow_forward_ios_rounded,
size: 16,
color: ColorsManager.greyColor,
),
onPressed: () {},
),
SceneListTile(
assetPath: Assets.delay,
titleString: 'Delay The Action',
assetHeight: 24,
minLeadingWidth: 30,
padding: const EdgeInsets.symmetric(horizontal: 20),
trailingWidget: const Icon(
Icons.arrow_forward_ios_rounded,
size: 16,
color: ColorsManager.greyColor,
),
onPressed: () {
context.customAlertDialog(
height: 300,
child: Material(
child: DefaultContainer(
width: context.width * 0.8,
child: Text('Comming soon'),
),
),
);
},
),
],
),
);
}
}

View File

@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/light_divider.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
class IFDefaultContainer extends StatelessWidget {
const IFDefaultContainer({
super.key,
});
@override
Widget build(BuildContext context) {
return DefaultContainer(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SceneListTile(
leadingWidget: BodyLarge(
text: 'IF',
style: context.bodyLarge.copyWith(
fontWeight: FontWeight.bold,
color: ColorsManager.primaryTextColor,
),
),
trailingWidget: SvgPicture.asset(Assets.addIcon),
padding: EdgeInsets.zero,
),
const LightDivider(),
const SceneListTile(
assetPath: Assets.handClickIcon,
titleString: StringsManager.tapToRun,
padding: EdgeInsets.zero,
)
],
),
);
}
}

View File

@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
import 'package:syncrow_app/features/scene/widgets/bottom_sheet_widget.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/light_divider.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class ThenDefaultContainer extends StatelessWidget {
const ThenDefaultContainer({
super.key,
});
@override
Widget build(BuildContext context) {
return DefaultContainer(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SceneListTile(
leadingWidget: BodyLarge(
text: 'Then',
style: context.bodyLarge.copyWith(
fontWeight: FontWeight.bold,
color: ColorsManager.primaryTextColor,
),
),
trailingWidget: GestureDetector(
onTap: () => context.customBottomSheet(
child: const CustomBottomSheetWidget(),
),
child: SvgPicture.asset(
Assets.addIcon,
colorFilter: const ColorFilter.mode(
ColorsManager.primaryColor,
BlendMode.srcIn,
),
),
),
padding: EdgeInsets.zero,
),
const LightDivider(),
SceneListTile(
titleString: '+ Add Task',
textAlign: TextAlign.center,
onPressed: () => context.customBottomSheet(
child: const CustomBottomSheetWidget(),
),
)
],
),
);
}
}

View File

@ -0,0 +1,113 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_state.dart';
import 'package:syncrow_app/features/devices/model/room_model.dart';
import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_state.dart';
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class SceneDevicesBody extends StatelessWidget {
const SceneDevicesBody({
super.key,
required TabController tabController,
required this.rooms,
}) : _tabController = tabController;
final TabController _tabController;
final List<RoomModel>? rooms;
@override
Widget build(BuildContext context) {
return BlocBuilder<TabBarBloc, TabBarState>(
builder: (context, tabState) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
TabBar(
controller: _tabController,
dividerColor: Colors.transparent,
indicatorColor: Colors.transparent,
tabs: [
...rooms!.map((e) => Tab(
child: BodyLarge(
text: e.name ?? '',
textAlign: TextAlign.start,
style: context.bodyLarge.copyWith(
color: (tabState is TabSelected) &&
tabState.roomId == e.id
? ColorsManager.textPrimaryColor
: ColorsManager.textPrimaryColor.withOpacity(0.2),
),
),
)),
],
isScrollable: true,
tabAlignment: TabAlignment.start,
),
Expanded(
child: TabBarView(
controller: _tabController,
children: rooms!.map((e) => _buildRoomTab(e, context)).toList(),
),
),
],
);
},
);
}
Widget _buildRoomTab(RoomModel room, BuildContext context) {
return BlocBuilder<DeviceManagerBloc, DeviceManagerState>(
builder: (context, state) {
if (state is GetDevicesLoading) {
return const Center(child: CircularProgressIndicator());
} else if (state is GetDevicesSuccess) {
return ListView.builder(
itemCount: state.devices?.length ?? 0,
itemBuilder: (context, index) {
final device = state.devices![index];
return DefaultContainer(
child: SceneListTile(
minLeadingWidth: 40,
leadingWidget: Image.network(
device.icon ?? '',
errorBuilder: (context, error, stackTrace) => Image.asset(
Assets.assetsIconsLogo,
width: 20,
),
),
titleWidget: BodyMedium(
text: device.name ?? '',
style: context.titleSmall.copyWith(
color: ColorsManager.secondaryTextColor,
fontWeight: FontWeight.w400,
fontSize: 20,
),
),
trailingWidget: const Icon(
Icons.arrow_forward_ios_rounded,
size: 16,
weight: 0.2,
),
onPressed: () {
},
),
);
},
);
} else if (state is GetDevicesError) {
return Center(child: Text(state.error));
}
return const SizedBox();
},
);
}
}

View File

@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class SceneListTile extends StatelessWidget {
const SceneListTile({
super.key,
this.assetPath,
this.titleString,
this.subtitle,
this.leadingWidget,
this.trailingWidget,
this.padding,
this.textAlign,
this.onPressed,
this.assetHeight,
this.minLeadingWidth,
this.titleWidget,
});
final String? assetPath;
final String? titleString;
final String? subtitle;
final Widget? leadingWidget;
final Widget? trailingWidget;
final EdgeInsetsGeometry? padding;
final TextAlign? textAlign;
final void Function()? onPressed;
final double? assetHeight;
final double? minLeadingWidth;
final Widget? titleWidget;
@override
Widget build(BuildContext context) {
return ListTile(
minLeadingWidth: minLeadingWidth ?? 40,
leading: leadingWidget ??
(assetPath != null
? SvgPicture.asset(
assetPath ?? Assets.assetsImagesLogo,
width: 20,
height: assetHeight ?? 32,
fit: BoxFit.fitWidth,
)
: null),
trailing: trailingWidget,
contentPadding: padding,
title: titleWidget ??
BodyMedium(
text: titleString ?? '',
textAlign: textAlign,
style: context.bodyMedium.copyWith(fontSize: 15),
),
subtitle: subtitle == null
? null
: BodySmall(
text: subtitle!,
style: context.bodySmall.copyWith(
fontWeight: FontWeight.w400, color: ColorsManager.greyColor),
),
onTap: onPressed,
);
}
}

View File

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
import 'package:syncrow_app/generated/assets.dart';
class SceneViewNoScenes extends StatelessWidget {
const SceneViewNoScenes({
super.key,
});
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
Assets.assetsImagesAutomation,
scale: 1,
opacity: const AlwaysStoppedAnimation(.5),
width: 140,
),
const SizedBox(height: 15),
const Text(
'Home automation saves your time and effort by automating routine tasks.',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.grey),
),
const SizedBox(height: 20),
const DefaultButton(
child: Text(
'Add a scene',
),
)
],
),
),
);
}
}