2024-08-29 17:45:39 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/scheduler.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
import 'child_pages/XyChange/xy_change.dart';
|
2024-08-30 17:57:33 +08:00
|
|
|
import 'child_pages/antenna/antenna_setting.dart';
|
2024-11-15 17:42:52 +08:00
|
|
|
// import 'child_pages/connect/bluetooth_page.dart';
|
2024-08-29 17:45:39 +08:00
|
|
|
import 'child_pages/persondetail/person_details.dart';
|
2024-11-15 17:42:52 +08:00
|
|
|
// import 'child_pages/connect/wifi_page.dart';
|
2024-08-29 17:45:39 +08:00
|
|
|
|
|
|
|
import 'component/list_view_item.dart';
|
2024-11-15 17:42:52 +08:00
|
|
|
// import 'child_pages/connect/config/app_config.dart';
|
|
|
|
// import 'child_pages/connect/config/connect_type.dart';
|
2024-11-06 17:23:29 +08:00
|
|
|
import 'child_pages/connect/controllers/blue_tooth_controller.dart';
|
2024-11-15 17:42:52 +08:00
|
|
|
import 'project/view.dart';
|
2024-08-29 17:45:39 +08:00
|
|
|
|
|
|
|
//字体
|
|
|
|
TextStyle textStyle = const TextStyle(fontSize: 15);
|
|
|
|
|
|
|
|
// //是否有获取地址权限
|
|
|
|
// PermissionStatus? _status;
|
|
|
|
|
|
|
|
final BlueToothController blueToothController = Get.put(BlueToothController());
|
|
|
|
String connectedID = "";
|
|
|
|
|
|
|
|
//竖屏
|
|
|
|
class SettingPortrait extends StatefulWidget {
|
|
|
|
const SettingPortrait({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<SettingPortrait> createState() => _SettingPortraitState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettingPortraitState extends State<SettingPortrait> {
|
|
|
|
String userName = "";
|
|
|
|
List<ListItem> items = [];
|
|
|
|
void readID() {
|
|
|
|
setState(() {
|
|
|
|
connectedID = blueToothController.connectedDeviceID.value;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
items = [
|
2024-11-15 17:42:52 +08:00
|
|
|
// ListItem('连接设置', Icons.change_circle_outlined, () {
|
|
|
|
// showDialog(
|
|
|
|
// context: context,
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
// return AlertDialog(
|
|
|
|
// title: const Text("选择连接方式"),
|
|
|
|
// content: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// ListTile(
|
|
|
|
// title: const Text("蓝牙连接"),
|
|
|
|
// onTap: () {
|
|
|
|
// // items[0].text = "连接设置(蓝牙)";
|
|
|
|
// AppConfig.updateConfig("connectType", "bluetooth");
|
|
|
|
// Navigator.push(
|
|
|
|
// context,
|
|
|
|
// MaterialPageRoute(
|
|
|
|
// builder: (context) => const BlueTooth()),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
// ListTile(
|
|
|
|
// title: const Text("WiFi连接"),
|
|
|
|
// onTap: () {
|
|
|
|
// blueToothController.connectedType.value =
|
|
|
|
// ConnectType.wifi;
|
|
|
|
// AppConfig.updateConfig("connectType", "wifi");
|
|
|
|
// // items[0].text = "连接设置(WiFi)";
|
2024-08-29 17:45:39 +08:00
|
|
|
|
2024-11-15 17:42:52 +08:00
|
|
|
// // Connectivity()
|
|
|
|
// // .checkConnectivity()
|
|
|
|
// // .then((connectivityResult) {
|
|
|
|
// // if (connectivityResult != ConnectivityResult.wifi) {
|
|
|
|
// // OpenSettings.openWIFISetting();
|
|
|
|
// // } else {
|
2024-08-29 17:45:39 +08:00
|
|
|
|
2024-11-15 17:42:52 +08:00
|
|
|
// // }
|
|
|
|
// // });
|
|
|
|
// Navigator.push(
|
|
|
|
// context,
|
|
|
|
// MaterialPageRoute(
|
|
|
|
// builder: (context) => const WifiPage()),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// );
|
|
|
|
// }),
|
2024-08-29 17:45:39 +08:00
|
|
|
// ListItem('规划点', Icons.download_outlined, () {
|
|
|
|
// Navigator.push(context,
|
|
|
|
// MaterialPageRoute(builder: (context) => const PlanPoint()));
|
|
|
|
// }),
|
2024-11-15 17:42:52 +08:00
|
|
|
ListItem('坐标转换', Icons.check_box_outlined, () {
|
|
|
|
Navigator.push(
|
|
|
|
context, MaterialPageRoute(builder: (context) => XyChangeView()));
|
2024-08-29 17:45:39 +08:00
|
|
|
}),
|
|
|
|
ListItem('个人中心', Icons.person_outline_outlined, () {
|
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (context) => const PersonDetails()));
|
|
|
|
}),
|
2024-11-15 17:42:52 +08:00
|
|
|
ListItem('项目相关', Icons.insert_drive_file_outlined, () {
|
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (context) => const ProjectView()));
|
|
|
|
}),
|
2024-08-29 17:45:39 +08:00
|
|
|
ListItem('天线位置设置', Icons.settings_input_antenna, () {
|
2024-08-30 17:57:33 +08:00
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (context) => const AntennaSetting()));
|
2024-08-29 17:45:39 +08:00
|
|
|
}),
|
|
|
|
];
|
|
|
|
SchedulerBinding.instance.addPostFrameCallback((_) async {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ListView.builder(
|
|
|
|
itemCount: items.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Obx(() {
|
|
|
|
blueToothController.connectedType.value;
|
|
|
|
return SizedBox(
|
|
|
|
height: 40,
|
|
|
|
child: ListTileButton(
|
|
|
|
item: items[index],
|
|
|
|
));
|
|
|
|
}),
|
|
|
|
const Divider(), // 在每个列表项下方添加一条线
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|