Daisy fb25ad51f5 1,新增国家及区号选择列表
2,密码/卡/指纹/遥控详情新增去设置其他选项的入口
3,新增找回密码接口调试及逻辑处理
2023-08-07 10:32:24 +08:00

171 lines
4.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/login/seletCountryRegion/common/countries_model.dart';
import 'package:star_lock/login/seletCountryRegion/common/models.dart';
import 'index.dart';
class Utils {
static String getImgPath(String name, {String format: 'png'}) {
return 'assets/images/$name.$format';
}
static void showSnackBar(BuildContext context, String msg) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(msg),
duration: Duration(seconds: 2),
),
);
}
static Widget getSusItem(BuildContext context, String tag,
{double susHeight = 40}) {
if (tag == '') {
tag = '★ 热门城市';
}
return Container(
height: susHeight,
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(left: 16.0),
color: const Color(0xFFF3F4F5),
alignment: Alignment.centerLeft,
child: Text(
tag,
softWrap: false,
style: const TextStyle(
fontSize: 14.0,
color: Color(0xFF666666),
),
),
);
}
static Widget getListItem(BuildContext context, CountriesModel model,
{double susHeight = 40}) {
return GestureDetector(
child: SizedBox(
height: 80.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 20.w,
),
Text(
model.name,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
),
Expanded(
child: SizedBox(
width: 30.w,
)),
Text(
'+${model.tel}',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
SizedBox(
width: 60.w,
)
],
),
// Divider(
// height: 1,
// color: AppColors.greyLineColor,
// endIndent: 0,
// indent: 20.w,
// )
),
onTap: () {
LogUtil.e("onItemClick : $model");
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
},
);
// return ListTile(
// title: Text('${model.name} +${model.tel}'),
// onTap: () {
// LogUtil.e("onItemClick : $model");
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
// },
// );
// return Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Offstage(
// offstage: !(model.isShowSuspension == true),
// child: getSusItem(context, model.getSuspensionTag(),
// susHeight: susHeight),
// ),
// ListTile(
// title: Text(model.name),
// onTap: () {
// LogUtil.e("onItemClick : $model");
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
// },
// )
// ],
// );
}
static Widget getWeChatListItem(
BuildContext context,
ContactInfo model, {
double susHeight = 40,
Color? defHeaderBgColor,
}) {
return getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor);
// return Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Offstage(
// offstage: !(model.isShowSuspension == true),
// child: getSusItem(context, model.getSuspensionTag(),
// susHeight: susHeight),
// ),
// getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor),
// ],
// );
}
static Widget getWeChatItem(
BuildContext context,
ContactInfo model, {
Color? defHeaderBgColor,
}) {
DecorationImage? image;
// if (model.img != null && model.img.isNotEmpty) {
// image = DecorationImage(
// image: CachedNetworkImageProvider(model.img),
// fit: BoxFit.contain,
// );
// }
return ListTile(
leading: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(4.0),
color: model.bgColor ?? defHeaderBgColor,
image: image,
),
child: model.iconData == null
? null
: Icon(
model.iconData,
color: Colors.white,
size: 20,
),
),
title: Text(model.name),
onTap: () {
LogUtil.e("onItemClick : $model");
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
},
);
}
}