YSWalletMineTokenChoose.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_wallet/tools/YSSqflite.dart';
  3. import '../../base/YSBase.dart';
  4. import '../../tools/YSTools.dart';
  5. import 'YSWalletListItemView.dart';
  6. class YSWalletMineTokenChoose extends StatefulWidget {
  7. const YSWalletMineTokenChoose({Key? key}) : super(key: key);
  8. @override
  9. YSWalletMineTokenChooseState createState() => YSWalletMineTokenChooseState();
  10. }
  11. class YSWalletMineTokenChooseState extends State<YSWalletMineTokenChoose> {
  12. List _dataArray = [];
  13. @override
  14. void initState() {
  15. networkDelay((){
  16. _getTokenData();
  17. });
  18. super.initState();
  19. }
  20. _getTokenData()async{
  21. _dataArray = await YSSqflite2().init().rawQuery();
  22. setState(() {});
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. return YSBase(
  27. ysTitle: '资产',
  28. ysChild: SizedBox(
  29. height: ysHeight(context),
  30. width: ysWidth(context),
  31. child: ListView.builder(
  32. itemBuilder: (context, index) {
  33. Map item = _dataArray[index];
  34. return YSWalletListChooseItemView(item: item,valueSetter: (value){
  35. Navigator.of(context).pop(value);
  36. },);
  37. },
  38. itemCount: _dataArray.length,
  39. padding: const EdgeInsets.all(0),
  40. shrinkWrap: true,
  41. physics: const NeverScrollableScrollPhysics(),
  42. ),
  43. ),
  44. );
  45. }
  46. }