You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
277 lines
8.3 KiB
277 lines
8.3 KiB
import 'dart:io'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/utils/constant.dart'; |
|
import 'package:huixiang/utils/font_weight.dart'; |
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
import 'package:package_info_plus/package_info_plus.dart'; |
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
class AboutPage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _AboutPage(); |
|
} |
|
} |
|
|
|
class _AboutPage extends State<AboutPage> { |
|
String version = ""; |
|
|
|
@override |
|
void initState() { |
|
super.initState(); |
|
|
|
PackageInfo.fromPlatform().then((PackageInfo packageInfo) { |
|
version = packageInfo.version; |
|
setState(() {}); |
|
}); |
|
} |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Scaffold( |
|
appBar: MyAppBar( |
|
title: S.of(context).guanyu, |
|
titleColor: Colors.black, |
|
background: Color(0xFFF7F7F7), |
|
leadingColor: Colors.black, |
|
), |
|
body: Stack( |
|
children: [ |
|
Container( |
|
decoration: new BoxDecoration( |
|
border: Border( |
|
bottom: BorderSide( |
|
color: Color(0xffF7F7F7), |
|
width: 0.0, |
|
), |
|
), |
|
color: Color(0xffF7F7F7), |
|
), |
|
padding: EdgeInsets.only(top: 25), |
|
alignment: Alignment.center, |
|
child: SingleChildScrollView( |
|
physics: BouncingScrollPhysics(), |
|
child: Column( |
|
children: [ |
|
Image.asset( |
|
"assets/image/icon_about_logo.webp", |
|
width: 130, |
|
height: 130, |
|
), |
|
Padding( |
|
padding: { |
|
't': 32, |
|
'b': 5, |
|
'l': 15, |
|
'r': 15, |
|
}.mpOnly, |
|
child: Text( |
|
S.of(context).yixinhuixiang, |
|
overflow: TextOverflow.ellipsis, |
|
textAlign: TextAlign.center, |
|
maxLines: 1, |
|
style: TextStyle( |
|
fontSize: 30, |
|
color: Color(0xFF30415B), |
|
), |
|
), |
|
), |
|
Text( |
|
S.of(context).guojiankangyoujishenghuo, |
|
overflow: TextOverflow.ellipsis, |
|
textAlign: TextAlign.center, |
|
maxLines: 1, |
|
style: TextStyle( |
|
fontSize: 16, |
|
fontWeight: MyFontWeight.regular, |
|
color: Color(0xffB2B2B2), |
|
), |
|
), |
|
SizedBox( |
|
height: 20, |
|
), |
|
GestureDetector( |
|
onTap: () { |
|
// updateApp(); |
|
}, |
|
child: settingItem( |
|
S.of(context).dangqianbanben, |
|
S.of(context).banben(version), |
|
), |
|
), |
|
// textItem(S.of(context).tebieshengming), |
|
if (!Platform.isAndroid) |
|
GestureDetector( |
|
child: settingSingleItem(S.of(context).geiwopingfen), |
|
onTap: () { |
|
// Bridge.toAppStore().then((value) { |
|
// if (Platform.isAndroid && value == "0") { |
|
// SmartDialog.showToast("手机没有安装应用市场app", |
|
// alignment: Alignment.center); |
|
// } |
|
// }); |
|
}, |
|
), |
|
GestureDetector( |
|
child: settingSingleItem(S.of(context).yinsishengming), |
|
onTap: () { |
|
Navigator.of(context).pushNamed('/router/treaty_page'); |
|
}, |
|
), |
|
GestureDetector( |
|
child: settingSingleItem("用户协议"), |
|
onTap: () { |
|
Navigator.of(context) |
|
.pushNamed('/router/user_service_page'); |
|
}, |
|
), |
|
GestureDetector( |
|
child: settingSingleItem("注销账户"), |
|
onTap: () { |
|
Navigator.of(context).pushNamed('/router/logout_page'); |
|
}, |
|
), |
|
SizedBox( |
|
height: 100, |
|
), |
|
], |
|
), |
|
), |
|
), |
|
Container( |
|
margin: EdgeInsets.only(bottom: 23), |
|
alignment: Alignment.bottomCenter, |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.end, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
children: [ |
|
Text( |
|
"Copyright©2021", |
|
overflow: TextOverflow.ellipsis, |
|
style: TextStyle( |
|
color: Colors.black, |
|
fontSize: 12, |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
SizedBox( |
|
height: 10, |
|
), |
|
Align( |
|
alignment: Alignment.center, |
|
child: Text( |
|
"知理知己(武汉)文化科技有限公司\n版权所有", |
|
overflow: TextOverflow.ellipsis, |
|
maxLines: 2, |
|
textAlign: TextAlign.center, |
|
style: TextStyle( |
|
color: Colors.black, |
|
fontSize: 12, |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
), |
|
], |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
|
|
updateApp() async { |
|
Uri url = Uri.parse(Platform.isIOS |
|
? "itms-apps://itunes.apple.com/app/id1575124838" |
|
: "http://application.lotus-wallet.com/huixiang?release_id="); |
|
if (await canLaunchUrl(url)) { |
|
await launchUrl(url); |
|
} else { |
|
throw 'Could not launch $url'; |
|
} |
|
} |
|
|
|
Widget settingSingleItem(right) { |
|
return Container( |
|
margin: EdgeInsets.fromLTRB(16, 0, 16, 0), |
|
child: Padding( |
|
padding: EdgeInsets.only(top: 15, bottom: 15), |
|
child: Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
right, |
|
style: TextStyle( |
|
fontSize: 16, |
|
color: Color(0xFF353535), |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
), |
|
SizedBox( |
|
width: 16, |
|
), |
|
Icon( |
|
Icons.keyboard_arrow_right, |
|
size: 24, |
|
), |
|
], |
|
), |
|
), |
|
); |
|
} |
|
|
|
Widget settingItem(left, right) { |
|
return Container( |
|
margin: EdgeInsets.fromLTRB(16, 0, 16, 0), |
|
child: Padding( |
|
padding: EdgeInsets.only(top: 15, bottom: 15), |
|
child: Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
left, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.medium, |
|
fontSize: 16, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
flex: 1, |
|
), |
|
Text( |
|
right, |
|
style: TextStyle( |
|
fontSize: 16, |
|
fontWeight: MyFontWeight.regular, |
|
color: Color(0xFF727272), |
|
), |
|
), |
|
], |
|
), |
|
), |
|
); |
|
} |
|
|
|
Widget textItem(text) { |
|
return Container( |
|
width: double.infinity, |
|
// padding: EdgeInsets.fromLTRB(20, 16, 20, 16), |
|
margin: EdgeInsets.fromLTRB(16, 0, 16, 0), |
|
child: Padding( |
|
padding: EdgeInsets.only(top: 15, bottom: 15), |
|
child: Text( |
|
text, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.medium, |
|
fontSize: 16, |
|
color: Color(0xFF353535), |
|
), |
|
), |
|
), |
|
); |
|
} |
|
}
|
|
|