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:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/bridge.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/update_dialog.dart'; import 'package:package_info/package_info.dart'; class AboutPage extends StatefulWidget { @override State createState() { return _AboutPage(); } } class _AboutPage extends State { String version = "1.0.0"; @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.h), alignment: Alignment.center, child: Column( children: [ Image.asset( "assets/image/icon_about_logo.png", width: 130, height: 130, ), Padding( padding: EdgeInsets.only(top: 32.h, bottom: 5.h), child: Text( S.of(context).yixinhuixiang, style: TextStyle( fontSize: 30.sp, color: Color(0xff32A060), ), ), ), Text( S.of(context).guojiankangyoujishenghuo, style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.regular, color: Color(0xffB2B2B2), ), ), SizedBox( height: 20.h, ), settingItem( S.of(context).dangqianbanben, S.of(context).banben(version), ), textItem(S.of(context).tebieshengming), InkWell( onTap: () { Navigator.of(context) .pushNamed('/router/help_feedback_page'); // showAlertDialog(version); }, child: textItem(S.of(context).shiyongbangzhu), ), 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'); }, ), Padding( padding: EdgeInsets.only(left: 20.w, right: 20.w), child: Divider( height: 10.0.h, indent: 0.0, color: Colors.grey, ), ), ], ), ), Container( margin: EdgeInsets.only(bottom: 23.h), 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.sp, fontWeight: MyFontWeight.medium, ), ), SizedBox( height: 10.h, ), Align( alignment: Alignment.center, child: Text( "知理知己(武汉)文化科技有限公司\n版权所有", overflow: TextOverflow.ellipsis, maxLines: 2, textAlign: TextAlign.center, style: TextStyle( color: Colors.black, fontSize: 12.sp, fontWeight: MyFontWeight.medium, ), ), ), ], ), ), ], ), ); } Widget settingSingleItem(right) { return Container( margin: EdgeInsets.fromLTRB(16, 0, 16, 0), child: Column( children: [ Divider( height: 10.0.h, indent: 0.0, color: Colors.grey, ), Padding( padding: EdgeInsets.only(top: 15.h, bottom: 15.h), child: Row( children: [ Expanded( child: Text( right, style: TextStyle( fontSize: 16.sp, color: Color(0xFF353535), fontWeight: MyFontWeight.medium, ), ), ), SizedBox( width: 16.w, ), Icon( Icons.keyboard_arrow_right, size: 24, ), ], )), ], ), ); } Widget settingItem(left, right) { return Container( margin: EdgeInsets.fromLTRB(16, 0, 16, 0), child: Column( children: [ Divider( height: 10.0.h, indent: 0.0, color: Colors.grey, ), Padding( padding: EdgeInsets.only(top: 15.h, bottom: 15.h), child: Row( children: [ Expanded( child: Text( left, style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 16.sp, color: Color(0xFF353535), ), ), flex: 1, ), Text( right, style: TextStyle( fontSize: 16.sp, 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.w, 0.h, 16.w, 0.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Divider( height: 10.0.h, indent: 0.0, color: Colors.grey, ), Padding( padding: EdgeInsets.only(top: 15.h, bottom: 15.h), child: Text( text, style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 16.sp, color: Color(0xFF353535), ), ), ), ], ), ); } ///app更新弹窗 showAlertDialog(version) { //显示对话框 showDialog( context: context, builder: (BuildContext context) { return UpdateDialog(version); }, ); } }