1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/components/button.dart';
- import 'package:vitalapp/components/cell.dart';
- import 'package:vitalapp/components/dialog_input.dart';
- import 'package:vitalapp/components/dialog_number.dart';
- import 'package:vitalapp/components/dialog_select.dart';
- import 'package:vitalapp/pages/settings/server/widgets/protocol_switch.dart';
- import 'controller.dart';
- import 'widgets/dialog_saved_list.dart';
- class ServerSettingPage extends GetView<ServerSettingController> {
- const ServerSettingPage({super.key});
- @override
- Widget build(BuildContext context) {
- final state = controller.state;
- return Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- VListFormCellGroup(
- children: [
- VListFormCell(
- label: "已保存地址",
- onTap: () async {
- final result = await SavedServersDialog.show();
- if (result != null) {
- //
- }
- },
- ),
- Obx(
- () => VListFormCell(
- label: "协议",
- contentWidget: ProtocolSwitchWidget(
- useSSL: state.enableSSL,
- onChanged: (value) {
- state.enableSSL = value;
- },
- ),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "域名/IP",
- content: state.host,
- onTap: () async {
- final newValue = await VDialogInput(
- title: "域名/IP",
- initialValue: state.host.toString(),
- ).show();
- if (newValue != null) {
- state.host = newValue;
- }
- },
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "端口",
- content: state.port.toString(),
- onTap: () async {
- final newValue = await VDialogNumber(
- title: "端口",
- initialValue: state.port.toString(),
- ).show();
- if (newValue != null) {
- state.port = int.parse(newValue);
- }
- },
- ),
- ),
- ],
- ),
- Padding(
- padding: const EdgeInsets.only(bottom: 30),
- child: VButton(
- label: "保存",
- onTap: controller.submit,
- ),
- ),
- ],
- );
- }
- }
|