Added add comment fallback dns

This commit is contained in:
Juan Gilsanz Polo 2024-02-29 15:33:26 +01:00
parent 019367ca93
commit 654284b46a

View file

@ -113,6 +113,44 @@ class _FallbackDnsScreenState extends State<FallbackDnsScreen> {
} }
} }
void openAddCommentModal() {
if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) {
showDialog(
context: context,
builder: (context) => CommentModal(
onConfirm: (value) {
setState(() {
fallbackControllers.add({
'comment': value
});
});
},
dialog: true,
),
);
}
else {
showModalBottomSheet(
context: context,
useRootNavigator: true,
builder: (context) => CommentModal(
onConfirm: (value) {
setState(() {
fallbackControllers.add({
'comment': value
});
});
},
dialog: false,
),
backgroundColor: Colors.transparent,
isScrollControlled: true,
isDismissible: true
);
}
}
void openEditCommentModal(Map<String, dynamic> item, int position) { void openEditCommentModal(Map<String, dynamic> item, int position) {
if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) { if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) {
showDialog( showDialog(
@ -267,9 +305,14 @@ class _FallbackDnsScreenState extends State<FallbackDnsScreen> {
), ),
)), )),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ElevatedButton.icon(
onPressed: openAddCommentModal,
icon: const Icon(Icons.add),
label: Text(AppLocalizations.of(context)!.comment)
),
ElevatedButton.icon( ElevatedButton.icon(
onPressed: () { onPressed: () {
setState(() => fallbackControllers.add({ setState(() => fallbackControllers.add({
@ -279,7 +322,7 @@ class _FallbackDnsScreenState extends State<FallbackDnsScreen> {
checkValidValues(); checkValidValues();
}, },
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
label: Text(AppLocalizations.of(context)!.addItem) label: Text(AppLocalizations.of(context)!.address)
), ),
], ],
), ),