YSSettingThem.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_wallet/generated/l10n.dart';
  3. import '../base/YSBase.dart';
  4. import '../tools/YSColors.dart';
  5. import '../tools/YSTools.dart';
  6. class YSSettingThem extends StatefulWidget {
  7. const YSSettingThem({Key? key}) : super(key: key);
  8. @override
  9. YSSettingThemState createState() => YSSettingThemState();
  10. }
  11. class YSSettingThemState extends State<YSSettingThem> {
  12. final List _list = [
  13. {'title':S.current.HEIYE,'type':'dart'},
  14. {'title':S.current.BAITIAN,'type':'light'}
  15. ];
  16. @override
  17. void initState() {
  18. super.initState();
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return YSBase(
  23. ysTitle: S.current.ZHUTISHEZHI,
  24. ysChild: Container(
  25. width: ysWidth(context),
  26. color: YSColors.containColor(context),
  27. child: ListView.separated(
  28. itemBuilder: (context,index){
  29. Map item = _list[index];
  30. bool isChoose = item['type']==YSUserRecord().them;
  31. return GestureDetector(
  32. onTap: (){
  33. },
  34. behavior: HitTestBehavior.opaque,
  35. child: Padding(
  36. padding: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
  37. child: Row(
  38. children: [
  39. Expanded(child: Text(item['title'],style: YSColors.contentStyle(context),)),
  40. if(isChoose)Icon(Icons.check_circle,size: hsp(20),color: YSColors.iconColor(context),)
  41. ],
  42. ),
  43. ),
  44. );
  45. },
  46. separatorBuilder: (context,index){
  47. return Divider(height: hsp(1),color: YSColors.lineColor(context),);
  48. },
  49. itemCount: _list.length,
  50. shrinkWrap: true,
  51. physics: const NeverScrollableScrollPhysics(),
  52. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  53. ),
  54. ),
  55. );
  56. }
  57. }