12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/utils/theme_utils.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: ThemeUtils.getTabsBg(context),
- 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,style: TextStyle(fontSize: 14,color: ThemeUtils.isDark(context)?Colours.dark_text:Colours.text),),
- ),
- 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:ThemeUtils.isDark(context)?Colours.dark_text:Colours.text))
- ),
- ),
- 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,
- ),
- )
- )
- ],
- ),
- ),
- );
- }
- }
|