12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import 'package:flutter/material.dart';
- import 'package:flutter_wallet/generated/l10n.dart';
- import 'package:provider/provider.dart';
- import '../base/YSBase.dart';
- import '../tools/YSColors.dart';
- import '../tools/YSTools.dart';
- class YSSettingUnit extends StatefulWidget {
- const YSSettingUnit({Key? key}) : super(key: key);
- @override
- YSSettingUnitState createState() => YSSettingUnitState();
- }
- class YSSettingUnitState extends State<YSSettingUnit> {
- final List _list = [
- {'title':S.current.MEIYUAN,'type':'dollar','isChoose':false},
- {'title':S.current.RENMINBI,'type':'RMB','isChoose':false}
- ];
- @override
- void initState() {
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ysTitle: S.current.HUOBIDANWEI,
- ysChild: Consumer(
- builder: (context,YSUnitNotifier unit,child) {
- return Container(
- width: ysWidth(context),
- color: YSColors.containColor(context),
- child: ListView.separated(
- itemBuilder: (context,index){
- Map item = _list[index];
- bool isChoose = item['type']==YSUserRecord().unit;
- return GestureDetector(
- onTap: (){
- Provider.of<YSUnitNotifier>(context, listen: false).setUnit(item['type']);
- },
- behavior: HitTestBehavior.opaque,
- child: Padding(
- padding: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- child: Row(
- children: [
- Expanded(child: Text(item['title'],style: YSColors.contentStyle(context),)),
- if(isChoose)Icon(Icons.check_circle,size: hsp(20),color: Colors.black,)
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: hsp(1),color: YSColors.lineColor(context),);
- },
- itemCount: _list.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- ),
- );
- }
- ),
- );
- }
- }
|