skywood/lib/pages/mine/widget/mine_section_view.dart

93 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:skywood/main/lib_file.dart';
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
class MineSectionView extends StatelessWidget {
const MineSectionView({
super.key,
this.width,
this.height,
required this.title,
required this.imgName,
this.type = 1, // 1,2
this.paddingSpace = 5,
this.child
});
final String title;
final double? width;
final double? height;
final String imgName;
final int type;
final double paddingSpace;
final Widget? child;
@override
Widget build(BuildContext context) {
return Stack(
children: [
HelpImg.asset(imgName, width: width, height: height, fit: BoxFit.fill),
Positioned(
left: paddingSpace, right: paddingSpace, top: 8,
child: Column(
children: [
_buildHeader(),
const SizedBox(height: 10),
child ?? SizedBox()
],
),
),
],
);
}
Widget _buildHeader() {
return Stack(
children: [
HelpImg.asset(ConstImg.sectionTopBg, width: width, height: 20.h),
Positioned(
left: 7, right: 7, top: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
HelpImg.asset(ConstImg.littleLeft, width: 7),
const SizedBox(width: 2),
SkyText(text: title, fontSize: 12, color: Colors.white)
],
),
Row(
children: List.generate(3, (i) {
return HelpImg.asset(ConstImg.littleRight, width: 5);
}),
)
],
),
)
],
);
}
}
class mImgBg extends StatelessWidget {
const mImgBg({super.key,
this.width,
this.height,
this.fit = BoxFit.fill,
required this.imgName,
});
final double? width;
final double? height;
final String imgName;
final BoxFit fit;
@override
Widget build(BuildContext context) {
return HelpImg.asset(imgName, width: width, height: height, fit: fit);
}
}