import 'package:flutter/material.dart'; import 'package:skywood/main/lib_file.dart'; import 'package:skywood/utils/tools/widgets/sky_common_widget.dart'; class NoDataView extends StatelessWidget { const NoDataView({super.key, this.title = 'No Data', // 'Nothing here yet.\nCome back later for more fun!', // Something went wrong.\nPlease try again. this.subtitle = 'Nothing here yet.\nCome back later for more fun!', this.btnText = 'RETRY', this.imgName, this.onTap, }); final String title; final String subtitle; final String btnText; final String? imgName; final VoidCallback? onTap; @override Widget build(BuildContext context) { return Container( width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox(height: 100), HelpImg.asset(ConstImg.nodataImg, width: 136), const SizedBox(height: 14), _customText(title), const SizedBox(height: 10), SkyText(text: subtitle, maxLines: 2, fontSize: 14, color: CommonColor.black, textAlign: TextAlign.center, ), const SizedBox(height: 14), if (onTap != null) InkWell( onTap: onTap, child: Stack( children: [ HelpImg.asset(imgName ?? ConstImg.btnBg, width: 140, height: 46, fit: BoxFit.fill,), Positioned.fill( child: Center( child: SkyText(text: btnText, color: Colors.white), ), ) ], ) ) ], ), ); } _customText(String text) { return Text( text, textAlign: TextAlign.center, style: TextStyle( fontSize: 16, color: Colors.white, // 内部字体白色 fontStyle: FontStyle.italic, fontFamily: 'Inter', fontWeight: FontWeight.w600, shadows: [ Shadow( color: Colors.black, // 描边颜色 offset: Offset(1, 1), // 偏移量 blurRadius: 0, // 不模糊,形成硬边描边 ), Shadow( color: Colors.black, offset: Offset(-1, -1), blurRadius: 0, ), Shadow( color: Colors.black, offset: Offset(1, -1), blurRadius: 0, ), Shadow( color: Colors.black, offset: Offset(-1, 1), blurRadius: 0, ), ], ), ); } }