Files
2024-10-16 16:34:53 +03:00

121 lines
4.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:syncrow_app/features/scene/view/settings/Temperature_dialog.dart';
import 'package:syncrow_app/features/scene/view/settings/condition_dialog.dart';
import 'package:syncrow_app/features/scene/view/settings/humidity_dialog.dart';
import 'package:syncrow_app/features/scene/view/settings/weather_bottom_sheet.dart';
import 'package:syncrow_app/features/scene/view/settings/weather_dialog.dart';
import 'package:syncrow_app/features/scene/view/settings/wind_speed_dialog.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.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/utils/resource_manager/color_manager.dart';
class ValidityPage extends StatelessWidget {
const ValidityPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: 'Validity',
padding: EdgeInsets.zero,
leading: IconButton(
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.arrow_back_ios),
),
child: Column(
children: [
DefaultContainer(
child: ListTile(
title: const BodyMedium(
text: 'When any condition is met',
fontWeight: FontWeight.normal,
),
trailing: const Icon(Icons.arrow_forward_ios,
size: 15, color: ColorsManager.textGray),
onTap: () => _showConditionDialog(context),
),
),
const SizedBox(height: 16),
InkWell(
onTap: () => showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20.0)),
),
builder: (BuildContext context) => WeatherBottomSheet(
showTemperatureDialog: () {
showDialog(
context: context,
builder: (BuildContext context) => TemperatureDialog(
confirmTab: (label, toggleIndex, selectedCity) {
print(label);
print(toggleIndex);
print(selectedCity);
},
),
);
},
showHumidityDialog: () {
showDialog(
context: context,
builder: (BuildContext context) => HumidityDialog(
initialSelectedLabel: 'Dry',
cancelTab: () => Navigator.of(context).pop(),
confirmTab: (v) {},
title: 'Humidity',
label1: 'Dry',
label2: 'Comfortable',
label3: 'Moist',
),
);
},
showWeatherDialog: () {
showDialog(
context: context,
builder: (BuildContext context) => WeatherDialog(
initialSelectedLabel: 'Sunny',
cancelTab: () {},
confirmTab: (selectedOption) {},
title: 'Weather',
label1: 'Sunny',
label2: 'Cloudy',
label3: 'Rainy',
label4: 'Snowy',
label5: 'Hazy',
),
);
},
showWindSpeedDialog: () {
showDialog(
context: context,
builder: (BuildContext context) => WindSpeedDialog(
confirmTab: (selectedTemperature, selectedToggleIndex,
selectedCity) {},
),
);
},
),
),
child: const DefaultContainer(
child: Center(
child: Padding(
padding: EdgeInsets.all(5.0),
child: BodyLarge(text: '+ Add'),
),
),
),
),
],
),
);
}
void _showConditionDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) => const ConditionDialog(),
);
}
}