import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:get/get.dart'; import 'child_pages/XyChange/xy_change.dart'; import 'child_pages/antenna/antenna_setting.dart'; // import 'child_pages/connect/bluetooth_page.dart'; import 'child_pages/persondetail/person_details.dart'; // import 'child_pages/connect/wifi_page.dart'; import 'component/list_view_item.dart'; // import 'child_pages/connect/config/app_config.dart'; // import 'child_pages/connect/config/connect_type.dart'; import 'child_pages/connect/controllers/blue_tooth_controller.dart'; import 'project/view.dart'; //字体 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 createState() => _SettingPortraitState(); } class _SettingPortraitState extends State { String userName = ""; List items = []; void readID() { setState(() { connectedID = blueToothController.connectedDeviceID.value; }); } @override void initState() { super.initState(); items = [ // ListItem('连接设置', Icons.change_circle_outlined, () { // showDialog( // context: context, // builder: (BuildContext context) { // return AlertDialog( // title: const Text("选择连接方式"), // content: Column( // mainAxisSize: MainAxisSize.min, // children: [ // 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)"; // // Connectivity() // // .checkConnectivity() // // .then((connectivityResult) { // // if (connectivityResult != ConnectivityResult.wifi) { // // OpenSettings.openWIFISetting(); // // } else { // // } // // }); // Navigator.push( // context, // MaterialPageRoute( // builder: (context) => const WifiPage()), // ); // }, // ), // ], // ), // ); // }, // ); // }), // ListItem('规划点', Icons.download_outlined, () { // Navigator.push(context, // MaterialPageRoute(builder: (context) => const PlanPoint())); // }), ListItem('坐标转换', Icons.check_box_outlined, () { Navigator.push( context, MaterialPageRoute(builder: (context) => XyChangeView())); }), ListItem('个人中心', Icons.person_outline_outlined, () { Navigator.push(context, MaterialPageRoute(builder: (context) => const PersonDetails())); }), ListItem('项目相关', Icons.insert_drive_file_outlined, () { Navigator.push(context, MaterialPageRoute(builder: (context) => const ProjectView())); }), ListItem('天线位置设置', Icons.settings_input_antenna, () { Navigator.push(context, MaterialPageRoute(builder: (context) => const AntennaSetting())); }), ]; SchedulerBinding.instance.addPostFrameCallback((_) async {}); } @override Widget build(BuildContext context) { return ListView.builder( itemCount: items.length, itemBuilder: (BuildContext context, int index) { return Column( children: [ Obx(() { blueToothController.connectedType.value; return SizedBox( height: 40, child: ListTileButton( item: items[index], )); }), const Divider(), // 在每个列表项下方添加一条线 ], ); }, ); } }