|
|
|
@ -15,50 +15,6 @@ class MuseumInfoPage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _MuseumInfoPageState extends State<MuseumInfoPage> {
|
|
|
|
|
// 用于构建图片的函数
|
|
|
|
|
Widget _buildImage(String imagePath, double height, double verticalOffset) {
|
|
|
|
|
return Center( // 将图片居中
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: height, // 使用传递的高度参数
|
|
|
|
|
child: Transform.translate(
|
|
|
|
|
offset: Offset(0, verticalOffset), // 使用传递的垂直偏移参数
|
|
|
|
|
child: Transform.scale(
|
|
|
|
|
scale: 0.9,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
imagePath,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildCustomButton(String buttonText, double height, double verticalOffset, void Function() onPressed) {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: height, // 自定义按钮高度
|
|
|
|
|
child: Transform.translate(
|
|
|
|
|
offset: Offset(0, verticalOffset), // 自定义垂直偏移量
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
onPressed: onPressed, // 自定义按钮点击功能
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: Colors.green, // 背景颜色绿色
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 12,
|
|
|
|
|
vertical: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
buttonText, // 自定义按钮文字内容
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white, // 文字颜色白色
|
|
|
|
|
fontSize: 18, // 字号大小18
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
@ -102,3 +58,47 @@ class _MuseumInfoPageState extends State<MuseumInfoPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用于构建图片的函数
|
|
|
|
|
Widget _buildImage(String imagePath, double height, double verticalOffset) {
|
|
|
|
|
return Center( // 将图片居中
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: height, // 使用传递的高度参数
|
|
|
|
|
child: Transform.translate(
|
|
|
|
|
offset: Offset(0, verticalOffset), // 使用传递的垂直偏移参数
|
|
|
|
|
child: Transform.scale(
|
|
|
|
|
scale: 0.9,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
imagePath,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildCustomButton(String buttonText, double height, double verticalOffset, void Function() onPressed) {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: height, // 自定义按钮高度
|
|
|
|
|
child: Transform.translate(
|
|
|
|
|
offset: Offset(0, verticalOffset), // 自定义垂直偏移量
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
onPressed: onPressed, // 自定义按钮点击功能
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: Colors.green, // 背景颜色绿色
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 12,
|
|
|
|
|
vertical: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
buttonText, // 自定义按钮文字内容
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white, // 文字颜色白色
|
|
|
|
|
fontSize: 18, // 字号大小18
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|