YSAgreement.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_wallet/base/YSBase.dart';
  4. import 'package:flutter_wallet/generated/l10n.dart';
  5. import 'package:flutter_wallet/tools/YSColors.dart';
  6. import 'package:flutter_wallet/tools/YSLoadData.dart';
  7. import 'package:flutter_wallet/tools/YSTools.dart';
  8. class YSAgreement extends StatefulWidget {
  9. final int type;
  10. const YSAgreement({Key? key, required this.type}) : super(key: key);
  11. @override
  12. YSAgreementState createState() => YSAgreementState();
  13. }
  14. class YSAgreementState extends State<YSAgreement> {
  15. String _valueStr = '';
  16. @override
  17. void initState() {
  18. networkDelay((){
  19. _getData();
  20. });
  21. super.initState();
  22. }
  23. _getData() async{
  24. if(widget.type==1){
  25. _valueStr = await rootBundle.loadString('asset/ysupdateInfo.txt');
  26. }else if(widget.type==2){
  27. _valueStr = await rootBundle.loadString('asset/agreement.txt');
  28. }else if(widget.type==3){
  29. _valueStr = await YSFileWriteRead().readContent();
  30. }
  31. setState(() {});
  32. }
  33. @override
  34. Widget build(BuildContext context) {
  35. return YSBase(
  36. ysTitle: widget.type==1?S.current.GENGXINRIZHI:widget.type==2?S.current.YONGHUXIEYI:'日志信息',
  37. ysChild: SizedBox(
  38. width: ysWidth(context),
  39. child: Padding(
  40. padding: EdgeInsets.all(hsp(10)),
  41. child: Text(_valueStr,style: YSColors.contentStyle(context),),
  42. ),
  43. ),
  44. );
  45. }
  46. }