mirror of
https://bitbucket.org/myhomie/myhomie_app.git
synced 2025-12-06 17:11:19 +00:00
90 lines
4.2 KiB
Dart
90 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mycore_api/api.dart';
|
|
import 'package:myhomie_app/Components/Alarms/getCurrentAlarmModeIcon.dart';
|
|
import 'package:myhomie_app/Models/homieContext.dart';
|
|
import 'package:myhomie_app/constants.dart';
|
|
|
|
Future<String?> showChangeAlarmModePopup(List<AlarmModeDTO> allAlarmModes, HomieAppContext homieAppContext, BuildContext context, Size size) {
|
|
return showDialog(
|
|
builder: (BuildContext dialogContext) => AlertDialog(
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0))
|
|
),
|
|
content: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
SizedBox(
|
|
height: size.height * 0.5,
|
|
width: size.width * 0.95,
|
|
child: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left:8.0, right: 8.0, bottom: 8.0, top: 8.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text("Changer le mode d'alarme courante"),
|
|
),
|
|
SingleChildScrollView(
|
|
child: Container(
|
|
height: size.height*0.4,
|
|
//color: Colors.orange,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
for(var alarmMode in allAlarmModes)
|
|
SizedBox(
|
|
width: size.width * 0.5,
|
|
height: size.height * 0.05,
|
|
child: InkWell(
|
|
onTap: () {
|
|
Navigator.pop(dialogContext, alarmMode.id);
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(20.0),
|
|
border: Border.all(
|
|
color: kBackgroundSecondGrey.withOpacity(0.35),
|
|
width: 0.2,
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: kMainColor.withOpacity(0.35),
|
|
//spreadRadius: 0.15,
|
|
blurRadius: 5,
|
|
offset: const Offset(0, 10), // changes position of shadow
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text(alarmMode.name!),
|
|
Icon(getAlarmModeIcon(alarmMode)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
contentPadding: EdgeInsets.zero,
|
|
), context: context
|
|
);
|
|
}
|