组件封装
This commit is contained in:
17
lib/muyu/muyu_image.dart
Normal file
17
lib/muyu/muyu_image.dart
Normal file
@@ -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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_first_station/muyu/muyu_image.dart';
|
||||||
|
|
||||||
import 'count_panel.dart';
|
import 'count_panel.dart';
|
||||||
|
|
||||||
@@ -36,7 +37,11 @@ class _MuyuPageState extends State<MuyuPage> {
|
|||||||
onTapSwitchImage: _onTapSwitchImage,
|
onTapSwitchImage: _onTapSwitchImage,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(child: _buildImage()),
|
Expanded(
|
||||||
|
child: MuyuAssetsImage(
|
||||||
|
image: 'assets/images/muyu.png',
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -44,14 +49,6 @@ class _MuyuPageState extends State<MuyuPage> {
|
|||||||
|
|
||||||
void _toHistory() {}
|
void _toHistory() {}
|
||||||
|
|
||||||
Widget _buildImage() {
|
|
||||||
return Center(
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/muyu.png',
|
|
||||||
height: 200,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onTapSwitchAudio() {}
|
void _onTapSwitchAudio() {}
|
||||||
|
|
||||||
void _onTapSwitchImage() {}
|
void _onTapSwitchImage() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user