mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 11:54:55 +00:00
changed the method of generating assets to be more declrative when it comes to names of the assets. it now include the file path name e.g (asset in the path "assets/images/home-images/home.png" will be generated as this "String assetsImagesHomeImageshome = "path" ". this will be very helpful in the future when we want to orgnize the assets dir.
164 lines
6.8 KiB
Dart
164 lines
6.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
|
|
class BlindsView extends StatelessWidget {
|
|
const BlindsView({
|
|
super.key,
|
|
this.blind,
|
|
});
|
|
final DeviceModel? blind;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (context) => DevicesCubit.getInstance(),
|
|
child: BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return DefaultScaffold(
|
|
title: blind?.name ?? 'Blinds',
|
|
child: Column(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Stack(
|
|
alignment: Alignment.topCenter,
|
|
children: [
|
|
Container(
|
|
height: 340,
|
|
width: 365,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
Assets.assetsImagesWindow,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 15, bottom: 10),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
curve: Curves.linear,
|
|
height: DevicesCubit.get(context).blindWindowHight,
|
|
width: 270,
|
|
child: Stack(
|
|
children: List.generate(
|
|
25,
|
|
(index) {
|
|
double spacing = DevicesCubit.get(context)
|
|
.blindWindowHight /
|
|
24;
|
|
double topPosition = index * spacing;
|
|
return AnimatedPositioned(
|
|
duration: const Duration(milliseconds: 200),
|
|
curve: Curves.linear,
|
|
top: topPosition,
|
|
child: SizedBox(
|
|
height: 10,
|
|
width: 270,
|
|
child: Image.asset(
|
|
Assets.assetsImagesHorizintalBlade,
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 80),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
DecoratedBox(
|
|
decoration:
|
|
BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 1,
|
|
blurRadius: 5,
|
|
offset: const Offset(3, 3),
|
|
),
|
|
]),
|
|
child: InkWell(
|
|
overlayColor:
|
|
MaterialStateProperty.all(Colors.transparent),
|
|
onTap: () {
|
|
// DevicesCubit.get(context).setHight(false);
|
|
DevicesCubit.get(context).openCurtain(
|
|
blind?.productType! ?? DeviceType.Blind);
|
|
},
|
|
child: Image.asset(
|
|
Assets.assetsImagesUp,
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
DecoratedBox(
|
|
decoration:
|
|
BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 1,
|
|
blurRadius: 5,
|
|
offset: const Offset(3, 3),
|
|
),
|
|
]),
|
|
child: InkWell(
|
|
overlayColor:
|
|
MaterialStateProperty.all(Colors.transparent),
|
|
onTap: () {
|
|
DevicesCubit.get(context).pauseCurtain();
|
|
},
|
|
child: Image.asset(
|
|
Assets.assetsImagesPause,
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
DecoratedBox(
|
|
decoration:
|
|
BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 1,
|
|
blurRadius: 5,
|
|
offset: const Offset(3, 3),
|
|
),
|
|
]),
|
|
child: InkWell(
|
|
overlayColor:
|
|
MaterialStateProperty.all(Colors.transparent),
|
|
onTap: () {
|
|
DevicesCubit.get(context).closeCurtain(
|
|
blind?.productType! ?? DeviceType.Blind);
|
|
},
|
|
child: Image.asset(
|
|
Assets.assetsImagesDown,
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|