import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_wallet/base/YSBase.dart'; import 'package:flutter_wallet/generated/l10n.dart'; import 'package:flutter_wallet/tools/YSColors.dart'; import 'package:flutter_wallet/tools/YSLoadData.dart'; import 'package:flutter_wallet/tools/YSTools.dart'; class YSAgreement extends StatefulWidget { final int type; const YSAgreement({Key? key, required this.type}) : super(key: key); @override YSAgreementState createState() => YSAgreementState(); } class YSAgreementState extends State { String _valueStr = ''; @override void initState() { networkDelay((){ _getData(); }); super.initState(); } _getData() async{ if(widget.type==1){ _valueStr = await rootBundle.loadString('asset/ysupdateInfo.txt'); }else if(widget.type==2){ _valueStr = await rootBundle.loadString('asset/agreement.txt'); }else if(widget.type==3){ _valueStr = await YSFileWriteRead().readContent(); } setState(() {}); } @override Widget build(BuildContext context) { return YSBase( ysTitle: widget.type==1?S.current.GENGXINRIZHI:widget.type==2?S.current.YONGHUXIEYI:'日志信息', ysChild: SizedBox( width: ysWidth(context), child: Padding( padding: EdgeInsets.all(hsp(10)), child: Text(_valueStr,style: YSColors.contentStyle(context),), ), ), ); } }