import 'package:flutter/material.dart'; import 'skyInfo.dart'; import 'skyplot.dart'; class SkyInfoPlotPage extends StatelessWidget { @override Widget build(BuildContext context) { final orientation = MediaQuery.of(context).orientation; bool isPortrait = orientation == Orientation.portrait; return Scaffold( appBar: AppBar( title: const Text('天空图'), ), body: isPortrait ? Column( children: [ // 左侧的 SkyInfo const Expanded( child: Padding( padding: EdgeInsets.all(16.0), // 添加一些内边距 child: SkyInfo( lat: '34.05', lon: '-118.25', hdop: '100', status: 1, // 假设这是状态的索引 view: 5, use: 3, time: '2024-07-30 12:00', ), ), ), // 右侧的 CustomPaint Container( width: 400, // 设置固定宽度 child: CustomPaint( size: Size(400, 400), // 充满整个屏幕 painter: DrawSky(context, false, []), // 传递参数 ), ), ], ) : Row( children: [ // 左侧的 SkyInfo const Expanded( child: Padding( padding: EdgeInsets.all(16.0), // 添加一些内边距 child: SkyInfo( lat: '34.05', lon: '-118.25', hdop: '100', status: 1, // 假设这是状态的索引 view: 5, use: 3, time: '2024-07-30 12:00', ), ), ), // 右侧的 CustomPaint Container( width: 400, // 设置固定宽度 child: CustomPaint( size: Size(400, 400), // 充满整个屏幕 painter: DrawSky(context, false, []), // 传递参数 ), ), ], ), ); } }