首页显示优化
This commit is contained in:
@@ -16,11 +16,16 @@ class ImmersionHeader extends StatelessWidget {
|
||||
final DeviceEntity device;
|
||||
const ImmersionHeader({super.key, required this.device});
|
||||
|
||||
String _formatName(String name, {int keepLength = 20}) {
|
||||
if (name.length <= keepLength) return name;
|
||||
return name.substring(name.length - keepLength);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 380,
|
||||
height: 310,
|
||||
// 1. 修改这里:去掉 color: Colors.white,改用透明或背景色
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.transparent, // 设为透明,直接透出 Scaffold 的 offWhite
|
||||
@@ -29,14 +34,14 @@ class ImmersionHeader extends StatelessWidget {
|
||||
children: [
|
||||
// 背景文字占位 (SataBot)
|
||||
Positioned(
|
||||
top: 140,
|
||||
top: 130,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Text(
|
||||
'SataBot',
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 100,
|
||||
fontSize: 80,
|
||||
fontWeight: FontWeight.w900,
|
||||
// 2. 既然背景变深了,背景字可以稍微再淡一点点
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
@@ -46,11 +51,12 @@ class ImmersionHeader extends StatelessWidget {
|
||||
|
||||
// 机器大图
|
||||
Transform.translate(
|
||||
offset: const Offset(20, 90), // 正数向右移动(例如 20 像素),负数向左
|
||||
offset: const Offset(30, 80), // 正数向右移动(例如 20 像素),负数向左
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
'assets/images/car.png',
|
||||
width: 380,
|
||||
width: 330,
|
||||
height: 190,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
@@ -73,7 +79,7 @@ class ImmersionHeader extends StatelessWidget {
|
||||
children: [
|
||||
// 设备名称和电量
|
||||
Text(
|
||||
device.displayName,
|
||||
_formatName(device.displayName),
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w900,
|
||||
|
||||
Reference in New Issue
Block a user