From 6830d62ab9a4df752324b9ea68ee2f98b2b83e5d Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Sat, 29 Apr 2023 11:29:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/muyu/muyu_image.dart | 17 +++++++++++++++++ lib/muyu/muyu_page.dart | 15 ++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 lib/muyu/muyu_image.dart diff --git a/lib/muyu/muyu_image.dart b/lib/muyu/muyu_image.dart new file mode 100644 index 0000000..1f15c12 --- /dev/null +++ b/lib/muyu/muyu_image.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +class MuyuAssetsImage extends StatelessWidget { + final String image; + + const MuyuAssetsImage({super.key, required this.image}); + + @override + Widget build(BuildContext context) { + return Center( + child: Image.asset( + image, + height: 200, + ), + ); + } +} diff --git a/lib/muyu/muyu_page.dart b/lib/muyu/muyu_page.dart index 9c5f016..182c573 100644 --- a/lib/muyu/muyu_page.dart +++ b/lib/muyu/muyu_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_first_station/muyu/muyu_image.dart'; import 'count_panel.dart'; @@ -36,7 +37,11 @@ class _MuyuPageState extends State { onTapSwitchImage: _onTapSwitchImage, ), ), - Expanded(child: _buildImage()), + Expanded( + child: MuyuAssetsImage( + image: 'assets/images/muyu.png', + ), + ), ], ), ); @@ -44,14 +49,6 @@ class _MuyuPageState extends State { void _toHistory() {} - Widget _buildImage() { - return Center( - child: Image.asset( - 'assets/images/muyu.png', - height: 200, - )); - } - void _onTapSwitchAudio() {} void _onTapSwitchImage() {}