push functions static data

This commit is contained in:
ashrafzarkanisala
2024-06-26 02:18:15 +03:00
parent 6413d2b876
commit 3ddd4ed197
34 changed files with 1044 additions and 120 deletions

View File

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
class AlertDialogCountdown extends StatefulWidget {
const AlertDialogCountdown({super.key});
@override
State<AlertDialogCountdown> createState() => _AlertDialogCountdownState();
}
class _AlertDialogCountdownState extends State<AlertDialogCountdown> {
@override
Widget build(BuildContext context) {
return Row(
children: [
],
);
}
}

View File

@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
class AlertDialogFunctionsOperationsBody extends StatefulWidget {
const AlertDialogFunctionsOperationsBody({
super.key,
required this.functions,
required this.index,
});
final List<SceneStaticFunction> functions;
final int index;
@override
State<AlertDialogFunctionsOperationsBody> createState() =>
_AlertDialogFunctionsOperationsBodyState();
}
class _AlertDialogFunctionsOperationsBodyState
extends State<AlertDialogFunctionsOperationsBody> {
String? groupValue = "";
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
...widget.functions[widget.index].operationalValues.map(
(operation) => SceneListTile(
iconsSize: 22,
minLeadingWidth: 15,
padding: const EdgeInsets.symmetric(horizontal: 16),
assetPath: operation.icon,
titleString: operation.value,
textAlign: TextAlign.start,
trailingWidget: Radio(
value: operation.value,
groupValue: groupValue,
onChanged: (value) {
setState(() {
groupValue = value;
});
},
),
onPressed: () {
setState(() {
groupValue = operation.value;
});
},
),
),
],
),
);
}
}

View File

@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_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 AlertDialogTemperatureBody extends StatefulWidget {
const AlertDialogTemperatureBody({
super.key,
required this.index,
required this.functions,
});
final List<SceneStaticFunction> functions;
final int index;
@override
State<AlertDialogTemperatureBody> createState() =>
_AlertDialogTemperatureBodyState();
}
class _AlertDialogTemperatureBodyState
extends State<AlertDialogTemperatureBody> {
double temperature = 16;
@override
Widget build(BuildContext context) {
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
leading: IconButton(
onPressed: () {
setState(() {
temperature--;
});
},
icon: const Icon(
Icons.remove,
size: 32,
color: ColorsManager.greyColor,
)),
title: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TitleMedium(
text: temperature.toString(),
style: context.titleMedium.copyWith(
color: ColorsManager.primaryColorWithOpacity,
fontSize: 30,
)),
const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: SvgPicture.asset(
Assets.assetsCelsiusDegrees,
alignment: Alignment.topCenter,
width: 32,
),
),
],
),
subtitle: BodyLarge(
text: widget.functions[widget.index].operationalValues[0].value,
textAlign: TextAlign.center,
),
trailing: IconButton(
onPressed: () {
setState(() {
temperature++;
});
},
icon: const Icon(
Icons.add,
size: 32,
color: ColorsManager.greyColor,
)),
);
}
}

View File

@ -1,6 +1,5 @@
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';
@ -75,17 +74,7 @@ class CustomBottomSheetWidget extends StatelessWidget {
size: 16,
color: ColorsManager.greyColor,
),
onPressed: () {
context.customAlertDialog(
height: 300,
child: Material(
child: DefaultContainer(
width: context.width * 0.8,
child: Text('Comming soon'),
),
),
);
},
onPressed: () {},
),
],
),

View File

@ -11,7 +11,6 @@ class SceneListTile extends StatelessWidget {
super.key,
this.assetPath,
this.titleString,
this.subtitle,
this.leadingWidget,
this.trailingWidget,
this.padding,
@ -20,10 +19,14 @@ class SceneListTile extends StatelessWidget {
this.assetHeight,
this.minLeadingWidth,
this.titleWidget,
this.subtitleString,
this.subtitleWidget,
this.iconsSize,
});
final String? assetPath;
final String? titleString;
final String? subtitle;
final Widget? subtitleWidget;
final String? subtitleString;
final Widget? leadingWidget;
final Widget? trailingWidget;
final EdgeInsetsGeometry? padding;
@ -32,6 +35,7 @@ class SceneListTile extends StatelessWidget {
final double? assetHeight;
final double? minLeadingWidth;
final Widget? titleWidget;
final double? iconsSize;
@override
Widget build(BuildContext context) {
@ -39,11 +43,15 @@ class SceneListTile extends StatelessWidget {
minLeadingWidth: minLeadingWidth ?? 40,
leading: leadingWidget ??
(assetPath != null
? SvgPicture.asset(
assetPath ?? Assets.assetsImagesLogo,
width: 20,
height: assetHeight ?? 32,
fit: BoxFit.fitWidth,
? SizedBox(
width: iconsSize,
child: SvgPicture.asset(
assetPath ?? Assets.assetsImagesLogo,
width: 20,
height: assetHeight ?? 32,
alignment: Alignment.center,
fit: BoxFit.fill,
),
)
: null),
trailing: trailingWidget,
@ -54,13 +62,15 @@ class SceneListTile extends StatelessWidget {
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),
),
subtitle: subtitleWidget ??
(subtitleString?.isNotEmpty == true
? BodySmall(
text: subtitleString ?? '',
style: context.bodySmall.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.greyColor),
)
: null),
onTap: onPressed,
);
}