import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter/foundation.dart'; import 'package:mobile_nebula/components/FormPage.dart'; import 'package:mobile_nebula/components/config/ConfigButtonItem.dart'; import 'package:mobile_nebula/components/config/ConfigPageItem.dart'; import 'package:mobile_nebula/components/config/ConfigSection.dart'; import 'package:mobile_nebula/screens/siteConfig/DNSResolverScreen.dart'; import 'package:mobile_nebula/services/utils.dart'; class DNSResolversScreen extends StatefulWidget { const DNSResolversScreen( {Key? key, required this.dnsResolvers, required this.onSave}) : super(key: key); final List dnsResolvers; final ValueChanged> onSave; @override _DNSResolversScreenState createState() => _DNSResolversScreenState(); } class _DNSResolversScreenState extends State { late List dnsResolvers = []; bool changed = false; @override void initState() { widget.dnsResolvers.forEach((dnsResolver) { dnsResolvers.add(dnsResolver); }); super.initState(); } @override Widget build(BuildContext context) { return FormPage( title: 'DNS Resolvers', changed: changed, onSave: _onSave, child: ConfigSection( children: _build(), )); } _onSave() { Navigator.pop(context); if (widget.onSave != null) { widget.onSave(dnsResolvers); } } List _build() { List items = []; for (var i=0; i