import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/router/router.util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/widgets/gradient_button.dart'; class UpgradeConfirm extends StatelessWidget { final void Function()? onConfirm; final bool forceUpgrade; final String version; const UpgradeConfirm( {super.key, this.onConfirm, this.forceUpgrade = true, required this.version}); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(ScreenAdaper.radius(30))), margin: EdgeInsets.only(bottom: ScreenAdaper.height(30)), alignment: Alignment.center, child: Stack( children: [ Container( height: ScreenAdaper.height(600), constraints: BoxConstraints(maxHeight: ScreenAdaper.height(600)), width: ScreenAdaper.width(800), margin: EdgeInsets.only( top: ScreenAdaper.height(100), ), padding: EdgeInsets.only( top: ScreenAdaper.height(50), bottom: ScreenAdaper.height(30)), decoration: BoxDecoration( color: AppTheme.nearlyWhite, borderRadius: BorderRadius.circular(ScreenAdaper.radius(30))), child: Column( children: [ Text( '有新的版本v_${version}更新啦', style: TextStyle( decoration: TextDecoration.none, fontSize: ScreenAdaper.height(35), color: AppTheme.nearlyBlack, ), ), SizedBox( height: ScreenAdaper.height(30), ), Expanded( child: SingleChildScrollView( child: Column( children: [ Text('1.修复bug', style: TextStyle( decoration: TextDecoration.none, fontSize: ScreenAdaper.height(30), color: AppTheme.grey, fontWeight: FontWeight.w400)), Text('2.优化体验', style: TextStyle( decoration: TextDecoration.none, fontSize: ScreenAdaper.height(30), color: AppTheme.grey, fontWeight: FontWeight.w400)), ], ))), SizedBox( height: ScreenAdaper.height(30), ), SizedBox( width: ScreenAdaper.height(400), child: GradientButton( buttonText: '去更新', onPressed: () { if (onConfirm != null) onConfirm!(); }, ), ) ], ), ), if (!forceUpgrade) Positioned( right: 0, top: ScreenAdaper.height(100), child: // 更新内容 IconButton( onPressed: () { RouterUtil.back(); }, icon: const Icon(Icons.close)), ), // 悬浮图标 Positioned( left: 0, right: 0, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image( image: const AssetImage('assets/images/rocket.png'), height: ScreenAdaper.height(150), ) ], ), ), ], ), ); } }