showProxySettingDialog static method

Future<List> showProxySettingDialog(
  1. BuildContext context, {
  2. String? proxyText,
  3. GestureTapCallback? onTap,
})

Implementation

static Future<List> showProxySettingDialog(BuildContext context,
    {String? proxyText, GestureTapCallback? onTap}) async {
  var isSave = await showDialog(
      context: context,
      builder: (_) {
        return AlertDialog(
          title: Row(
            children: [
              const Text(
                '设置代理',
                style: TextStyle(fontSize: 16),
              ),
              InkWell(
                  onTap: onTap,
                  child: const Padding(
                      padding: EdgeInsets.all(5),
                      child: Icon(
                        Icons.question_mark_rounded,
                        color: Colors.grey,
                        size: 18,
                      )))
            ],
          ),
          titlePadding: const EdgeInsets.all(10),
          titleTextStyle:
              const TextStyle(color: Colors.black87, fontSize: 20),
          content: TextField(
            controller: TextEditingController(text: proxyText),
            onChanged: (value) => proxyText = value,
          ),
          contentPadding: const EdgeInsets.all(10),
          contentTextStyle:
              const TextStyle(fontSize: 15, color: Colors.black54),
          actions: [
            TextButton(
                onPressed: () {
                  Navigator.of(context).pop(false);
                },
                child: const Text('取消')),
            TextButton(
                onPressed: () {
                  Navigator.of(context).pop(true);
                },
                child: const Text('确认'))
          ],
        );
      });
  proxyText = proxyText == null ? proxyText : proxyText!.trim();
  return [isSave, proxyText];
}