w-R
3 years ago
13 changed files with 544 additions and 163 deletions
@ -0,0 +1,136 @@
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/utils/bridge.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:path_provider/path_provider.dart'; |
||||
|
||||
class UpdateDialog extends StatefulWidget { |
||||
final String version; |
||||
|
||||
UpdateDialog(this.version); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _UpdateDialog(); |
||||
} |
||||
} |
||||
|
||||
class _UpdateDialog extends State<UpdateDialog> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Material( |
||||
type: MaterialType.transparency, |
||||
child: Center( |
||||
child: Container( |
||||
width: MediaQuery.of(context).size.width - 80.w, |
||||
height: 150.h, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height: 90.h, |
||||
alignment: Alignment.center, |
||||
padding: EdgeInsets.all(20), |
||||
child: Column( |
||||
children: [ |
||||
Text( |
||||
"检测到新版本 v${widget.version}", |
||||
style: TextStyle( |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
Text( |
||||
"是否需要更新到最新版本?", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
) |
||||
), |
||||
Container( |
||||
color: Color(0x1A000000), |
||||
height: 1.h, |
||||
), |
||||
Container( |
||||
height: 55.h, |
||||
child: Row( |
||||
mainAxisSize: MainAxisSize.max, |
||||
children: [ |
||||
Expanded( |
||||
child: InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
height: 90.h, |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
"下次再说", |
||||
style: TextStyle( |
||||
fontSize: 17.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Container( |
||||
color: Color(0x1A000000), |
||||
width: 1.h, |
||||
), |
||||
Expanded( |
||||
child: InkWell( |
||||
onTap: () { |
||||
Bridge.toAppStore().then((value) { |
||||
|
||||
}); |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
height: 90.h, |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
"立即更新", |
||||
style: TextStyle( |
||||
fontSize: 17.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF32A060), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
Future<String> _findLocalPath(BuildContext context) async { |
||||
final directory = Theme.of(context).platform == TargetPlatform.android |
||||
? await getExternalStorageDirectory() |
||||
: await getApplicationDocumentsDirectory(); |
||||
return directory.path; |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue