123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/res/resources.dart';
- class ClickTelItem extends StatelessWidget {
- const ClickTelItem({
- Key key,
- this.onTap,
- @required this.title,
- this.content: "",
- this.hintText:"",
- this.textAlign: TextAlign.start,
- this.maxLines: 1
- }): super(key: key);
- final GestureTapCallback onTap;
- final String title;
- final String content;
- final String hintText;
- final TextAlign textAlign;
- final int maxLines;
- @override
- Widget build(BuildContext context) {
- return InkWell(
- onTap: onTap,
- child: Container(
- padding: const EdgeInsets.fromLTRB(15, 15.0, 15.0, 15.0),
- constraints: BoxConstraints(
- maxHeight: double.infinity,
- minHeight: 50.0
- ),
- width: double.infinity,
- decoration: BoxDecoration(
- color: Colors.white,
- border: Border(
- bottom: Divider.createBorderSide(context, width: 0.6),
- )
- ),
- child: Row(
- //为了数字类文字居中
- crossAxisAlignment: maxLines == 1 ? CrossAxisAlignment.center : CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.only(right: 5.0),
- child: Text(title),
- ),
- const Spacer(),
- Expanded(
- flex: 4,
- child: Padding(
- padding: const EdgeInsets.only(right: 8.0, left: 16.0),
- child: Text(
- content.length==0?hintText:content,
- maxLines: maxLines,
- textAlign: maxLines == 1 ? TextAlign.right : textAlign,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(fontSize: 14,color: content.length==0?Colours.text_gray_c:Colors.black))
- ),
- ),
- Gaps.vLine,
- Offstage(
- offstage: onTap == null ? true:false,
- child: Opacity(
- // 无点击事件时,隐藏箭头图标
- opacity: onTap == null ? 0 : 1,
- child: Padding(
- padding: EdgeInsets.only(top: maxLines == 1 ? 0.0 : 2.0,left: 10),
- child: Images.iconTel,
- ),
- )
- )
- ],
- ),
- ),
- );
- }
- }
|